O Pacote Psych

Correção e psicometria clássica com testes de múltipla escolha

load("ibap.RData")
library(readxl)
dic <-read_excel("lego.xlsx", col_names = TRUE, sheet = "Sheet2")

library(dplyr)
dic <- tbl_df(dic)
dic
## Source: local data frame [118 x 15]
## 
##    Bloco2 CodItem Ord VarLabel Key0 Key1 Key2     b senna54 senna84
## 1      RV   ahv_1   1        1    2   NA   NA -3.36      NA      NA
## 2      RV   ahv_2   2        2    4   NA   NA -2.47      NA      NA
## 3      RV   ahv_3   3        3    3   NA   NA -1.39      NA      NA
## 4      RV   ahv_4   4        4    3   NA   NA -0.99      NA      NA
## 5      RV   ahv_5   5        5    1   NA   NA -0.91      NA      NA
## 6      RV   ahv_6   6        6    5   NA   NA -0.38      NA      NA
## 7      RV   ahv_7   7        7    2   NA   NA  0.39      NA      NA
## 8      RV   ahv_8   8        8    5   NA   NA  0.33      NA      NA
## 9      RV   ahv_9   9        9    1   NA   NA  1.07      NA      NA
## 10     RA   aha_1   1        1    3   NA   NA -3.28      NA      NA
## ..    ...     ... ...      ...  ...  ...  ...   ...     ...     ...
## Variables not shown: OrdSenna84 (dbl), domain (chr), facet (chr), pole
##   (dbl), P_S (dbl)
key <- dic[1:27 ,]$Key0
key
##  [1] 2 4 3 3 1 5 2 5 1 3 5 4 2 4 3 3 5 1 1 2 5 3 4 2 2 5 1
names(df1)
##   [1] "id"                "IDA_SEXO"          "IDA_DT_NASCIMENTO"
##   [4] "IDA_SERIE"         "IDA_TURMA"         "IDA_TURNO"        
##   [7] "ahv_1"             "ahv_2"             "ahv_3"            
##  [10] "ahv_4"             "ahv_5"             "ahv_6"            
##  [13] "ahv_7"             "ahv_8"             "ahv_9"            
##  [16] "aha_1"             "aha_2"             "aha_3"            
##  [19] "aha_4"             "aha_5"             "aha_6"            
##  [22] "aha_7"             "aha_8"             "aha_9"            
##  [25] "ahe_1"             "ahe_2"             "ahe_3"            
##  [28] "ahe_4"             "ahe_5"             "ahe_6"            
##  [31] "ahe_7"             "ahe_8"             "ahe_9"            
##  [34] "ise_1"             "ise_2"             "ise_3"            
##  [37] "ise_4"             "ise_5"             "ise_6"            
##  [40] "ise_7"             "ise_8"             "ise_9"            
##  [43] "ise_10"            "ise_11"            "ise_12"           
##  [46] "ise_13"            "ise_14"            "ise_15"           
##  [49] "ise_16"            "ise_17"            "ise_18"           
##  [52] "ise_19"            "ise_20"            "ise_21"           
##  [55] "ise_22"            "ise_23"            "ise_24"           
##  [58] "ise_25"            "ise_26"            "ise_27"           
##  [61] "ise_28"            "ise_29"            "ise_30"           
##  [64] "ise_31"            "ise_32"            "ise_33"           
##  [67] "ise_34"            "ise_35"            "ise_36"           
##  [70] "ise_37"            "ise_38"            "ise_39"           
##  [73] "ise_40"            "ise_41"            "ise_42"           
##  [76] "ise_43"            "ise_44"            "ise_45"           
##  [79] "ise_46"            "ise_47"            "ise_48"           
##  [82] "ise_49"            "ise_50"            "ise_51"           
##  [85] "ise_52"            "ise_53"            "ise_54"           
##  [88] "ise_55"            "ise_56"            "ise_57"           
##  [91] "ise_58"            "ise_59"            "ise_60"           
##  [94] "ise_61"            "ise_62"            "ise_63"           
##  [97] "ise_64"            "ise_65"            "ise_66"           
## [100] "ise_67"            "ise_68"            "ise_69"           
## [103] "ise_70"            "ise_71"            "ise_72"           
## [106] "ise_73"            "ise_74"            "ise_75"           
## [109] "ise_76"            "ise_77"            "ise_78"           
## [112] "ise_79"            "ise_80"            "ise_81"           
## [115] "ise_82"            "ise_83"            "ise_84"           
## [118] "ise_85"            "ise_86"            "ise_87"           
## [121] "ise_88"            "ise_89"            "ise_90"           
## [124] "ise_91"
library(psych)

?score.multiple.choice

bpr_psicom  <- score.multiple.choice(key, df1[ ,c(7:33)], score=TRUE, short=FALSE)
print.psych(bpr_psicom, short = FALSE)
## Call: NULL
## 
## (Unstandardized) Alpha:
## [1] 0.77
## 
## Average item correlation:
## [1] 0.11
## 
## item statistics 
##       key    1    2    3    4    5 miss     r    n mean   sd  skew
## ahv_1   2 0.08 0.70 0.09 0.07 0.06 0.41  0.07 2098 0.70 0.46 -0.86
## ahv_2   4 0.16 0.08 0.21 0.48 0.06 0.43  0.62 2054 0.48 0.50  0.08
## ahv_3   3 0.16 0.10 0.44 0.12 0.18 0.44  0.59 2020 0.44 0.50  0.25
## ahv_4   3 0.08 0.37 0.36 0.10 0.08 0.46  0.54 1930 0.36 0.48  0.60
## ahv_5   1 0.40 0.08 0.19 0.09 0.25 0.49  0.53 1833 0.40 0.49  0.40
## ahv_6   5 0.13 0.20 0.16 0.15 0.35 0.51  0.44 1749 0.35 0.48  0.62
## ahv_7   2 0.57 0.09 0.15 0.06 0.12 0.52  0.18 1705 0.09 0.29  2.77
## ahv_8   5 0.33 0.26 0.24 0.08 0.09 0.54  0.17 1649 0.09 0.29  2.86
## ahv_9   1 0.41 0.21 0.21 0.07 0.09 0.54  0.44 1628 0.41 0.49  0.36
## aha_1   3 0.06 0.08 0.79 0.03 0.05 0.41  0.12 2117 0.79 0.41 -1.41
## aha_2   5 0.07 0.08 0.18 0.13 0.54 0.41  0.06 2103 0.54 0.50 -0.16
## aha_3   4 0.17 0.15 0.16 0.30 0.22 0.42  0.55 2066 0.30 0.46  0.87
## aha_4   2 0.06 0.36 0.18 0.31 0.09 0.43  0.51 2044 0.36 0.48  0.58
## aha_5   4 0.17 0.07 0.14 0.34 0.27 0.47  0.48 1896 0.34 0.48  0.66
## aha_6   3 0.05 0.42 0.34 0.10 0.10 0.48  0.50 1862 0.34 0.47  0.69
## aha_7   3 0.14 0.14 0.50 0.11 0.11 0.49 -0.05 1833 0.50 0.50 -0.01
## aha_8   5 0.16 0.17 0.19 0.33 0.14 0.50  0.31 1803 0.14 0.35  2.06
## aha_9   1 0.14 0.13 0.18 0.29 0.26 0.50  0.24 1776 0.14 0.34  2.10
## ahe_1   1 0.49 0.12 0.18 0.10 0.11 0.42  0.54 2079 0.49 0.50  0.05
## ahe_2   2 0.20 0.37 0.13 0.11 0.19 0.43  0.47 2035 0.37 0.48  0.55
## ahe_3   5 0.25 0.33 0.16 0.07 0.19 0.44  0.32 2015 0.19 0.39  1.62
## ahe_4   3 0.14 0.11 0.32 0.21 0.22 0.45  0.47 1969 0.32 0.47  0.77
## ahe_5   4 0.18 0.22 0.22 0.27 0.11 0.47  0.45 1914 0.27 0.45  1.01
## ahe_6   2 0.14 0.35 0.24 0.18 0.10 0.48  0.45 1861 0.35 0.48  0.64
## ahe_7   2 0.16 0.30 0.21 0.19 0.15 0.50  0.46 1803 0.30 0.46  0.89
## ahe_8   5 0.27 0.17 0.25 0.16 0.15 0.50  0.28 1778 0.15 0.36  1.94
## ahe_9   1 0.21 0.17 0.24 0.19 0.19 0.51  0.31 1750 0.21 0.41  1.44
##       kurtosis   se
## ahv_1    -1.27 0.01
## ahv_2    -1.99 0.01
## ahv_3    -1.94 0.01
## ahv_4    -1.64 0.01
## ahv_5    -1.84 0.01
## ahv_6    -1.62 0.01
## ahv_7     5.68 0.01
## ahv_8     6.16 0.01
## ahv_9    -1.87 0.01
## aha_1    -0.01 0.01
## aha_2    -1.98 0.01
## aha_3    -1.24 0.01
## aha_4    -1.66 0.01
## aha_5    -1.57 0.01
## aha_6    -1.52 0.01
## aha_7    -2.00 0.01
## aha_8     2.23 0.01
## aha_9     2.43 0.01
## ahe_1    -2.00 0.01
## ahe_2    -1.69 0.01
## ahe_3     0.63 0.01
## ahe_4    -1.40 0.01
## ahe_5    -0.97 0.01
## ahe_6    -1.59 0.01
## ahe_7    -1.22 0.01
## ahe_8     1.76 0.01
## ahe_9     0.08 0.01
str(bpr_psicom)
## List of 5
##  $ scores    : Named num [1:3578] 0.111 0.148 0.296 0.148 0.37 ...
##   ..- attr(*, "names")= chr [1:3578] "Averages" NA NA NA ...
##  $ missing   : num [1:3578] 20 27 0 27 0 0 0 27 27 27 ...
##  $ item.stats:'data.frame':  27 obs. of  14 variables:
##   ..$ key     : num [1:27] 2 4 3 3 1 5 2 5 1 3 ...
##   ..$ 1       : num [1:27] 0.08 0.16 0.16 0.08 0.4 0.13 0.57 0.33 0.41 0.06 ...
##   ..$ 2       : num [1:27] 0.7 0.08 0.1 0.37 0.08 0.2 0.09 0.26 0.21 0.08 ...
##   ..$ 3       : num [1:27] 0.09 0.21 0.44 0.36 0.19 0.16 0.15 0.24 0.21 0.79 ...
##   ..$ 4       : num [1:27] 0.07 0.48 0.12 0.1 0.09 0.15 0.06 0.08 0.07 0.03 ...
##   ..$ 5       : num [1:27] 0.06 0.06 0.18 0.08 0.25 0.35 0.12 0.09 0.09 0.05 ...
##   ..$ miss    : num [1:27] 0.41 0.43 0.44 0.46 0.49 0.51 0.52 0.54 0.54 0.41 ...
##   ..$ r       : num [1:27] 0.07 0.62 0.59 0.54 0.53 0.44 0.18 0.17 0.44 0.12 ...
##   ..$ n       : num [1:27] 2098 2054 2020 1930 1833 ...
##   ..$ mean    : num [1:27] 0.7 0.48 0.44 0.36 0.4 0.35 0.09 0.09 0.41 0.79 ...
##   ..$ sd      : num [1:27] 0.46 0.5 0.5 0.48 0.49 0.48 0.29 0.29 0.49 0.41 ...
##   ..$ skew    : num [1:27] -0.86 0.08 0.25 0.6 0.4 0.62 2.77 2.86 0.36 -1.41 ...
##   ..$ kurtosis: num [1:27] -1.27 -1.99 -1.94 -1.64 -1.84 -1.62 5.68 6.16 -1.87 -0.01 ...
##   ..$ se      : num [1:27] 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 0.01 ...
##  $ alpha     : num 0.77
##  $ av.r      : num 0.11
##  - attr(*, "class")= chr [1:2] "psych" "mchoice"
head(bpr_psicom$scores)
##  Averages      <NA>      <NA>      <NA>      <NA>      <NA> 
## 0.1111111 0.1481481 0.2962963 0.1481481 0.3703704 0.4444444
bpr_df  <- score.multiple.choice(key, df1[ ,c(7:33)], score=FALSE)
head(bpr_df)
##      ahv_1 ahv_2 ahv_3 ahv_4 ahv_5 ahv_6 ahv_7 ahv_8 ahv_9 aha_1 aha_2
## [1,]    NA    NA    NA    NA    NA    NA    NA    NA    NA     0     0
## [2,]    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA
## [3,]     1     1     1     0     0     0     0     0     1     1     1
## [4,]    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA
## [5,]     1     0     1     1     1     0     1     0     1     1     1
## [6,]     1     0     0     1     0     0     1     1     0     1     1
##      aha_3 aha_4 aha_5 aha_6 aha_7 aha_8 aha_9 ahe_1 ahe_2 ahe_3 ahe_4
## [1,]     0     1     0     0    NA     0    NA    NA    NA    NA    NA
## [2,]    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA
## [3,]     0     0     1     0     1     0     0     0     0     0     0
## [4,]    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA    NA
## [5,]     1     0     1     0     0     0     0     0     0     0     0
## [6,]     1     0     1     0     1     0     0     1     0     0     0
##      ahe_5 ahe_6 ahe_7 ahe_8 ahe_9
## [1,]    NA    NA    NA    NA    NA
## [2,]    NA    NA    NA    NA    NA
## [3,]     0     0     0     0     0
## [4,]    NA    NA    NA    NA    NA
## [5,]     0     0     0     0     0
## [6,]     0     1     1     0     0
irt.responses(bpr_psicom$scores, df1[ ,c(7:33)],breaks=9)

TRI via análise fatorial

?irt.fa
bpr_irt <- irt.fa(bpr_df)
print.psych(bpr_irt, short=FALSE)
## Item Response Analysis using Factor Analysis 
## 
## Call: irt.fa(x = bpr_df)
## Item Response Analysis using Factor Analysis  
## 
##  Summary information by factor and item
##  Factor =  1 
##                -3   -2   -1    0    1    2     3
## ahv_1        0.07 0.14 0.20 0.19 0.13 0.07  0.03
## ahv_2        0.04 0.10 0.19 0.25 0.20 0.11  0.05
## ahv_3        0.04 0.09 0.16 0.21 0.18 0.11  0.05
## ahv_4        0.04 0.07 0.11 0.15 0.14 0.11  0.06
## ahv_5        0.04 0.05 0.06 0.07 0.07 0.06  0.04
## aha_1        0.11 0.30 0.44 0.29 0.11 0.03  0.01
## aha_2        0.02 0.11 0.47 0.81 0.33 0.06  0.01
## aha_3        0.01 0.05 0.16 0.37 0.43 0.22  0.07
## aha_4        0.04 0.06 0.08 0.09 0.09 0.07  0.05
## aha_5        0.04 0.05 0.07 0.09 0.08 0.07  0.05
## aha_6        0.04 0.06 0.10 0.12 0.12 0.09  0.06
## aha_7        0.03 0.11 0.33 0.53 0.32 0.10  0.03
## ahe_4        0.03 0.05 0.06 0.07 0.07 0.06  0.05
## ahe_5        0.03 0.05 0.06 0.08 0.08 0.07  0.05
## ahe_7        0.03 0.05 0.08 0.09 0.09 0.08  0.06
## Test Info    0.61 1.33 2.58 3.40 2.44 1.31  0.68
## SEM          1.28 0.87 0.62 0.54 0.64 0.87  1.22
## Reliability -0.64 0.25 0.61 0.71 0.59 0.24 -0.48
## 
## Item discrimination and location for factor  MR1 
##       discrimination location
## ahv_1           0.53    -0.58
## ahv_2           0.59     0.06
## ahv_3           0.54     0.18
## ahv_4           0.46     0.41
## ahv_5           0.31     0.26
## ahv_6           0.23     0.39
## ahv_7          -0.01     1.31
## ahv_8          -0.03     1.34
## ahv_9           0.09     0.22
## aha_1           0.78    -1.02
## aha_2           1.06    -0.14
## aha_3           0.79     0.67
## aha_4           0.35     0.38
## aha_5           0.35     0.43
## aha_6           0.41     0.46
## aha_7           0.85    -0.01
## aha_8           0.24     1.10
## aha_9           0.01     1.09
## ahe_1           0.29     0.04
## ahe_2           0.23     0.35
## ahe_3           0.12     0.90
## ahe_4           0.32     0.49
## ahe_5           0.33     0.63
## ahe_6           0.26     0.40
## ahe_7           0.36     0.57
## ahe_8           0.13     1.04
## ahe_9           0.10     0.82
## 
##  These parameters were based on the following factor analysis
## Factor Analysis using method =  minres
## Call: fa(r = r, nfactors = nfactors, n.obs = n.obs, rotate = rotate, 
##     fm = fm)
## Standardized loadings (pattern matrix) based upon correlation matrix
##         MR1      h2   u2 com
## ahv_1  0.47 2.2e-01 0.78   1
## ahv_2  0.51 2.6e-01 0.74   1
## ahv_3  0.47 2.2e-01 0.78   1
## ahv_4  0.42 1.7e-01 0.83   1
## ahv_5  0.30 8.9e-02 0.91   1
## ahv_6  0.22 5.0e-02 0.95   1
## ahv_7 -0.01 1.6e-04 1.00   1
## ahv_8 -0.03 9.7e-04 1.00   1
## ahv_9  0.09 8.9e-03 0.99   1
## aha_1  0.62 3.8e-01 0.62   1
## aha_2  0.73 5.3e-01 0.47   1
## aha_3  0.62 3.8e-01 0.62   1
## aha_4  0.33 1.1e-01 0.89   1
## aha_5  0.33 1.1e-01 0.89   1
## aha_6  0.38 1.5e-01 0.85   1
## aha_7  0.65 4.2e-01 0.58   1
## aha_8  0.23 5.3e-02 0.95   1
## aha_9  0.01 3.7e-05 1.00   1
## ahe_1  0.28 7.7e-02 0.92   1
## ahe_2  0.22 4.9e-02 0.95   1
## ahe_3  0.12 1.5e-02 0.98   1
## ahe_4  0.30 9.2e-02 0.91   1
## ahe_5  0.31 9.9e-02 0.90   1
## ahe_6  0.25 6.2e-02 0.94   1
## ahe_7  0.34 1.2e-01 0.88   1
## ahe_8  0.13 1.8e-02 0.98   1
## ahe_9  0.10 9.7e-03 0.99   1
## 
##                 MR1
## SS loadings    3.69
## Proportion Var 0.14
## 
## Mean item complexity =  1
## Test of the hypothesis that 1 factor is sufficient.
## 
## The degrees of freedom for the null model are  351  and the objective function was  4.63 with Chi Square of  16506.24
## The degrees of freedom for the model are 324  and the objective function was  2.08 
## 
## The root mean square of the residuals (RMSR) is  0.07 
## The df corrected root mean square of the residuals is  0.07 
## 
## The harmonic number of observations is  3578 with the empirical chi square  10699.12  with prob <  0 
## The total number of observations was  3578  with MLE Chi Square =  7402.08  with prob <  0 
## 
## Tucker Lewis Index of factoring reliability =  0.525
## RMSEA index =  0.078  and the 90 % confidence intervals are  NA NA
## BIC =  4750.93
## Fit based upon off diagonal values = 0.81
## Measures of factor score adequacy             
##                                                 MR1
## Correlation of scores with factors             0.92
## Multiple R square of scores with factors       0.84
## Minimum correlation of possible factor scores  0.69
plot(bpr_irt,type="IIC")

plot(bpr_irt,type="test")

plot(bpr_irt,type="ICC")

Correção e psicometria clássica com escalas likert e várias dimensões

# Separa dicionário do SENNA

        names(dic)
##  [1] "Bloco2"     "CodItem"    "Ord"        "VarLabel"   "Key0"      
##  [6] "Key1"       "Key2"       "b"          "senna54"    "senna84"   
## [11] "OrdSenna84" "domain"     "facet"      "pole"       "P_S"
        names(df1)[42:124]
##  [1] "ise_9"  "ise_10" "ise_11" "ise_12" "ise_13" "ise_14" "ise_15"
##  [8] "ise_16" "ise_17" "ise_18" "ise_19" "ise_20" "ise_21" "ise_22"
## [15] "ise_23" "ise_24" "ise_25" "ise_26" "ise_27" "ise_28" "ise_29"
## [22] "ise_30" "ise_31" "ise_32" "ise_33" "ise_34" "ise_35" "ise_36"
## [29] "ise_37" "ise_38" "ise_39" "ise_40" "ise_41" "ise_42" "ise_43"
## [36] "ise_44" "ise_45" "ise_46" "ise_47" "ise_48" "ise_49" "ise_50"
## [43] "ise_51" "ise_52" "ise_53" "ise_54" "ise_55" "ise_56" "ise_57"
## [50] "ise_58" "ise_59" "ise_60" "ise_61" "ise_62" "ise_63" "ise_64"
## [57] "ise_65" "ise_66" "ise_67" "ise_68" "ise_69" "ise_70" "ise_71"
## [64] "ise_72" "ise_73" "ise_74" "ise_75" "ise_76" "ise_77" "ise_78"
## [71] "ise_79" "ise_80" "ise_81" "ise_82" "ise_83" "ise_84" "ise_85"
## [78] "ise_86" "ise_87" "ise_88" "ise_89" "ise_90" "ise_91"
        dic_senna <- dic[dic$Bloco2=="SENNA" & dic$senna84==1, c(2, 4, 11:15) ]

# Cria ordem dos itens na base + sentido (+ e -)
        dic_senna$Ord2 <- dic_senna$OrdSenna84*ifelse(dic_senna$pole == 0 , -1, 1)
        
# Cria label
        names(dic_senna)
## [1] "CodItem"    "VarLabel"   "OrdSenna84" "domain"     "facet"     
## [6] "pole"       "P_S"        "Ord2"
        dic_senna$VarLabel2 <-paste("i", dic_senna$domain,
                                    dic_senna$P_S, 
                                    dic_senna$pole, 
                                    dic_senna$VarLabel, sep="_")
# Cria key usando Psych
        library(psych)
        senna83.key1 <-make.keys(nvars=83, 
                                 list(F1.Cons=dic_senna[dic_senna$domain =="C" , ]$Ord2,
                                      F2.Extr=dic_senna[dic_senna$domain =="E" , ]$Ord2,
                                      F3.Neur=dic_senna[dic_senna$domain =="N" , ]$Ord2,
                                      F4.Agre=dic_senna[dic_senna$domain =="A" , ]$Ord2,
                                      F5.Opns=dic_senna[dic_senna$domain =="O", ]$Ord2,
                                      F6.ELoc=dic_senna[dic_senna$domain =="NV" , ]$Ord2),
                                 item.labels=dic_senna[ dic_senna$Bloco2=="SENNA", ]$VarLabel2)
# Que priduz essa matriz
        senna83.key1
##       F1.Cons F2.Extr F3.Neur F4.Agre F5.Opns F6.ELoc
##  [1,]       1       0       0       0       0       0
##  [2,]       0       1       0       0       0       0
##  [3,]       0       0       1       0       0       0
##  [4,]       1       0       0       0       0       0
##  [5,]       0       1       0       0       0       0
##  [6,]       0       0       1       0       0       0
##  [7,]       1       0       0       0       0       0
##  [8,]       0       1       0       0       0       0
##  [9,]       0       0       1       0       0       0
## [10,]       1       0       0       0       0       0
## [11,]       0       1       0       0       0       0
## [12,]       0       0       1       0       0       0
## [13,]       1       0       0       0       0       0
## [14,]       0       1       0       0       0       0
## [15,]       1       0       0       0       0       0
## [16,]       0       1       0       0       0       0
## [17,]       1       0       0       0       0       0
## [18,]       0       0      -1       0       0       0
## [19,]       0       0       0       1       0       0
## [20,]       0       0       0       0       1       0
## [21,]       1       0       0       0       0       0
## [22,]       0       0      -1       0       0       0
## [23,]       0       0       0       0       0       1
## [24,]       0       0       0       1       0       0
## [25,]       0       0       0       0       1       0
## [26,]       1       0       0       0       0       0
## [27,]       0       0      -1       0       0       0
## [28,]       0       0       0       0       0       1
## [29,]       0       0       0       1       0       0
## [30,]      -1       0       0       0       0       0
## [31,]       0       0      -1       0       0       0
## [32,]       0       0      -1       0       0       0
## [33,]       0       0       0       1       0       0
## [34,]       0       0       0       0       1       0
## [35,]       1       0       0       0       0       0
## [36,]       0       0       0       1       0       0
## [37,]       0       0       0       0       1       0
## [38,]       0       0       0       1       0       0
## [39,]       1       0       0       0       0       0
## [40,]       0       0      -1       0       0       0
## [41,]       0       0      -1       0       0       0
## [42,]       0       0       0       1       0       0
## [43,]       0       0       0       0       1       0
## [44,]      -1       0       0       0       0       0
## [45,]       0       0      -1       0       0       0
## [46,]       0       0       0       0       0       1
## [47,]       0       0       0       1       0       0
## [48,]       1       0       0       0       0       0
## [49,]      -1       0       0       0       0       0
## [50,]       0       0      -1       0       0       0
## [51,]       0       0       0       1       0       0
## [52,]       0       0       0       0       1       0
## [53,]      -1       0       0       0       0       0
## [54,]       0       0      -1       0       0       0
## [55,]       0       0       0      -1       0       0
## [56,]       0       0       0       0       1       0
## [57,]      -1       0       0       0       0       0
## [58,]       0       0      -1       0       0       0
## [59,]       0       0       0       0       0       1
## [60,]       0       0       0       1       0       0
## [61,]      -1       0       0       0       0       0
## [62,]       0       0       0       0       0       1
## [63,]       0       0       0      -1       0       0
## [64,]       0       0       0       0       1       0
## [65,]       0       1       0       0       0       0
## [66,]       0       0       0       0       0       1
## [67,]       0       0       0       1       0       0
## [68,]       0       0       0       0       1       0
## [69,]       0      -1       0       0       0       0
## [70,]       0       0       0       0       0       1
## [71,]       0       0       0       0       1       0
## [72,]       0       1       0       0       0       0
## [73,]       0       0       0       0       0       1
## [74,]       0       0       0       0       1       0
## [75,]       0      -1       0       0       0       0
## [76,]       0       0       0       0       0       1
## [77,]       0       0       0       0       1       0
## [78,]       0       1       0       0       0       0
## [79,]       0       0       0       0       1       0
## [80,]       0      -1       0       0       0       0
## [81,]       0       0       0       0       0      -1
## [82,]       0       1       0       0       0       0
## [83,]       0       1       0       0       0       0
# Executa análise        
        psicom_senna <-scoreItems(senna83.key1,                   # a chave
                                  df1[, 42:124],                  # a base de dados
                                  missing=TRUE, imput="none")     # Em caso de missing calcula média nos itens respondidos

# Examina estrutura do arquivo        
        str(psicom_senna)
## List of 17
##  $ scores        : num [1:3578, 1:6] 1.93 NaN 3.82 NaN NaN ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ missing       : num [1:3578, 1:6] 4 18 1 18 18 18 5 18 18 18 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ alpha         : num [1, 1:6] 0.742 0.526 0.613 0.695 0.848 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr "alpha"
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ av.r          : num [1, 1:6] 0.1375 0.0733 0.0956 0.1494 0.2997 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr "average.r"
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ sn            : num [1, 1:6] 2.87 1.11 1.59 2.28 5.56 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr "Signal/Noise"
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ n.items       : Named num [1:6] 18 14 15 13 13 10
##   ..- attr(*, "names")= chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ item.cor      : num [1:83, 1:6] 0.542 0.295 0.2 0.481 0.212 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr [1:83] "ise_9" "ise_10" "ise_11" "ise_12" ...
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ cor           : num [1:6, 1:6] 1 0.336 0.161 0.54 0.403 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ corrected     : num [1:6, 1:6] 0.742 0.336 0.161 0.54 0.403 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ G6            : num [1, 1:6] 0.814 0.662 0.715 0.774 0.865 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr "Lambda.6"
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ item.corrected: num [1:83, 1:6] 0.511 0.327 0.221 0.435 0.235 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr [1:83] "ise_9" "ise_10" "ise_11" "ise_12" ...
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ response.freq : num [1:83, 1:6] 0.0799 0.0808 0.2209 0.1208 0.1514 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr [1:83] "ise_9" "ise_10" "ise_11" "ise_12" ...
##   .. ..$ : chr [1:6] "1" "2" "3" "4" ...
##  $ raw           : logi FALSE
##  $ alpha.ob      : num [1, 1:6] 0.694 0.46 0.557 0.642 0.81 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : chr "alpha.observed"
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ num.ob.item   : Named num [1:6] 14.19 10.75 11.89 10.22 9.98 ...
##   ..- attr(*, "names")= chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ ase           : num [1, 1:6] 0.00746 0.01271 0.0107 0.0091 0.00559 ...
##   ..- attr(*, "dimnames")=List of 2
##   .. ..$ : NULL
##   .. ..$ : chr [1:6] "F1.Cons" "F2.Extr" "F3.Neur" "F4.Agre" ...
##  $ Call          : language scoreItems(keys = senna83.key1, items = df1[, 42:124], missing = TRUE,      impute = "none")
##  - attr(*, "class")= chr [1:2] "psych" "score.items"
# Imprime resultados        
        print.psych(psicom_senna, short=FALSE, sort=TRUE, cut=.20)   
## Call: scoreItems(keys = senna83.key1, items = df1[, 42:124], missing = TRUE, 
##     impute = "none")
## 
## (Standardized) Alpha:
##       F1.Cons F2.Extr F3.Neur F4.Agre F5.Opns F6.ELoc
## alpha    0.74    0.53    0.61     0.7    0.85    0.59
## 
## Standard errors of unstandardized Alpha:
##       F1.Cons F2.Extr F3.Neur F4.Agre F5.Opns F6.ELoc
## ASE    0.0075   0.013   0.011  0.0091  0.0056   0.012
## 
## Standardized Alpha of observed scales:
##                F1.Cons F2.Extr F3.Neur F4.Agre F5.Opns F6.ELoc
## alpha.observed    0.69    0.46    0.56    0.64    0.81    0.53
## 
## Average item correlation:
##           F1.Cons F2.Extr F3.Neur F4.Agre F5.Opns F6.ELoc
## average.r    0.14   0.073   0.096    0.15     0.3    0.13
## 
##  Guttman 6* reliability: 
##          F1.Cons F2.Extr F3.Neur F4.Agre F5.Opns F6.ELoc
## Lambda.6    0.81    0.66    0.72    0.77    0.87    0.69
## 
## Signal/Noise based upon av.r : 
##              F1.Cons F2.Extr F3.Neur F4.Agre F5.Opns F6.ELoc
## Signal/Noise     2.9     1.1     1.6     2.3     5.6     1.4
## 
## Scale intercorrelations corrected for attenuation 
##  raw correlations below the diagonal, alpha on the diagonal 
##  corrected correlations above the diagonal:
## 
## Note that these are the correlations of the complete scales based on the correlation matrix,
##  not the observed scales based on the raw items.
##         F1.Cons F2.Extr F3.Neur F4.Agre F5.Opns F6.ELoc
## F1.Cons   0.742    0.54    0.24    0.75    0.51   -0.10
## F2.Extr   0.336    0.53   -0.39    0.81    0.81    0.64
## F3.Neur   0.161   -0.22    0.61   -0.36   -0.54   -0.95
## F4.Agre   0.540    0.49   -0.24    0.70    0.90    0.58
## F5.Opns   0.403    0.54   -0.39    0.69    0.85    0.79
## F6.ELoc  -0.066    0.36   -0.57    0.37    0.56    0.59
## 
## Item by scale correlations:
##  corrected for item overlap and scale reliability
##        F1.Cons F2.Extr F3.Neur F4.Agre F5.Opns F6.ELoc
## ise_9     0.51    0.34   -0.02    0.45    0.34    0.17
## ise_10    0.33    0.48   -0.11    0.41    0.37    0.22
## ise_11    0.22    0.17   -0.04    0.24    0.23    0.19
## ise_12    0.44    0.31   -0.07    0.36    0.33    0.17
## ise_13    0.23    0.46   -0.15    0.31    0.34    0.26
## ise_14    0.29    0.31   -0.04    0.35    0.30    0.22
## ise_15    0.56    0.36    0.01    0.48    0.37    0.16
## ise_16    0.37    0.51   -0.09    0.48    0.41    0.24
## ise_17    0.28    0.37   -0.03    0.35    0.32    0.21
## ise_18    0.50    0.40   -0.07    0.43    0.37    0.17
## ise_19   -0.12    0.21   -0.21    0.05    0.12    0.31
## ise_20    0.22    0.34   -0.07    0.23    0.22    0.19
## ise_21    0.53    0.41   -0.03    0.45    0.40    0.18
## ise_22    0.24    0.46   -0.18    0.35    0.29    0.28
## ise_23    0.49    0.32   -0.08    0.44    0.39    0.21
## ise_24    0.18    0.40   -0.17    0.26    0.26    0.25
## ise_25    0.64    0.46   -0.11    0.58    0.49    0.16
## ise_26   -0.10    0.27   -0.45    0.13    0.18    0.34
## ise_27    0.48    0.46   -0.16    0.56    0.47    0.21
## ise_28    0.38    0.44   -0.21    0.47    0.49    0.32
## ise_29    0.53    0.34   -0.16    0.53    0.47    0.25
## ise_30   -0.05    0.23   -0.53    0.14    0.21    0.40
## ise_31   -0.14    0.20   -0.46    0.10    0.18    0.41
## ise_32    0.40    0.39   -0.18    0.57    0.48    0.31
## ise_33    0.44    0.40   -0.20    0.52    0.55    0.31
## ise_34    0.55    0.42   -0.19    0.59    0.51    0.30
## ise_35   -0.04    0.26   -0.53    0.20    0.28    0.48
## ise_36   -0.14    0.09   -0.36    0.08    0.11    0.35
## ise_37    0.33    0.33   -0.17    0.54    0.42    0.26
## ise_38   -0.09    0.21   -0.46    0.20    0.23    0.46
## ise_39   -0.07    0.23   -0.60    0.20    0.27    0.47
## ise_40   -0.04    0.29   -0.50    0.20    0.30    0.49
## ise_41    0.49    0.43   -0.19    0.62    0.52    0.27
## ise_42    0.21    0.35   -0.31    0.38    0.45    0.36
## ise_43    0.44    0.34   -0.22    0.48    0.47    0.27
## ise_44   -0.06    0.18   -0.52    0.18    0.21    0.40
## ise_45    0.24    0.33   -0.35    0.44    0.48    0.40
## ise_46    0.16    0.21   -0.28    0.37    0.32    0.34
## ise_47    0.49    0.36   -0.15    0.60    0.47    0.20
## ise_48   -0.08    0.16   -0.54    0.20    0.26    0.45
## ise_49    0.38    0.45   -0.24    0.56    0.54    0.32
## ise_50    0.40    0.44   -0.22    0.64    0.57    0.36
## ise_51    0.28    0.43   -0.26    0.52    0.56    0.37
## ise_52   -0.28    0.14   -0.46    0.07    0.17    0.48
## ise_53   -0.18    0.23   -0.59    0.14    0.28    0.53
## ise_54    0.12    0.35   -0.36    0.39    0.43    0.45
## ise_55    0.15    0.30   -0.24    0.41    0.41    0.42
## ise_56    0.04    0.28   -0.42    0.32    0.44    0.50
## ise_57   -0.14    0.21   -0.50    0.25    0.33    0.53
## ise_58    0.29    0.24   -0.18    0.51    0.50    0.33
## ise_59    0.36    0.44   -0.24    0.62    0.58    0.37
## ise_60    0.28    0.37   -0.24    0.49    0.56    0.38
## ise_61   -0.31    0.13   -0.46    0.04    0.24    0.51
## ise_62   -0.19    0.12   -0.50    0.12    0.28    0.52
## ise_63   -0.24    0.12   -0.45    0.02    0.21    0.49
## ise_64    0.33    0.44   -0.24    0.57    0.56    0.37
## ise_65   -0.27    0.14   -0.49    0.12    0.27    0.57
## ise_66    0.04    0.28   -0.48    0.36    0.45    0.50
## ise_67   -0.15    0.27   -0.51    0.21    0.36    0.58
## ise_68    0.24    0.43   -0.26    0.49    0.52    0.41
## ise_69   -0.31    0.10   -0.41    0.02    0.21    0.53
## ise_70   -0.23    0.16   -0.49    0.11    0.27    0.58
## ise_71   -0.17    0.24   -0.52    0.14    0.32    0.53
## ise_72    0.27    0.45   -0.32    0.51    0.62    0.48
## ise_73    0.37    0.52   -0.21    0.56    0.61    0.38
## ise_74    0.11    0.35   -0.34    0.41    0.49    0.53
## ise_75    0.31    0.50   -0.27    0.57    0.60    0.44
## ise_76    0.24    0.43   -0.30    0.50    0.67    0.51
## ise_77    0.22    0.23   -0.22    0.49    0.49    0.41
## ise_78    0.28    0.43   -0.14    0.53    0.56    0.38
## ise_79    0.22    0.27   -0.23    0.42    0.53    0.41
## ise_80    0.32    0.50   -0.19    0.50    0.62    0.39
## ise_81   -0.04    0.25   -0.39    0.29    0.45    0.54
## ise_82    0.15    0.39   -0.37    0.39    0.56    0.48
## ise_83    0.23    0.23   -0.24    0.42    0.53    0.45
## ise_84   -0.03    0.22   -0.39    0.26    0.45    0.51
## ise_85    0.17    0.40   -0.28    0.40    0.59    0.45
## ise_86    0.16    0.46   -0.29    0.39    0.51    0.45
## ise_87    0.26    0.47   -0.26    0.45    0.57    0.38
## ise_88   -0.04    0.13   -0.39    0.25    0.39    0.50
## ise_89    0.09    0.25   -0.33    0.34    0.45    0.47
## ise_90    0.28    0.53   -0.29    0.54    0.59    0.41
## ise_91    0.06    0.38   -0.36    0.32    0.44    0.47
## 
## Non missing response frequency for each item
##           1    2    3    4    5 miss
## ise_9  0.08 0.07 0.20 0.23 0.42 0.48
## ise_10 0.08 0.12 0.17 0.27 0.36 0.48
## ise_11 0.22 0.19 0.25 0.16 0.18 0.49
## ise_12 0.12 0.12 0.24 0.25 0.26 0.49
## ise_13 0.15 0.13 0.17 0.23 0.32 0.49
## ise_14 0.15 0.13 0.19 0.23 0.29 0.49
## ise_15 0.08 0.07 0.20 0.28 0.37 0.48
## ise_16 0.10 0.13 0.20 0.23 0.34 0.50
## ise_17 0.17 0.15 0.21 0.22 0.26 0.50
## ise_18 0.10 0.08 0.15 0.22 0.44 0.49
## ise_19 0.55 0.10 0.12 0.11 0.13 0.50
## ise_20 0.27 0.15 0.15 0.16 0.26 0.50
## ise_21 0.08 0.08 0.21 0.25 0.38 0.51
## ise_22 0.21 0.13 0.20 0.19 0.27 0.51
## ise_23 0.10 0.12 0.20 0.22 0.35 0.51
## ise_24 0.24 0.11 0.16 0.17 0.32 0.49
## ise_25 0.13 0.08 0.17 0.21 0.41 0.49
## ise_26 0.30 0.18 0.21 0.13 0.18 0.50
## ise_27 0.08 0.12 0.22 0.23 0.35 0.50
## ise_28 0.12 0.13 0.24 0.23 0.28 0.51
## ise_29 0.10 0.11 0.21 0.23 0.36 0.51
## ise_30 0.28 0.16 0.21 0.13 0.22 0.50
## ise_31 0.34 0.17 0.18 0.13 0.18 0.51
## ise_32 0.11 0.13 0.24 0.21 0.31 0.50
## ise_33 0.10 0.11 0.20 0.23 0.36 0.51
## ise_34 0.09 0.13 0.22 0.23 0.34 0.51
## ise_35 0.27 0.16 0.21 0.15 0.21 0.50
## ise_36 0.42 0.13 0.17 0.11 0.17 0.50
## ise_37 0.13 0.14 0.21 0.19 0.33 0.50
## ise_38 0.27 0.15 0.25 0.14 0.19 0.50
## ise_39 0.29 0.16 0.21 0.13 0.20 0.51
## ise_40 0.28 0.16 0.19 0.14 0.23 0.52
## ise_41 0.12 0.12 0.21 0.21 0.34 0.52
## ise_42 0.20 0.14 0.23 0.18 0.25 0.52
## ise_43 0.12 0.12 0.26 0.22 0.29 0.53
## ise_44 0.28 0.15 0.22 0.15 0.21 0.53
## ise_45 0.16 0.16 0.24 0.19 0.25 0.53
## ise_46 0.25 0.12 0.22 0.16 0.26 0.53
## ise_47 0.10 0.10 0.20 0.22 0.39 0.52
## ise_48 0.30 0.13 0.18 0.13 0.25 0.51
## ise_49 0.20 0.12 0.17 0.17 0.34 0.53
## ise_50 0.11 0.15 0.21 0.23 0.30 0.54
## ise_51 0.13 0.12 0.23 0.21 0.31 0.55
## ise_52 0.32 0.18 0.21 0.13 0.16 0.55
## ise_53 0.27 0.16 0.22 0.14 0.21 0.55
## ise_54 0.18 0.17 0.22 0.18 0.25 0.54
## ise_55 0.17 0.19 0.29 0.16 0.19 0.55
## ise_56 0.20 0.17 0.28 0.15 0.21 0.56
## ise_57 0.24 0.19 0.23 0.14 0.19 0.56
## ise_58 0.16 0.17 0.23 0.18 0.25 0.55
## ise_59 0.12 0.13 0.19 0.24 0.32 0.56
## ise_60 0.13 0.12 0.18 0.21 0.36 0.57
## ise_61 0.28 0.18 0.22 0.13 0.19 0.57
## ise_62 0.27 0.19 0.22 0.15 0.17 0.56
## ise_63 0.38 0.15 0.18 0.13 0.16 0.55
## ise_64 0.11 0.12 0.15 0.20 0.42 0.56
## ise_65 0.30 0.14 0.23 0.15 0.18 0.56
## ise_66 0.17 0.16 0.25 0.17 0.24 0.56
## ise_67 0.24 0.16 0.22 0.16 0.22 0.57
## ise_68 0.15 0.11 0.20 0.21 0.34 0.57
## ise_69 0.34 0.17 0.20 0.13 0.17 0.57
## ise_70 0.29 0.17 0.23 0.13 0.18 0.55
## ise_71 0.30 0.18 0.20 0.15 0.18 0.57
## ise_72 0.13 0.13 0.22 0.22 0.31 0.56
## ise_73 0.10 0.10 0.17 0.21 0.42 0.57
## ise_74 0.15 0.14 0.25 0.21 0.26 0.55
## ise_75 0.11 0.12 0.19 0.23 0.35 0.56
## ise_76 0.13 0.13 0.21 0.19 0.34 0.57
## ise_77 0.14 0.13 0.24 0.20 0.29 0.57
## ise_78 0.12 0.11 0.22 0.22 0.34 0.57
## ise_79 0.18 0.13 0.21 0.19 0.29 0.57
## ise_80 0.11 0.11 0.18 0.21 0.39 0.58
## ise_81 0.19 0.14 0.26 0.18 0.22 0.58
## ise_82 0.14 0.14 0.24 0.22 0.26 0.58
## ise_83 0.15 0.16 0.22 0.19 0.28 0.58
## ise_84 0.21 0.17 0.24 0.16 0.23 0.57
## ise_85 0.14 0.14 0.20 0.20 0.32 0.57
## ise_86 0.11 0.12 0.19 0.21 0.36 0.58
## ise_87 0.11 0.11 0.18 0.19 0.41 0.58
## ise_88 0.25 0.14 0.22 0.17 0.22 0.58
## ise_89 0.20 0.14 0.24 0.16 0.27 0.58
## ise_90 0.10 0.10 0.19 0.23 0.38 0.58
## ise_91 0.17 0.11 0.23 0.18 0.31 0.56
# Plota distribuiçòes dos escores 
        multi.hist(psicom_senna$scores)