Importando dados no R

  install.packages("readxl")
  pacotes <-c("tidyverse", "corrr", "psych", "readxl", "d3heatmap", "sjmisc")
  install.packages(pacotes)

Como trazer um arquivo para o R

  setwd("~/Dropbox (Personal)/TRI/2019_slides_exerc")
  library(readxl)
  bd <- read_excel("senna_sal_ex1.xlsx", sheet = "bd_exp")
  dic <- read_excel("senna_sal_ex1.xlsx", sheet = "dic_itens")
  save.image(file = "ex1.RData")
  load("ex1.RData")

Estrutura de dados (objetos) no R

Estruturas de dados no R

Estruturas de dados no R

Explorando objetos

  names(bd)
##   [1] "cod_suj"                "Data de nasc."         
##   [3] "data.aplic"             "Idade0"                
##   [5] "Termo"                  "sujeito"               
##   [7] "serie"                  "turma"                 
##   [9] "Sexo"                   "Mãe (1)"               
##  [11] "Pai (2)"                "Avô (ó) (3)"           
##  [13] "Tios (as) (4)"          "Irmão (as) (5)"        
##  [15] "Filhos (as) (6)"        "Meio irmão (7)"        
##  [17] "Madrasta (8)"           "Padastro (9)"          
##  [19] "Moro só (10)"           "Outr.parentes (11)"    
##  [21] "Não parets (12)"        "Quantas moram"         
##  [23] "Irmão mais novos"       "Irmãos mais velhos"    
##  [25] "Mais velhos que moram"  "Esc. Mãe"              
##  [27] "R. asfaltada"           "E. elétrica"           
##  [29] "Água torneira"          "c. de lixo"            
##  [31] "bol. familia"           "E. doméstica"          
##  [33] "carro"                  "geladeira"             
##  [35] "máq. Lav roupa"         "computador"            
##  [37] "microondas"             "televisão"             
##  [39] "foi reprovado?"         "faço tarefa casa"      
##  [41] "L. de exerc.?"          "Pai (1)"               
##  [43] "Mãe (2)"                "Irmão (3)"             
##  [45] "Sozinho (4)"            "Outro lugar (5)"       
##  [47] "Não estudo (6)"         "nível esc. Pret"       
##  [49] "p.1.13"                 "p.1.14"                
##  [51] "p.1.15"                 "p.1.16"                
##  [53] "p.1.1"                  "p.1.2"                 
##  [55] "p.1.3"                  "p.1.4"                 
##  [57] "sal_cexp_i03_1"         "sal_cexp_i08_1"        
##  [59] "sal_cexp_i17_1"         "sal_cexp_i23_1"        
##  [61] "sal_comlrn_i31_1"       "sal_comlrn_i36_1"      
##  [63] "sal_comlrn_i45_1"       "sal_comlrn_i47_1"      
##  [65] "sal_coplrn_i34_1"       "sal_coplrn_i39_1"      
##  [67] "sal_coplrn_i40_1"       "sal_coplrn_i43_1"      
##  [69] "sal_coplrn_i51_1"       "sal_cstrat_i05_1"      
##  [71] "sal_cstrat_i11_1"       "sal_cstrat_i16_1"      
##  [73] "sal_cstrat_i20_1"       "sal_cstrat_i22_1"      
##  [75] "sal_effper_i04_1"       "sal_effper_i13_1"      
##  [77] "sal_effper_i21_1"       "sal_effper_i26_1"      
##  [79] "sal_elab_i09_1"         "sal_elab_i14_1"        
##  [81] "sal_elab_i18_1"         "sal_elab_i28_1"        
##  [83] "sal_insmot_i06_1"       "sal_insmot_i15_1"      
##  [85] "sal_insmot_i25_1"       "sal_intmat_i29_1"      
##  [87] "sal_intmat_i30_1"       "sal_intmat_i42_1"      
##  [89] "sal_intrea_i33_1"       "sal_intrea_i37_1"      
##  [91] "sal_intrea_i49_1"       "sal_memor_i01_1"       
##  [93] "sal_memor_i02_1"        "sal_memor_i07_1"       
##  [95] "sal_memor_i24_1"        "sal_scacad_i41_1"      
##  [97] "sal_scacad_i46_1"       "sal_scacad_i50_1"      
##  [99] "sal_scmath_i32_1"       "sal_scmath_i35_1"      
## [101] "sal_scmath_i38_1"       "sal_scverb_i44_1"      
## [103] "sal_scverb_i48_0"       "sal_scverb_i52_1"      
## [105] "sal_selfef_i10_1"       "sal_selfef_i12_1"      
## [107] "sal_selfef_i19_1"       "sal_selfef_i27_1"      
## [109] "senna_A_Cmp_i01_1"      "senna_A_Cmp_i30_1"     
## [111] "senna_A_Cmp_i34_1"      "senna_A_Cmp_i36_1"     
## [113] "senna_A_Cmp_i56_1"      "senna_A_Mod_i03_0"     
## [115] "senna_A_Resp_i08_1"     "senna_A_Resp_i13_0"    
## [117] "senna_A_Resp_i41_1"     "senna_A_Resp_i47_1"    
## [119] "senna_A_Tru_i18_1"      "senna_C_Achv_i12_1"    
## [121] "senna_C_Achv_i31_1"     "senna_C_Achv_i45_1"    
## [123] "senna_C_Achv_i57_1"     "senna_C_Conc_i37_1"    
## [125] "senna_C_Conc_i42_1"     "senna_C_Ord_i04_1"     
## [127] "senna_C_Ord_i09_0"      "senna_C_SD_i14_1"      
## [129] "senna_C_SD_i19_0"       "senna_C_SD_i49_1"      
## [131] "senna_chk_chk_i21_0"    "senna_chk_chk_i48_0"   
## [133] "senna_E_Act_i23_1"      "senna_E_Act_i53_1"     
## [135] "senna_E_Assr_i32_0"     "senna_E_Assr_i38_1"    
## [137] "senna_E_Assr_i43_1"     "senna_E_Assr_i58_1"    
## [139] "senna_E_Soc_i05_1"      "senna_E_Soc_i15_0"     
## [141] "senna_E_Soc_i20_0"      "senna_E_Soc_i24_1"     
## [143] "senna_E_Soc_i50_1"      "senna_N_LAngrVol_i06_0"
## [145] "senna_N_LAngrVol_i28_1" "senna_N_LAngrVol_i33_0"
## [147] "senna_N_LAngrVol_i54_1" "senna_N_LAnx_i10_1"    
## [149] "senna_N_LAnx_i16_1"     "senna_N_LAnx_i22_0"    
## [151] "senna_N_LAnx_i39_1"     "senna_N_LAnx_i44_1"    
## [153] "senna_N_LAnx_i59_1"     "senna_N_LDep_i26_0"    
## [155] "senna_N_LDep_i51_1"     "senna_O_Aes_i29_1"     
## [157] "senna_O_Aes_i55_1"      "senna_O_CrImg_i02_1"   
## [159] "senna_O_CrImg_i07_1"    "senna_O_CrImg_i11_0"   
## [161] "senna_O_CrImg_i17_0"    "senna_O_CrImg_i35_1"   
## [163] "senna_O_CrImg_i40_1"    "senna_O_IntCur_i25_1"  
## [165] "senna_O_IntCur_i27_1"   "senna_O_IntCur_i46_1"  
## [167] "senna_O_IntCur_i52_1"   "A.M. Port."            
## [169] "A.M. Mat."
        str(bd)
## Classes 'tbl_df', 'tbl' and 'data.frame':    76 obs. of  169 variables:
##  $ cod_suj               : num  1 2 3 4 5 6 7 8 9 10 ...
##  $ Data de nasc.         : POSIXct, format: "2002-11-09" NA ...
##  $ data.aplic            : POSIXct, format: "2016-07-01" "2016-07-01" ...
##  $ Idade0                : num  13.6 NA 14.2 14.4 14.1 ...
##  $ Termo                 : num  0 1 1 0 0 0 0 0 1 0 ...
##  $ sujeito               : num  47 48 49 50 51 52 53 54 55 56 ...
##  $ serie                 : num  9 9 9 9 9 9 9 9 9 9 ...
##  $ turma                 : num  91 91 91 91 91 91 91 91 91 91 ...
##  $ Sexo                  : num  2 2 1 1 1 1 2 1 2 2 ...
##  $ Mãe (1)               : num  1 1 1 1 1 0 1 1 1 1 ...
##  $ Pai (2)               : num  0 0 1 1 0 0 0 1 1 0 ...
##  $ Avô (ó) (3)           : num  1 0 0 0 0 0 0 0 0 0 ...
##  $ Tios (as) (4)         : num  1 0 0 0 0 1 0 0 0 0 ...
##  $ Irmão (as) (5)        : num  1 1 1 1 1 0 1 0 1 1 ...
##  $ Filhos (as) (6)       : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ Meio irmão (7)        : num  0 0 0 0 0 0 0 0 1 0 ...
##  $ Madrasta (8)          : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ Padastro (9)          : num  1 1 0 0 1 0 1 0 0 1 ...
##  $ Moro só (10)          : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ Outr.parentes (11)    : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ Não parets (12)       : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ Quantas moram         : num  7 3 5 3 3 4 3 4 4 3 ...
##  $ Irmão mais novos      : num  1 0 0 0 2 0 1 1 1 2 ...
##  $ Irmãos mais velhos    : num  3 1 1 3 2 2 0 1 5 0 ...
##  $ Mais velhos que moram : num  1 NA 1 1 1 0 0 0 2 0 ...
##  $ Esc. Mãe              : num  NA 6 6 1 4 5 6 6 3 3 ...
##  $ R. asfaltada          : num  1 1 1 1 1 0 1 1 1 1 ...
##  $ E. elétrica           : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ Água torneira         : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ c. de lixo            : num  1 1 1 1 1 1 1 1 1 1 ...
##  $ bol. familia          : num  1 1 0 0 0 0 0 0 0 0 ...
##  $ E. doméstica          : num  0 0 0 0 0 1 0 0 0 0 ...
##  $ carro                 : num  NA 1 2 2 1 2 1 1 1 1 ...
##  $ geladeira             : num  2 1 2 1 1 2 1 1 1 1 ...
##  $ máq. Lav roupa        : num  0 1 1 0 1 1 1 1 1 1 ...
##  $ computador            : num  0 1 1 1 1 3 2 2 1 2 ...
##  $ microondas            : num  1 1 2 1 NA 1 0 0 1 1 ...
##  $ televisão             : num  2 1 3 3 NA 2 1 2 2 2 ...
##  $ foi reprovado?        : num  0 0 0 0 0 1 0 0 0 0 ...
##  $ faço tarefa casa      : num  2 2 2 2 2 1 2 2 1 1 ...
##  $ L. de exerc.?         : num  2 2 2 2 2 2 2 1 1 2 ...
##  $ Pai (1)               : num  0 0 1 1 0 0 0 0 0 0 ...
##  $ Mãe (2)               : num  0 0 1 0 0 1 0 0 0 1 ...
##  $ Irmão (3)             : num  0 1 1 1 1 1 0 0 0 0 ...
##  $ Sozinho (4)           : num  1 0 0 0 0 1 1 1 1 0 ...
##  $ Outro lugar (5)       : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ Não estudo (6)        : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ nível esc. Pret       : num  4 4 3 4 3 4 4 4 4 4 ...
##  $ p.1.13                : num  4 5 2 4 4 5 5 5 5 4 ...
##  $ p.1.14                : num  2 3 3 3 2 3 3 2 3 3 ...
##  $ p.1.15                : num  1 2 1 1 1 1 1 2 1 2 ...
##  $ p.1.16                : num  2 3 3 3 3 4 4 5 5 5 ...
##  $ p.1.1                 : num  1 1 1 1 3 2 2 2 1 1 ...
##  $ p.1.2                 : num  2 4 2 3 5 3 3 1 2 3 ...
##  $ p.1.3                 : num  5 5 4 5 2 5 5 4 5 5 ...
##  $ p.1.4                 : num  2 4 2 2 4 3 3 5 4 4 ...
##  $ sal_cexp_i03_1        : num  2 1 2 2 2 4 3 3 4 1 ...
##  $ sal_cexp_i08_1        : num  2 2 2 2 4 1 4 2 3 2 ...
##  $ sal_cexp_i17_1        : num  NA 4 3 2 2 4 5 4 NA 2 ...
##  $ sal_cexp_i23_1        : num  2 1 2 2 3 3 2 3 4 2 ...
##  $ sal_comlrn_i31_1      : num  2 1 3 3 3 3 2 4 2 2 ...
##  $ sal_comlrn_i36_1      : num  3 2 2 5 3 4 2 2 2 4 ...
##  $ sal_comlrn_i45_1      : num  3 2 3 2 3 3 1 4 1 1 ...
##  $ sal_comlrn_i47_1      : num  2 1 2 3 3 2 3 4 1 1 ...
##  $ sal_coplrn_i34_1      : num  NA 1 3 2 4 4 5 3 3 4 ...
##  $ sal_coplrn_i39_1      : num  3 1 3 3 3 3 4 3 4 4 ...
##  $ sal_coplrn_i40_1      : num  2 2 3 2 4 4 4 4 4 4 ...
##  $ sal_coplrn_i43_1      : num  3 3 2 3 3 4 3 3 4 4 ...
##  $ sal_coplrn_i51_1      : num  NA 2 3 3 4 4 1 3 4 3 ...
##  $ sal_cstrat_i05_1      : num  3 2 2 2 2 2 1 3 4 3 ...
##  $ sal_cstrat_i11_1      : num  4 4 2 2 3 2 2 2 4 2 ...
##  $ sal_cstrat_i16_1      : num  2 3 2 2 4 2 2 3 3 4 ...
##  $ sal_cstrat_i20_1      : num  NA 4 2 2 2 3 3 2 4 2 ...
##  $ sal_cstrat_i22_1      : num  2 4 2 2 3 2 1 4 4 3 ...
##  $ sal_effper_i04_1      : num  2 2 2 2 4 3 2 4 4 3 ...
##  $ sal_effper_i13_1      : num  4 1 2 2 2 2 2 4 4 2 ...
##  $ sal_effper_i21_1      : num  4 4 3 2 4 3 3 3 4 2 ...
##  $ sal_effper_i26_1      : num  2 1 2 3 4 3 3 NA 4 3 ...
##  $ sal_elab_i09_1        : num  2 3 2 2 2 3 4 2 3 2 ...
##  $ sal_elab_i14_1        : num  2 2 2 NA 3 3 4 2 3 2 ...
##  $ sal_elab_i18_1        : num  3 3 2 2 2 2 2 2 3 2 ...
##  $ sal_elab_i28_1        : num  3 1 2 2 2 3 3 3 4 3 ...
##  $ sal_insmot_i06_1      : num  NA 4 3 3 3 4 5 4 4 3 ...
##  $ sal_insmot_i15_1      : num  4 4 3 3 2 3 4 4 4 4 ...
##  $ sal_insmot_i25_1      : num  2 2 3 2 2 4 3 4 4 4 ...
##  $ sal_intmat_i29_1      : num  1 1 3 3 3 2 1 4 3 3 ...
##  $ sal_intmat_i30_1      : num  2 1 2 3 3 2 1 2 3 2 ...
##  $ sal_intmat_i42_1      : num  4 2 3 3 3 3 5 4 3 4 ...
##  $ sal_intrea_i33_1      : num  1 1 2 1 4 3 1 1 3 3 ...
##  $ sal_intrea_i37_1      : num  2 4 2 2 4 4 2 2 4 4 ...
##  $ sal_intrea_i49_1      : num  1 1 1 1 4 4 1 3 4 3 ...
##  $ sal_memor_i01_1       : num  2 1 2 2 2 2 2 2 4 4 ...
##  $ sal_memor_i02_1       : num  NA 1 3 2 3 2 2 3 3 3 ...
##  $ sal_memor_i07_1       : num  2 3 2 2 2 3 1 3 3 NA ...
##  $ sal_memor_i24_1       : num  1 1 1 2 3 3 1 2 3 3 ...
##  $ sal_scacad_i41_1      : num  2 4 3 2 2 4 1 2 4 2 ...
##  $ sal_scacad_i46_1      : num  2 1 2 2 2 3 1 2 4 2 ...
##  $ sal_scacad_i50_1      : num  2 2 3 2 3 3 5 3 4 3 ...
##  $ sal_scmath_i32_1      : num  1 1 3 3 3 3 1 3 4 3 ...
##   [list output truncated]
        vars <- names(bd)
        vars
##   [1] "cod_suj"                "Data de nasc."         
##   [3] "data.aplic"             "Idade0"                
##   [5] "Termo"                  "sujeito"               
##   [7] "serie"                  "turma"                 
##   [9] "Sexo"                   "Mãe (1)"               
##  [11] "Pai (2)"                "Avô (ó) (3)"           
##  [13] "Tios (as) (4)"          "Irmão (as) (5)"        
##  [15] "Filhos (as) (6)"        "Meio irmão (7)"        
##  [17] "Madrasta (8)"           "Padastro (9)"          
##  [19] "Moro só (10)"           "Outr.parentes (11)"    
##  [21] "Não parets (12)"        "Quantas moram"         
##  [23] "Irmão mais novos"       "Irmãos mais velhos"    
##  [25] "Mais velhos que moram"  "Esc. Mãe"              
##  [27] "R. asfaltada"           "E. elétrica"           
##  [29] "Água torneira"          "c. de lixo"            
##  [31] "bol. familia"           "E. doméstica"          
##  [33] "carro"                  "geladeira"             
##  [35] "máq. Lav roupa"         "computador"            
##  [37] "microondas"             "televisão"             
##  [39] "foi reprovado?"         "faço tarefa casa"      
##  [41] "L. de exerc.?"          "Pai (1)"               
##  [43] "Mãe (2)"                "Irmão (3)"             
##  [45] "Sozinho (4)"            "Outro lugar (5)"       
##  [47] "Não estudo (6)"         "nível esc. Pret"       
##  [49] "p.1.13"                 "p.1.14"                
##  [51] "p.1.15"                 "p.1.16"                
##  [53] "p.1.1"                  "p.1.2"                 
##  [55] "p.1.3"                  "p.1.4"                 
##  [57] "sal_cexp_i03_1"         "sal_cexp_i08_1"        
##  [59] "sal_cexp_i17_1"         "sal_cexp_i23_1"        
##  [61] "sal_comlrn_i31_1"       "sal_comlrn_i36_1"      
##  [63] "sal_comlrn_i45_1"       "sal_comlrn_i47_1"      
##  [65] "sal_coplrn_i34_1"       "sal_coplrn_i39_1"      
##  [67] "sal_coplrn_i40_1"       "sal_coplrn_i43_1"      
##  [69] "sal_coplrn_i51_1"       "sal_cstrat_i05_1"      
##  [71] "sal_cstrat_i11_1"       "sal_cstrat_i16_1"      
##  [73] "sal_cstrat_i20_1"       "sal_cstrat_i22_1"      
##  [75] "sal_effper_i04_1"       "sal_effper_i13_1"      
##  [77] "sal_effper_i21_1"       "sal_effper_i26_1"      
##  [79] "sal_elab_i09_1"         "sal_elab_i14_1"        
##  [81] "sal_elab_i18_1"         "sal_elab_i28_1"        
##  [83] "sal_insmot_i06_1"       "sal_insmot_i15_1"      
##  [85] "sal_insmot_i25_1"       "sal_intmat_i29_1"      
##  [87] "sal_intmat_i30_1"       "sal_intmat_i42_1"      
##  [89] "sal_intrea_i33_1"       "sal_intrea_i37_1"      
##  [91] "sal_intrea_i49_1"       "sal_memor_i01_1"       
##  [93] "sal_memor_i02_1"        "sal_memor_i07_1"       
##  [95] "sal_memor_i24_1"        "sal_scacad_i41_1"      
##  [97] "sal_scacad_i46_1"       "sal_scacad_i50_1"      
##  [99] "sal_scmath_i32_1"       "sal_scmath_i35_1"      
## [101] "sal_scmath_i38_1"       "sal_scverb_i44_1"      
## [103] "sal_scverb_i48_0"       "sal_scverb_i52_1"      
## [105] "sal_selfef_i10_1"       "sal_selfef_i12_1"      
## [107] "sal_selfef_i19_1"       "sal_selfef_i27_1"      
## [109] "senna_A_Cmp_i01_1"      "senna_A_Cmp_i30_1"     
## [111] "senna_A_Cmp_i34_1"      "senna_A_Cmp_i36_1"     
## [113] "senna_A_Cmp_i56_1"      "senna_A_Mod_i03_0"     
## [115] "senna_A_Resp_i08_1"     "senna_A_Resp_i13_0"    
## [117] "senna_A_Resp_i41_1"     "senna_A_Resp_i47_1"    
## [119] "senna_A_Tru_i18_1"      "senna_C_Achv_i12_1"    
## [121] "senna_C_Achv_i31_1"     "senna_C_Achv_i45_1"    
## [123] "senna_C_Achv_i57_1"     "senna_C_Conc_i37_1"    
## [125] "senna_C_Conc_i42_1"     "senna_C_Ord_i04_1"     
## [127] "senna_C_Ord_i09_0"      "senna_C_SD_i14_1"      
## [129] "senna_C_SD_i19_0"       "senna_C_SD_i49_1"      
## [131] "senna_chk_chk_i21_0"    "senna_chk_chk_i48_0"   
## [133] "senna_E_Act_i23_1"      "senna_E_Act_i53_1"     
## [135] "senna_E_Assr_i32_0"     "senna_E_Assr_i38_1"    
## [137] "senna_E_Assr_i43_1"     "senna_E_Assr_i58_1"    
## [139] "senna_E_Soc_i05_1"      "senna_E_Soc_i15_0"     
## [141] "senna_E_Soc_i20_0"      "senna_E_Soc_i24_1"     
## [143] "senna_E_Soc_i50_1"      "senna_N_LAngrVol_i06_0"
## [145] "senna_N_LAngrVol_i28_1" "senna_N_LAngrVol_i33_0"
## [147] "senna_N_LAngrVol_i54_1" "senna_N_LAnx_i10_1"    
## [149] "senna_N_LAnx_i16_1"     "senna_N_LAnx_i22_0"    
## [151] "senna_N_LAnx_i39_1"     "senna_N_LAnx_i44_1"    
## [153] "senna_N_LAnx_i59_1"     "senna_N_LDep_i26_0"    
## [155] "senna_N_LDep_i51_1"     "senna_O_Aes_i29_1"     
## [157] "senna_O_Aes_i55_1"      "senna_O_CrImg_i02_1"   
## [159] "senna_O_CrImg_i07_1"    "senna_O_CrImg_i11_0"   
## [161] "senna_O_CrImg_i17_0"    "senna_O_CrImg_i35_1"   
## [163] "senna_O_CrImg_i40_1"    "senna_O_IntCur_i25_1"  
## [165] "senna_O_IntCur_i27_1"   "senna_O_IntCur_i46_1"  
## [167] "senna_O_IntCur_i52_1"   "A.M. Port."            
## [169] "A.M. Mat."
        str(vars)
##  chr [1:169] "cod_suj" "Data de nasc." "data.aplic" "Idade0" "Termo" ...

Manipulação dos dados

  1:6
## [1] 1 2 3 4 5 6
  c(1:6)
## [1] 1 2 3 4 5 6
  c(1, 3, 10:20)
##  [1]  1  3 10 11 12 13 14 15 16 17 18 19 20
  names(bd) 
##   [1] "cod_suj"                "Data de nasc."         
##   [3] "data.aplic"             "Idade0"                
##   [5] "Termo"                  "sujeito"               
##   [7] "serie"                  "turma"                 
##   [9] "Sexo"                   "Mãe (1)"               
##  [11] "Pai (2)"                "Avô (ó) (3)"           
##  [13] "Tios (as) (4)"          "Irmão (as) (5)"        
##  [15] "Filhos (as) (6)"        "Meio irmão (7)"        
##  [17] "Madrasta (8)"           "Padastro (9)"          
##  [19] "Moro só (10)"           "Outr.parentes (11)"    
##  [21] "Não parets (12)"        "Quantas moram"         
##  [23] "Irmão mais novos"       "Irmãos mais velhos"    
##  [25] "Mais velhos que moram"  "Esc. Mãe"              
##  [27] "R. asfaltada"           "E. elétrica"           
##  [29] "Água torneira"          "c. de lixo"            
##  [31] "bol. familia"           "E. doméstica"          
##  [33] "carro"                  "geladeira"             
##  [35] "máq. Lav roupa"         "computador"            
##  [37] "microondas"             "televisão"             
##  [39] "foi reprovado?"         "faço tarefa casa"      
##  [41] "L. de exerc.?"          "Pai (1)"               
##  [43] "Mãe (2)"                "Irmão (3)"             
##  [45] "Sozinho (4)"            "Outro lugar (5)"       
##  [47] "Não estudo (6)"         "nível esc. Pret"       
##  [49] "p.1.13"                 "p.1.14"                
##  [51] "p.1.15"                 "p.1.16"                
##  [53] "p.1.1"                  "p.1.2"                 
##  [55] "p.1.3"                  "p.1.4"                 
##  [57] "sal_cexp_i03_1"         "sal_cexp_i08_1"        
##  [59] "sal_cexp_i17_1"         "sal_cexp_i23_1"        
##  [61] "sal_comlrn_i31_1"       "sal_comlrn_i36_1"      
##  [63] "sal_comlrn_i45_1"       "sal_comlrn_i47_1"      
##  [65] "sal_coplrn_i34_1"       "sal_coplrn_i39_1"      
##  [67] "sal_coplrn_i40_1"       "sal_coplrn_i43_1"      
##  [69] "sal_coplrn_i51_1"       "sal_cstrat_i05_1"      
##  [71] "sal_cstrat_i11_1"       "sal_cstrat_i16_1"      
##  [73] "sal_cstrat_i20_1"       "sal_cstrat_i22_1"      
##  [75] "sal_effper_i04_1"       "sal_effper_i13_1"      
##  [77] "sal_effper_i21_1"       "sal_effper_i26_1"      
##  [79] "sal_elab_i09_1"         "sal_elab_i14_1"        
##  [81] "sal_elab_i18_1"         "sal_elab_i28_1"        
##  [83] "sal_insmot_i06_1"       "sal_insmot_i15_1"      
##  [85] "sal_insmot_i25_1"       "sal_intmat_i29_1"      
##  [87] "sal_intmat_i30_1"       "sal_intmat_i42_1"      
##  [89] "sal_intrea_i33_1"       "sal_intrea_i37_1"      
##  [91] "sal_intrea_i49_1"       "sal_memor_i01_1"       
##  [93] "sal_memor_i02_1"        "sal_memor_i07_1"       
##  [95] "sal_memor_i24_1"        "sal_scacad_i41_1"      
##  [97] "sal_scacad_i46_1"       "sal_scacad_i50_1"      
##  [99] "sal_scmath_i32_1"       "sal_scmath_i35_1"      
## [101] "sal_scmath_i38_1"       "sal_scverb_i44_1"      
## [103] "sal_scverb_i48_0"       "sal_scverb_i52_1"      
## [105] "sal_selfef_i10_1"       "sal_selfef_i12_1"      
## [107] "sal_selfef_i19_1"       "sal_selfef_i27_1"      
## [109] "senna_A_Cmp_i01_1"      "senna_A_Cmp_i30_1"     
## [111] "senna_A_Cmp_i34_1"      "senna_A_Cmp_i36_1"     
## [113] "senna_A_Cmp_i56_1"      "senna_A_Mod_i03_0"     
## [115] "senna_A_Resp_i08_1"     "senna_A_Resp_i13_0"    
## [117] "senna_A_Resp_i41_1"     "senna_A_Resp_i47_1"    
## [119] "senna_A_Tru_i18_1"      "senna_C_Achv_i12_1"    
## [121] "senna_C_Achv_i31_1"     "senna_C_Achv_i45_1"    
## [123] "senna_C_Achv_i57_1"     "senna_C_Conc_i37_1"    
## [125] "senna_C_Conc_i42_1"     "senna_C_Ord_i04_1"     
## [127] "senna_C_Ord_i09_0"      "senna_C_SD_i14_1"      
## [129] "senna_C_SD_i19_0"       "senna_C_SD_i49_1"      
## [131] "senna_chk_chk_i21_0"    "senna_chk_chk_i48_0"   
## [133] "senna_E_Act_i23_1"      "senna_E_Act_i53_1"     
## [135] "senna_E_Assr_i32_0"     "senna_E_Assr_i38_1"    
## [137] "senna_E_Assr_i43_1"     "senna_E_Assr_i58_1"    
## [139] "senna_E_Soc_i05_1"      "senna_E_Soc_i15_0"     
## [141] "senna_E_Soc_i20_0"      "senna_E_Soc_i24_1"     
## [143] "senna_E_Soc_i50_1"      "senna_N_LAngrVol_i06_0"
## [145] "senna_N_LAngrVol_i28_1" "senna_N_LAngrVol_i33_0"
## [147] "senna_N_LAngrVol_i54_1" "senna_N_LAnx_i10_1"    
## [149] "senna_N_LAnx_i16_1"     "senna_N_LAnx_i22_0"    
## [151] "senna_N_LAnx_i39_1"     "senna_N_LAnx_i44_1"    
## [153] "senna_N_LAnx_i59_1"     "senna_N_LDep_i26_0"    
## [155] "senna_N_LDep_i51_1"     "senna_O_Aes_i29_1"     
## [157] "senna_O_Aes_i55_1"      "senna_O_CrImg_i02_1"   
## [159] "senna_O_CrImg_i07_1"    "senna_O_CrImg_i11_0"   
## [161] "senna_O_CrImg_i17_0"    "senna_O_CrImg_i35_1"   
## [163] "senna_O_CrImg_i40_1"    "senna_O_IntCur_i25_1"  
## [165] "senna_O_IntCur_i27_1"   "senna_O_IntCur_i46_1"  
## [167] "senna_O_IntCur_i52_1"   "A.M. Port."            
## [169] "A.M. Mat."
  vars <- names(bd)
  e_vars<- vars[c(133:143)]
  
  # Subset de variáveis
  dt <- bd[ , vars]
 
  
  # removendo da área de trabalho
  rm(dt)
# R raiz

  bd[1:5 , ]  

  table(bd$serie)
  table(bd$serie, bd$Sexo)
 
 dt <-  bd[bd$serie==5 , ]
  
# R nutela: dplyr 
 
# https://strengejacke.github.io/sjmisc/index.html
  library(sjmisc)
  frq(bd$serie)
  flat_table(bd, serie, Sexo)
  
  
  library(tidyverse)
  bd %>% select(serie, Sexo) %>% flat_table()
  
  dt <- bd %>% filter(Sexo==1)

Explorando estatísticas descritivas

  library(psych)
  
  describe(bd[ , e_vars])
##                    vars  n mean   sd median trimmed  mad min max range
## senna_E_Act_i23_1     1 75 4.40 0.77      5    4.51 0.00   2   5     3
## senna_E_Act_i53_1     2 75 3.95 1.16      4    4.07 1.48   1   5     4
## senna_E_Assr_i32_0    3 75 2.72 1.44      3    2.66 1.48   1   5     4
## senna_E_Assr_i38_1    4 76 2.83 1.26      3    2.79 1.48   1   5     4
## senna_E_Assr_i43_1    5 75 3.21 1.35      3    3.26 1.48   1   5     4
## senna_E_Assr_i58_1    6 75 3.17 1.37      3    3.21 1.48   1   5     4
## senna_E_Soc_i05_1     7 75 4.43 0.90      5    4.61 0.00   1   5     4
## senna_E_Soc_i15_0     8 75 2.88 1.48      3    2.85 1.48   1   5     4
## senna_E_Soc_i20_0     9 75 2.32 1.28      2    2.18 1.48   1   5     4
## senna_E_Soc_i24_1    10 75 3.63 1.14      4    3.72 1.48   1   5     4
## senna_E_Soc_i50_1    11 75 3.37 1.40      4    3.46 1.48   1   5     4
##                     skew kurtosis   se
## senna_E_Act_i23_1  -0.98    -0.07 0.09
## senna_E_Act_i53_1  -0.61    -0.98 0.13
## senna_E_Assr_i32_0  0.30    -1.26 0.17
## senna_E_Assr_i38_1  0.24    -0.96 0.14
## senna_E_Assr_i43_1 -0.22    -1.15 0.16
## senna_E_Assr_i58_1  0.06    -1.32 0.16
## senna_E_Soc_i05_1  -1.69     2.46 0.10
## senna_E_Soc_i15_0   0.06    -1.43 0.17
## senna_E_Soc_i20_0   0.59    -0.72 0.15
## senna_E_Soc_i24_1  -0.56    -0.46 0.13
## senna_E_Soc_i50_1  -0.41    -1.08 0.16
  corr.test(bd[ , e_vars])
## Call:corr.test(x = bd[, e_vars])
## Correlation matrix 
##                    senna_E_Act_i23_1 senna_E_Act_i53_1 senna_E_Assr_i32_0
## senna_E_Act_i23_1               1.00              0.05               0.05
## senna_E_Act_i53_1               0.05              1.00              -0.14
## senna_E_Assr_i32_0              0.05             -0.14               1.00
## senna_E_Assr_i38_1              0.03             -0.01              -0.29
## senna_E_Assr_i43_1             -0.06              0.04               0.00
## senna_E_Assr_i58_1              0.07             -0.01              -0.08
## senna_E_Soc_i05_1              -0.03              0.24              -0.16
## senna_E_Soc_i15_0              -0.06              0.02               0.32
## senna_E_Soc_i20_0              -0.13              0.08               0.07
## senna_E_Soc_i24_1               0.21              0.00               0.13
## senna_E_Soc_i50_1              -0.05              0.21               0.03
##                    senna_E_Assr_i38_1 senna_E_Assr_i43_1
## senna_E_Act_i23_1                0.03              -0.06
## senna_E_Act_i53_1               -0.01               0.04
## senna_E_Assr_i32_0              -0.29               0.00
## senna_E_Assr_i38_1               1.00               0.43
## senna_E_Assr_i43_1               0.43               1.00
## senna_E_Assr_i58_1               0.20               0.30
## senna_E_Soc_i05_1                0.11               0.07
## senna_E_Soc_i15_0               -0.31               0.02
## senna_E_Soc_i20_0                0.00               0.06
## senna_E_Soc_i24_1                0.23               0.06
## senna_E_Soc_i50_1                0.12               0.16
##                    senna_E_Assr_i58_1 senna_E_Soc_i05_1 senna_E_Soc_i15_0
## senna_E_Act_i23_1                0.07             -0.03             -0.06
## senna_E_Act_i53_1               -0.01              0.24              0.02
## senna_E_Assr_i32_0              -0.08             -0.16              0.32
## senna_E_Assr_i38_1               0.20              0.11             -0.31
## senna_E_Assr_i43_1               0.30              0.07              0.02
## senna_E_Assr_i58_1               1.00              0.12             -0.14
## senna_E_Soc_i05_1                0.12              1.00             -0.04
## senna_E_Soc_i15_0               -0.14             -0.04              1.00
## senna_E_Soc_i20_0               -0.01             -0.11              0.12
## senna_E_Soc_i24_1                0.26              0.33             -0.05
## senna_E_Soc_i50_1                0.21              0.17             -0.06
##                    senna_E_Soc_i20_0 senna_E_Soc_i24_1 senna_E_Soc_i50_1
## senna_E_Act_i23_1              -0.13              0.21             -0.05
## senna_E_Act_i53_1               0.08              0.00              0.21
## senna_E_Assr_i32_0              0.07              0.13              0.03
## senna_E_Assr_i38_1              0.00              0.23              0.12
## senna_E_Assr_i43_1              0.06              0.06              0.16
## senna_E_Assr_i58_1             -0.01              0.26              0.21
## senna_E_Soc_i05_1              -0.11              0.33              0.17
## senna_E_Soc_i15_0               0.12             -0.05             -0.06
## senna_E_Soc_i20_0               1.00             -0.04              0.11
## senna_E_Soc_i24_1              -0.04              1.00              0.20
## senna_E_Soc_i50_1               0.11              0.20              1.00
## Sample Size 
##                    senna_E_Act_i23_1 senna_E_Act_i53_1 senna_E_Assr_i32_0
## senna_E_Act_i23_1                 75                74                 74
## senna_E_Act_i53_1                 74                75                 74
## senna_E_Assr_i32_0                74                74                 75
## senna_E_Assr_i38_1                75                75                 75
## senna_E_Assr_i43_1                74                74                 74
## senna_E_Assr_i58_1                74                74                 74
## senna_E_Soc_i05_1                 74                74                 74
## senna_E_Soc_i15_0                 74                74                 74
## senna_E_Soc_i20_0                 74                74                 74
## senna_E_Soc_i24_1                 74                74                 74
## senna_E_Soc_i50_1                 74                74                 74
##                    senna_E_Assr_i38_1 senna_E_Assr_i43_1
## senna_E_Act_i23_1                  75                 74
## senna_E_Act_i53_1                  75                 74
## senna_E_Assr_i32_0                 75                 74
## senna_E_Assr_i38_1                 76                 75
## senna_E_Assr_i43_1                 75                 75
## senna_E_Assr_i58_1                 75                 74
## senna_E_Soc_i05_1                  75                 74
## senna_E_Soc_i15_0                  75                 74
## senna_E_Soc_i20_0                  75                 74
## senna_E_Soc_i24_1                  75                 74
## senna_E_Soc_i50_1                  75                 74
##                    senna_E_Assr_i58_1 senna_E_Soc_i05_1 senna_E_Soc_i15_0
## senna_E_Act_i23_1                  74                74                74
## senna_E_Act_i53_1                  74                74                74
## senna_E_Assr_i32_0                 74                74                74
## senna_E_Assr_i38_1                 75                75                75
## senna_E_Assr_i43_1                 74                74                74
## senna_E_Assr_i58_1                 75                74                74
## senna_E_Soc_i05_1                  74                75                74
## senna_E_Soc_i15_0                  74                74                75
## senna_E_Soc_i20_0                  74                74                74
## senna_E_Soc_i24_1                  74                74                74
## senna_E_Soc_i50_1                  74                74                74
##                    senna_E_Soc_i20_0 senna_E_Soc_i24_1 senna_E_Soc_i50_1
## senna_E_Act_i23_1                 74                74                74
## senna_E_Act_i53_1                 74                74                74
## senna_E_Assr_i32_0                74                74                74
## senna_E_Assr_i38_1                75                75                75
## senna_E_Assr_i43_1                74                74                74
## senna_E_Assr_i58_1                74                74                74
## senna_E_Soc_i05_1                 74                74                74
## senna_E_Soc_i15_0                 74                74                74
## senna_E_Soc_i20_0                 75                74                74
## senna_E_Soc_i24_1                 74                75                74
## senna_E_Soc_i50_1                 74                74                75
## Probability values (Entries above the diagonal are adjusted for multiple tests.) 
##                    senna_E_Act_i23_1 senna_E_Act_i53_1 senna_E_Assr_i32_0
## senna_E_Act_i23_1               0.00              1.00               1.00
## senna_E_Act_i53_1               0.70              0.00               1.00
## senna_E_Assr_i32_0              0.66              0.22               0.00
## senna_E_Assr_i38_1              0.77              0.95               0.01
## senna_E_Assr_i43_1              0.62              0.71               0.98
## senna_E_Assr_i58_1              0.54              0.94               0.48
## senna_E_Soc_i05_1               0.80              0.04               0.18
## senna_E_Soc_i15_0               0.63              0.88               0.01
## senna_E_Soc_i20_0               0.27              0.47               0.53
## senna_E_Soc_i24_1               0.07              0.98               0.28
## senna_E_Soc_i50_1               0.65              0.07               0.81
##                    senna_E_Assr_i38_1 senna_E_Assr_i43_1
## senna_E_Act_i23_1                1.00               1.00
## senna_E_Act_i53_1                1.00               1.00
## senna_E_Assr_i32_0               0.66               1.00
## senna_E_Assr_i38_1               0.00               0.01
## senna_E_Assr_i43_1               0.00               0.00
## senna_E_Assr_i58_1               0.08               0.01
## senna_E_Soc_i05_1                0.34               0.55
## senna_E_Soc_i15_0                0.01               0.84
## senna_E_Soc_i20_0                0.97               0.62
## senna_E_Soc_i24_1                0.05               0.60
## senna_E_Soc_i50_1                0.30               0.17
##                    senna_E_Assr_i58_1 senna_E_Soc_i05_1 senna_E_Soc_i15_0
## senna_E_Act_i23_1                1.00              1.00              1.00
## senna_E_Act_i53_1                1.00              1.00              1.00
## senna_E_Assr_i32_0               1.00              1.00              0.28
## senna_E_Assr_i38_1               1.00              1.00              0.38
## senna_E_Assr_i43_1               0.46              1.00              1.00
## senna_E_Assr_i58_1               0.00              1.00              1.00
## senna_E_Soc_i05_1                0.30              0.00              1.00
## senna_E_Soc_i15_0                0.24              0.74              0.00
## senna_E_Soc_i20_0                0.94              0.34              0.32
## senna_E_Soc_i24_1                0.02              0.00              0.70
## senna_E_Soc_i50_1                0.07              0.15              0.59
##                    senna_E_Soc_i20_0 senna_E_Soc_i24_1 senna_E_Soc_i50_1
## senna_E_Act_i23_1               1.00              1.00                 1
## senna_E_Act_i53_1               1.00              1.00                 1
## senna_E_Assr_i32_0              1.00              1.00                 1
## senna_E_Assr_i38_1              1.00              1.00                 1
## senna_E_Assr_i43_1              1.00              1.00                 1
## senna_E_Assr_i58_1              1.00              1.00                 1
## senna_E_Soc_i05_1               1.00              0.25                 1
## senna_E_Soc_i15_0               1.00              1.00                 1
## senna_E_Soc_i20_0               0.00              1.00                 1
## senna_E_Soc_i24_1               0.72              0.00                 1
## senna_E_Soc_i50_1               0.36              0.08                 0
## 
##  To see confidence intervals of the correlations, print with the short=FALSE option

Porque você vai querer mudar para o R

   r <- cor(bd[ , e_vars],use="pair")
  
  library(d3heatmap)
  d3heatmap(r, xaxis_font_size = 10, yaxis_font_size = 10)
  library(corrr)
  
  network_plot(r, min_cor=.10)

  x <- correlate(bd[ , e_vars])
 
  fashion(x)
##               rowname senna_E_Act_i23_1 senna_E_Act_i53_1
## 1   senna_E_Act_i23_1                                 .05
## 2   senna_E_Act_i53_1               .05                  
## 3  senna_E_Assr_i32_0               .05              -.14
## 4  senna_E_Assr_i38_1               .03              -.01
## 5  senna_E_Assr_i43_1              -.06               .04
## 6  senna_E_Assr_i58_1               .07              -.01
## 7   senna_E_Soc_i05_1              -.03               .24
## 8   senna_E_Soc_i15_0              -.06               .02
## 9   senna_E_Soc_i20_0              -.13               .08
## 10  senna_E_Soc_i24_1               .21               .00
## 11  senna_E_Soc_i50_1              -.05               .21
##    senna_E_Assr_i32_0 senna_E_Assr_i38_1 senna_E_Assr_i43_1
## 1                 .05                .03               -.06
## 2                -.14               -.01                .04
## 3                                   -.29               -.00
## 4                -.29                                   .43
## 5                -.00                .43                   
## 6                -.08                .20                .30
## 7                -.16                .11                .07
## 8                 .32               -.31                .02
## 9                 .07               -.00                .06
## 10                .13                .23                .06
## 11                .03                .12                .16
##    senna_E_Assr_i58_1 senna_E_Soc_i05_1 senna_E_Soc_i15_0
## 1                 .07              -.03              -.06
## 2                -.01               .24               .02
## 3                -.08              -.16               .32
## 4                 .20               .11              -.31
## 5                 .30               .07               .02
## 6                                   .12              -.14
## 7                 .12                                -.04
## 8                -.14              -.04                  
## 9                -.01              -.11               .12
## 10                .26               .33              -.05
## 11                .21               .17              -.06
##    senna_E_Soc_i20_0 senna_E_Soc_i24_1 senna_E_Soc_i50_1
## 1               -.13               .21              -.05
## 2                .08               .00               .21
## 3                .07               .13               .03
## 4               -.00               .23               .12
## 5                .06               .06               .16
## 6               -.01               .26               .21
## 7               -.11               .33               .17
## 8                .12              -.05              -.06
## 9                                 -.04               .11
## 10              -.04                                 .20
## 11               .11               .20

Análise psicométrica com o Psych

e_vars
##  [1] "senna_E_Act_i23_1"  "senna_E_Act_i53_1"  "senna_E_Assr_i32_0"
##  [4] "senna_E_Assr_i38_1" "senna_E_Assr_i43_1" "senna_E_Assr_i58_1"
##  [7] "senna_E_Soc_i05_1"  "senna_E_Soc_i15_0"  "senna_E_Soc_i20_0" 
## [10] "senna_E_Soc_i24_1"  "senna_E_Soc_i50_1"
alpha(bd[ , e_vars],keys = e_vars[c(3, 8, 9)])
## 
## Reliability analysis   
## Call: alpha(x = bd[, e_vars], keys = e_vars[c(3, 8, 9)])
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
##       0.54      0.54     0.6     0.096 1.2 0.077  3.5 0.53    0.071
## 
##  lower alpha upper     95% confidence boundaries
## 0.39 0.54 0.69 
## 
##  Reliability if an item is dropped:
##                     raw_alpha std.alpha G6(smc) average_r  S/N alpha se
## senna_E_Act_i23_1        0.55      0.55    0.61     0.110 1.24    0.077
## senna_E_Act_i53_1        0.54      0.54    0.59     0.105 1.18    0.077
## senna_E_Assr_i32_0-      0.52      0.52    0.57     0.099 1.10    0.080
## senna_E_Assr_i38_1       0.46      0.46    0.51     0.080 0.86    0.092
## senna_E_Assr_i43_1       0.52      0.52    0.56     0.097 1.08    0.082
## senna_E_Assr_i58_1       0.48      0.49    0.55     0.087 0.95    0.087
## senna_E_Soc_i05_1        0.50      0.49    0.55     0.089 0.97    0.083
## senna_E_Soc_i15_0-       0.51      0.51    0.57     0.095 1.05    0.083
## senna_E_Soc_i20_0-       0.57      0.56    0.61     0.113 1.27    0.073
## senna_E_Soc_i24_1        0.51      0.50    0.54     0.090 0.99    0.082
## senna_E_Soc_i50_1        0.52      0.52    0.58     0.097 1.07    0.081
##                     var.r med.r
## senna_E_Act_i23_1   0.017 0.113
## senna_E_Act_i53_1   0.016 0.084
## senna_E_Assr_i32_0- 0.015 0.071
## senna_E_Assr_i38_1  0.013 0.063
## senna_E_Assr_i43_1  0.014 0.084
## senna_E_Assr_i58_1  0.016 0.061
## senna_E_Soc_i05_1   0.017 0.061
## senna_E_Soc_i15_0-  0.016 0.072
## senna_E_Soc_i20_0-  0.016 0.084
## senna_E_Soc_i24_1   0.015 0.071
## senna_E_Soc_i50_1   0.016 0.071
## 
##  Item statistics 
##                      n raw.r std.r r.cor r.drop mean   sd
## senna_E_Act_i23_1   75  0.22  0.29 0.124  0.073  4.4 0.77
## senna_E_Act_i53_1   75  0.31  0.34 0.196  0.118  3.9 1.16
## senna_E_Assr_i32_0- 75  0.44  0.40 0.311  0.211  3.3 1.44
## senna_E_Assr_i38_1  76  0.61  0.59 0.585  0.444  2.8 1.26
## senna_E_Assr_i43_1  75  0.44  0.42 0.344  0.227  3.2 1.35
## senna_E_Assr_i58_1  75  0.53  0.52 0.443  0.337  3.2 1.37
## senna_E_Soc_i05_1   75  0.44  0.50 0.430  0.311  4.4 0.90
## senna_E_Soc_i15_0-  75  0.49  0.44 0.344  0.256  3.1 1.48
## senna_E_Soc_i20_0-  75  0.25  0.26 0.083  0.037  3.7 1.28
## senna_E_Soc_i24_1   75  0.43  0.48 0.432  0.259  3.6 1.14
## senna_E_Soc_i50_1   75  0.45  0.42 0.304  0.216  3.4 1.40
## 
## Non missing response frequency for each item
##                       1    2    3    4    5 miss
## senna_E_Act_i23_1  0.00 0.01 0.13 0.29 0.56 0.01
## senna_E_Act_i53_1  0.01 0.13 0.21 0.17 0.47 0.01
## senna_E_Assr_i32_0 0.27 0.23 0.20 0.13 0.17 0.01
## senna_E_Assr_i38_1 0.16 0.28 0.28 0.16 0.13 0.00
## senna_E_Assr_i43_1 0.15 0.16 0.24 0.24 0.21 0.01
## senna_E_Assr_i58_1 0.11 0.27 0.24 0.12 0.27 0.01
## senna_E_Soc_i05_1  0.01 0.04 0.08 0.24 0.63 0.01
## senna_E_Soc_i15_0  0.27 0.16 0.19 0.20 0.19 0.01
## senna_E_Soc_i20_0  0.36 0.21 0.25 0.09 0.08 0.01
## senna_E_Soc_i24_1  0.05 0.11 0.25 0.33 0.25 0.01
## senna_E_Soc_i50_1  0.16 0.09 0.24 0.23 0.28 0.01
alpha(bd[ , e_vars], check.keys=TRUE)
## 
## Reliability analysis   
## Call: alpha(x = bd[, e_vars], check.keys = TRUE)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
##       0.54      0.54     0.6     0.096 1.2 0.077  3.5 0.53    0.071
## 
##  lower alpha upper     95% confidence boundaries
## 0.39 0.54 0.69 
## 
##  Reliability if an item is dropped:
##                     raw_alpha std.alpha G6(smc) average_r  S/N alpha se
## senna_E_Act_i23_1        0.55      0.55    0.61     0.110 1.24    0.077
## senna_E_Act_i53_1        0.54      0.54    0.59     0.105 1.18    0.077
## senna_E_Assr_i32_0-      0.52      0.52    0.57     0.099 1.10    0.080
## senna_E_Assr_i38_1       0.46      0.46    0.51     0.080 0.86    0.092
## senna_E_Assr_i43_1       0.52      0.52    0.56     0.097 1.08    0.082
## senna_E_Assr_i58_1       0.48      0.49    0.55     0.087 0.95    0.087
## senna_E_Soc_i05_1        0.50      0.49    0.55     0.089 0.97    0.083
## senna_E_Soc_i15_0-       0.51      0.51    0.57     0.095 1.05    0.083
## senna_E_Soc_i20_0-       0.57      0.56    0.61     0.113 1.27    0.073
## senna_E_Soc_i24_1        0.51      0.50    0.54     0.090 0.99    0.082
## senna_E_Soc_i50_1        0.52      0.52    0.58     0.097 1.07    0.081
##                     var.r med.r
## senna_E_Act_i23_1   0.017 0.113
## senna_E_Act_i53_1   0.016 0.084
## senna_E_Assr_i32_0- 0.015 0.071
## senna_E_Assr_i38_1  0.013 0.063
## senna_E_Assr_i43_1  0.014 0.084
## senna_E_Assr_i58_1  0.016 0.061
## senna_E_Soc_i05_1   0.017 0.061
## senna_E_Soc_i15_0-  0.016 0.072
## senna_E_Soc_i20_0-  0.016 0.084
## senna_E_Soc_i24_1   0.015 0.071
## senna_E_Soc_i50_1   0.016 0.071
## 
##  Item statistics 
##                      n raw.r std.r r.cor r.drop mean   sd
## senna_E_Act_i23_1   75  0.22  0.29 0.124  0.073  4.4 0.77
## senna_E_Act_i53_1   75  0.31  0.34 0.196  0.118  3.9 1.16
## senna_E_Assr_i32_0- 75  0.44  0.40 0.311  0.211  3.3 1.44
## senna_E_Assr_i38_1  76  0.61  0.59 0.585  0.444  2.8 1.26
## senna_E_Assr_i43_1  75  0.44  0.42 0.344  0.227  3.2 1.35
## senna_E_Assr_i58_1  75  0.53  0.52 0.443  0.337  3.2 1.37
## senna_E_Soc_i05_1   75  0.44  0.50 0.430  0.311  4.4 0.90
## senna_E_Soc_i15_0-  75  0.49  0.44 0.344  0.256  3.1 1.48
## senna_E_Soc_i20_0-  75  0.25  0.26 0.083  0.037  3.7 1.28
## senna_E_Soc_i24_1   75  0.43  0.48 0.432  0.259  3.6 1.14
## senna_E_Soc_i50_1   75  0.45  0.42 0.304  0.216  3.4 1.40
## 
## Non missing response frequency for each item
##                       1    2    3    4    5 miss
## senna_E_Act_i23_1  0.00 0.01 0.13 0.29 0.56 0.01
## senna_E_Act_i53_1  0.01 0.13 0.21 0.17 0.47 0.01
## senna_E_Assr_i32_0 0.27 0.23 0.20 0.13 0.17 0.01
## senna_E_Assr_i38_1 0.16 0.28 0.28 0.16 0.13 0.00
## senna_E_Assr_i43_1 0.15 0.16 0.24 0.24 0.21 0.01
## senna_E_Assr_i58_1 0.11 0.27 0.24 0.12 0.27 0.01
## senna_E_Soc_i05_1  0.01 0.04 0.08 0.24 0.63 0.01
## senna_E_Soc_i15_0  0.27 0.16 0.19 0.20 0.19 0.01
## senna_E_Soc_i20_0  0.36 0.21 0.25 0.09 0.08 0.01
## senna_E_Soc_i24_1  0.05 0.11 0.25 0.33 0.25 0.01
## senna_E_Soc_i50_1  0.16 0.09 0.24 0.23 0.28 0.01

Tente você

  • Faça as mesmas análises (descritivas, correlação e alfa para a escala de neuroticismo
  • Organize um projeto crianco um diretório e salvando os dados e código. Você consegue fechar o projeto e abri-lo de novo ?

  • Resposta do exercício

  vars
##   [1] "cod_suj"                "Data de nasc."         
##   [3] "data.aplic"             "Idade0"                
##   [5] "Termo"                  "sujeito"               
##   [7] "serie"                  "turma"                 
##   [9] "Sexo"                   "Mãe (1)"               
##  [11] "Pai (2)"                "Avô (ó) (3)"           
##  [13] "Tios (as) (4)"          "Irmão (as) (5)"        
##  [15] "Filhos (as) (6)"        "Meio irmão (7)"        
##  [17] "Madrasta (8)"           "Padastro (9)"          
##  [19] "Moro só (10)"           "Outr.parentes (11)"    
##  [21] "Não parets (12)"        "Quantas moram"         
##  [23] "Irmão mais novos"       "Irmãos mais velhos"    
##  [25] "Mais velhos que moram"  "Esc. Mãe"              
##  [27] "R. asfaltada"           "E. elétrica"           
##  [29] "Água torneira"          "c. de lixo"            
##  [31] "bol. familia"           "E. doméstica"          
##  [33] "carro"                  "geladeira"             
##  [35] "máq. Lav roupa"         "computador"            
##  [37] "microondas"             "televisão"             
##  [39] "foi reprovado?"         "faço tarefa casa"      
##  [41] "L. de exerc.?"          "Pai (1)"               
##  [43] "Mãe (2)"                "Irmão (3)"             
##  [45] "Sozinho (4)"            "Outro lugar (5)"       
##  [47] "Não estudo (6)"         "nível esc. Pret"       
##  [49] "p.1.13"                 "p.1.14"                
##  [51] "p.1.15"                 "p.1.16"                
##  [53] "p.1.1"                  "p.1.2"                 
##  [55] "p.1.3"                  "p.1.4"                 
##  [57] "sal_cexp_i03_1"         "sal_cexp_i08_1"        
##  [59] "sal_cexp_i17_1"         "sal_cexp_i23_1"        
##  [61] "sal_comlrn_i31_1"       "sal_comlrn_i36_1"      
##  [63] "sal_comlrn_i45_1"       "sal_comlrn_i47_1"      
##  [65] "sal_coplrn_i34_1"       "sal_coplrn_i39_1"      
##  [67] "sal_coplrn_i40_1"       "sal_coplrn_i43_1"      
##  [69] "sal_coplrn_i51_1"       "sal_cstrat_i05_1"      
##  [71] "sal_cstrat_i11_1"       "sal_cstrat_i16_1"      
##  [73] "sal_cstrat_i20_1"       "sal_cstrat_i22_1"      
##  [75] "sal_effper_i04_1"       "sal_effper_i13_1"      
##  [77] "sal_effper_i21_1"       "sal_effper_i26_1"      
##  [79] "sal_elab_i09_1"         "sal_elab_i14_1"        
##  [81] "sal_elab_i18_1"         "sal_elab_i28_1"        
##  [83] "sal_insmot_i06_1"       "sal_insmot_i15_1"      
##  [85] "sal_insmot_i25_1"       "sal_intmat_i29_1"      
##  [87] "sal_intmat_i30_1"       "sal_intmat_i42_1"      
##  [89] "sal_intrea_i33_1"       "sal_intrea_i37_1"      
##  [91] "sal_intrea_i49_1"       "sal_memor_i01_1"       
##  [93] "sal_memor_i02_1"        "sal_memor_i07_1"       
##  [95] "sal_memor_i24_1"        "sal_scacad_i41_1"      
##  [97] "sal_scacad_i46_1"       "sal_scacad_i50_1"      
##  [99] "sal_scmath_i32_1"       "sal_scmath_i35_1"      
## [101] "sal_scmath_i38_1"       "sal_scverb_i44_1"      
## [103] "sal_scverb_i48_0"       "sal_scverb_i52_1"      
## [105] "sal_selfef_i10_1"       "sal_selfef_i12_1"      
## [107] "sal_selfef_i19_1"       "sal_selfef_i27_1"      
## [109] "senna_A_Cmp_i01_1"      "senna_A_Cmp_i30_1"     
## [111] "senna_A_Cmp_i34_1"      "senna_A_Cmp_i36_1"     
## [113] "senna_A_Cmp_i56_1"      "senna_A_Mod_i03_0"     
## [115] "senna_A_Resp_i08_1"     "senna_A_Resp_i13_0"    
## [117] "senna_A_Resp_i41_1"     "senna_A_Resp_i47_1"    
## [119] "senna_A_Tru_i18_1"      "senna_C_Achv_i12_1"    
## [121] "senna_C_Achv_i31_1"     "senna_C_Achv_i45_1"    
## [123] "senna_C_Achv_i57_1"     "senna_C_Conc_i37_1"    
## [125] "senna_C_Conc_i42_1"     "senna_C_Ord_i04_1"     
## [127] "senna_C_Ord_i09_0"      "senna_C_SD_i14_1"      
## [129] "senna_C_SD_i19_0"       "senna_C_SD_i49_1"      
## [131] "senna_chk_chk_i21_0"    "senna_chk_chk_i48_0"   
## [133] "senna_E_Act_i23_1"      "senna_E_Act_i53_1"     
## [135] "senna_E_Assr_i32_0"     "senna_E_Assr_i38_1"    
## [137] "senna_E_Assr_i43_1"     "senna_E_Assr_i58_1"    
## [139] "senna_E_Soc_i05_1"      "senna_E_Soc_i15_0"     
## [141] "senna_E_Soc_i20_0"      "senna_E_Soc_i24_1"     
## [143] "senna_E_Soc_i50_1"      "senna_N_LAngrVol_i06_0"
## [145] "senna_N_LAngrVol_i28_1" "senna_N_LAngrVol_i33_0"
## [147] "senna_N_LAngrVol_i54_1" "senna_N_LAnx_i10_1"    
## [149] "senna_N_LAnx_i16_1"     "senna_N_LAnx_i22_0"    
## [151] "senna_N_LAnx_i39_1"     "senna_N_LAnx_i44_1"    
## [153] "senna_N_LAnx_i59_1"     "senna_N_LDep_i26_0"    
## [155] "senna_N_LDep_i51_1"     "senna_O_Aes_i29_1"     
## [157] "senna_O_Aes_i55_1"      "senna_O_CrImg_i02_1"   
## [159] "senna_O_CrImg_i07_1"    "senna_O_CrImg_i11_0"   
## [161] "senna_O_CrImg_i17_0"    "senna_O_CrImg_i35_1"   
## [163] "senna_O_CrImg_i40_1"    "senna_O_IntCur_i25_1"  
## [165] "senna_O_IntCur_i27_1"   "senna_O_IntCur_i46_1"  
## [167] "senna_O_IntCur_i52_1"   "A.M. Port."            
## [169] "A.M. Mat."
  c_vars<- vars[c(120:130)]
  r <- cor(bd[ , c_vars],use="pair")
  
  library(d3heatmap)
  d3heatmap(r, xaxis_font_size = 10, yaxis_font_size = 10)
  library(corrr)
  
  network_plot(r, min_cor=.10)

  x <- correlate(bd[ , c_vars])
  fashion(x)
##               rowname senna_C_Achv_i12_1 senna_C_Achv_i31_1
## 1  senna_C_Achv_i12_1                                   .63
## 2  senna_C_Achv_i31_1                .63                   
## 3  senna_C_Achv_i45_1                .58                .50
## 4  senna_C_Achv_i57_1                .33                .30
## 5  senna_C_Conc_i37_1                .38                .46
## 6  senna_C_Conc_i42_1                .40                .49
## 7   senna_C_Ord_i04_1                .61                .72
## 8   senna_C_Ord_i09_0               -.13               -.42
## 9    senna_C_SD_i14_1                .40                .38
## 10   senna_C_SD_i19_0               -.27               -.44
## 11   senna_C_SD_i49_1                .48                .49
##    senna_C_Achv_i45_1 senna_C_Achv_i57_1 senna_C_Conc_i37_1
## 1                 .58                .33                .38
## 2                 .50                .30                .46
## 3                                    .22                .43
## 4                 .22                                   .26
## 5                 .43                .26                   
## 6                 .44                .28                .46
## 7                 .52                .42                .38
## 8                -.15                .14               -.24
## 9                 .43                .18                .41
## 10               -.28               -.02               -.32
## 11                .37                .11                .37
##    senna_C_Conc_i42_1 senna_C_Ord_i04_1 senna_C_Ord_i09_0 senna_C_SD_i14_1
## 1                 .40               .61              -.13              .40
## 2                 .49               .72              -.42              .38
## 3                 .44               .52              -.15              .43
## 4                 .28               .42               .14              .18
## 5                 .46               .38              -.24              .41
## 6                                   .45              -.41              .30
## 7                 .45                                -.29              .37
## 8                -.41              -.29                               -.26
## 9                 .30               .37              -.26                 
## 10               -.51              -.29               .61             -.25
## 11                .66               .50              -.53              .34
##    senna_C_SD_i19_0 senna_C_SD_i49_1
## 1              -.27              .48
## 2              -.44              .49
## 3              -.28              .37
## 4              -.02              .11
## 5              -.32              .37
## 6              -.51              .66
## 7              -.29              .50
## 8               .61             -.53
## 9              -.25              .34
## 10                              -.53
## 11             -.53
  alpha(bd[ , c_vars], check.keys=TRUE)
## 
## Reliability analysis   
## Call: alpha(x = bd[, c_vars], check.keys = TRUE)
## 
##   raw_alpha std.alpha G6(smc) average_r S/N   ase mean   sd median_r
##       0.87      0.87     0.9      0.38 6.7 0.023  3.9 0.74     0.39
## 
##  lower alpha upper     95% confidence boundaries
## 0.82 0.87 0.91 
## 
##  Reliability if an item is dropped:
##                    raw_alpha std.alpha G6(smc) average_r S/N alpha se
## senna_C_Achv_i12_1      0.85      0.85    0.88      0.37 5.8    0.026
## senna_C_Achv_i31_1      0.84      0.85    0.87      0.35 5.5    0.027
## senna_C_Achv_i45_1      0.85      0.86    0.88      0.37 6.0    0.025
## senna_C_Achv_i57_1      0.87      0.88    0.90      0.42 7.2    0.022
## senna_C_Conc_i37_1      0.85      0.86    0.89      0.38 6.1    0.025
## senna_C_Conc_i42_1      0.85      0.85    0.88      0.36 5.7    0.026
## senna_C_Ord_i04_1       0.84      0.85    0.88      0.36 5.7    0.027
## senna_C_Ord_i09_0-      0.86      0.87    0.88      0.40 6.6    0.023
## senna_C_SD_i14_1        0.86      0.86    0.89      0.39 6.4    0.024
## senna_C_SD_i19_0-       0.86      0.86    0.89      0.38 6.2    0.024
## senna_C_SD_i49_1        0.85      0.85    0.88      0.36 5.7    0.026
##                    var.r med.r
## senna_C_Achv_i12_1 0.026  0.38
## senna_C_Achv_i31_1 0.025  0.37
## senna_C_Achv_i45_1 0.028  0.39
## senna_C_Achv_i57_1 0.017  0.42
## senna_C_Conc_i37_1 0.030  0.39
## senna_C_Conc_i42_1 0.028  0.37
## senna_C_Ord_i04_1  0.026  0.39
## senna_C_Ord_i09_0- 0.020  0.39
## senna_C_SD_i14_1   0.029  0.41
## senna_C_SD_i19_0-  0.025  0.39
## senna_C_SD_i49_1   0.026  0.39
## 
##  Item statistics 
##                     n raw.r std.r r.cor r.drop mean   sd
## senna_C_Achv_i12_1 75  0.70  0.72  0.70   0.64  3.8 0.94
## senna_C_Achv_i31_1 75  0.80  0.81  0.80   0.75  4.2 1.05
## senna_C_Achv_i45_1 76  0.66  0.68  0.64   0.58  4.0 1.03
## senna_C_Achv_i57_1 74  0.39  0.41  0.33   0.27  3.8 1.10
## senna_C_Conc_i37_1 76  0.64  0.65  0.59   0.56  3.8 1.02
## senna_C_Conc_i42_1 74  0.75  0.74  0.72   0.67  4.2 1.03
## senna_C_Ord_i04_1  75  0.76  0.76  0.75   0.68  4.1 1.24
## senna_C_Ord_i09_0- 74  0.56  0.54  0.50   0.44  4.0 1.24
## senna_C_SD_i14_1   74  0.61  0.58  0.51   0.48  3.7 1.26
## senna_C_SD_i19_0-  74  0.64  0.63  0.59   0.54  3.9 1.26
## senna_C_SD_i49_1   76  0.74  0.74  0.73   0.67  4.1 1.09
## 
## Non missing response frequency for each item
##                       1    2    3    4    5 miss
## senna_C_Achv_i12_1 0.01 0.07 0.28 0.39 0.25 0.01
## senna_C_Achv_i31_1 0.01 0.07 0.20 0.19 0.53 0.01
## senna_C_Achv_i45_1 0.00 0.09 0.25 0.24 0.42 0.00
## senna_C_Achv_i57_1 0.04 0.07 0.27 0.30 0.32 0.03
## senna_C_Conc_i37_1 0.01 0.09 0.26 0.32 0.32 0.00
## senna_C_Conc_i42_1 0.03 0.04 0.16 0.24 0.53 0.03
## senna_C_Ord_i04_1  0.04 0.12 0.13 0.16 0.55 0.01
## senna_C_Ord_i09_0  0.47 0.22 0.18 0.07 0.07 0.03
## senna_C_SD_i14_1   0.05 0.14 0.26 0.18 0.38 0.03
## senna_C_SD_i19_0   0.43 0.24 0.14 0.14 0.05 0.03
## senna_C_SD_i49_1   0.04 0.05 0.16 0.29 0.46 0.00