Author

Margaret Gatongi

Code
library(tidyverse)
library(corrr)
library(psych)
library(haven)
library(dplyr)

Generate a Reliability Coefficient for a Set of Items

##Using the SPSS Anxiety Questionnaire, from Field, Chapter 17

###23 questions

###Likert scale 1 - 5: Strongly Disagree (SD) to Strongly Agree (SA)

Code
saq <- read_dta("saq.dta")
Code
view(saq)
Code
glimpse(saq)
Rows: 2,571
Columns: 23
$ Q01 <dbl+lbl> 2, 1, 2, 3, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 3, 1, 2, 2, 2, 1,…
$ Q02 <dbl+lbl> 1, 1, 3, 1, 1, 1, 3, 2, 3, 4, 1, 1, 1, 2, 2, 1, 2, 2, 3, 1, 2,…
$ Q03 <dbl+lbl> 4, 4, 2, 1, 3, 3, 3, 3, 1, 4, 5, 3, 3, 1, 3, 2, 5, 3, 4, 1, 3,…
$ Q04 <dbl+lbl> 2, 3, 2, 4, 2, 2, 2, 2, 4, 3, 2, 3, 4, 2, 4, 2, 2, 3, 2, 2, 2,…
$ Q05 <dbl+lbl> 2, 2, 4, 3, 2, 4, 2, 2, 5, 2, 2, 4, 3, 2, 2, 2, 1, 3, 3, 3, 4,…
$ Q06 <dbl+lbl> 2, 2, 1, 3, 3, 4, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 1, 4, 1, 4, 1,…
$ Q07 <dbl+lbl> 3, 2, 2, 4, 3, 4, 2, 2, 5, 2, 2, 3, 3, 3, 3, 2, 1, 3, 1, 4, 2,…
$ Q08 <dbl+lbl> 1, 2, 2, 2, 2, 2, 2, 2, 5, 2, 2, 1, 3, 2, 2, 2, 1, 2, 1, 1, 1,…
$ Q09 <dbl+lbl> 1, 5, 2, 2, 4, 4, 3, 4, 3, 3, 5, 3, 2, 2, 2, 2, 4, 5, 5, 5, 1,…
$ Q10 <dbl+lbl> 2, 2, 2, 4, 2, 3, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 1, 2, 2, 1, 1,…
$ Q11 <dbl+lbl> 1, 2, 3, 2, 2, 2, 2, 2, 5, 2, 1, 2, 3, 2, 2, 2, 1, 3, 1, 2, 1,…
$ Q12 <dbl+lbl> 2, 3, 3, 2, 3, 4, 2, 3, 5, 3, 3, 3, 4, 4, 3, 3, 2, 3, 3, 5, 4,…
$ Q13 <dbl+lbl> 2, 1, 2, 2, 3, 3, 2, 2, 5, 2, 1, 2, 4, 2, 2, 2, 1, 3, 1, 2, 1,…
$ Q14 <dbl+lbl> 2, 3, 4, 3, 2, 3, 2, 2, 5, 1, 2, 2, 4, 4, 3, 3, 1, 3, 2, 5, 1,…
$ Q15 <dbl+lbl> 2, 4, 2, 3, 2, 5, 2, 3, 5, 2, 1, 3, 4, 4, 3, 2, 1, 4, 2, 5, 1,…
$ Q16 <dbl+lbl> 3, 3, 3, 3, 2, 2, 2, 2, 5, 3, 2, 3, 4, 4, 4, 3, 2, 3, 3, 5, 2,…
$ Q17 <dbl+lbl> 1, 2, 2, 2, 2, 3, 2, 2, 5, 2, 2, 2, 3, 2, 2, 2, 2, 2, 1, 2, 1,…
$ Q18 <dbl+lbl> 2, 2, 3, 4, 3, 5, 2, 2, 5, 2, 2, 2, 3, 4, 3, 3, 1, 2, 1, 5, 1,…
$ Q19 <dbl+lbl> 3, 3, 1, 2, 3, 1, 3, 4, 2, 3, 5, 3, 2, 1, 3, 2, 4, 2, 4, 1, 2,…
$ Q20 <dbl+lbl> 2, 4, 4, 4, 4, 5, 2, 3, 5, 3, 3, 4, 4, 5, 4, 3, 2, 3, 2, 5, 4,…
$ Q21 <dbl+lbl> 2, 4, 3, 4, 2, 3, 2, 2, 5, 2, 2, 3, 4, 5, 4, 2, 1, 3, 2, 5, 3,…
$ Q22 <dbl+lbl> 2, 4, 2, 4, 4, 1, 4, 4, 3, 4, 5, 4, 3, 3, 4, 3, 4, 3, 4, 5, 2,…
$ Q23 <dbl+lbl> 5, 2, 2, 3, 4, 4, 4, 4, 3, 4, 5, 4, 4, 1, 4, 4, 4, 4, 4, 5, 5,…
Code
str(saq)
tibble [2,571 × 23] (S3: tbl_df/tbl/data.frame)
 $ Q01: dbl+lbl [1:2571] 2, 1, 2, 3, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 3, 1, 2,...
   ..@ label       : chr "Statistics makes me cry"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:6] 1 2 3 4 5 9
   .. ..- attr(*, "names")= chr [1:6] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q02: dbl+lbl [1:2571] 1, 1, 3, 1, 1, 1, 3, 2, 3, 4, 1, 1, 1, 2, 2, 1, 2, 2,...
   ..@ label       : chr "My friends will think I'm stupid for not being able to cope with SPSS"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q03: dbl+lbl [1:2571] 4, 4, 2, 1, 3, 3, 3, 3, 1, 4, 5, 3, 3, 1, 3, 2, 5, 3,...
   ..@ label       : chr "Standard deviations excite me"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q04: dbl+lbl [1:2571] 2, 3, 2, 4, 2, 2, 2, 2, 4, 3, 2, 3, 4, 2, 4, 2, 2, 3,...
   ..@ label       : chr "I dream that Pearson is attacking me with correlation coefficients"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:6] 1 2 3 4 5 9
   .. ..- attr(*, "names")= chr [1:6] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q05: dbl+lbl [1:2571] 2, 2, 4, 3, 2, 4, 2, 2, 5, 2, 2, 4, 3, 2, 2, 2, 1, 3,...
   ..@ label       : chr "I don't understand statistics"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q06: dbl+lbl [1:2571] 2, 2, 1, 3, 3, 4, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 1, 4,...
   ..@ label       : chr "I have little experience of computers"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q07: dbl+lbl [1:2571] 3, 2, 2, 4, 3, 4, 2, 2, 5, 2, 2, 3, 3, 3, 3, 2, 1, 3,...
   ..@ label       : chr "All computers hate me"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q08: dbl+lbl [1:2571] 1, 2, 2, 2, 2, 2, 2, 2, 5, 2, 2, 1, 3, 2, 2, 2, 1, 2,...
   ..@ label       : chr "I have never been good at mathematics"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q09: dbl+lbl [1:2571] 1, 5, 2, 2, 4, 4, 3, 4, 3, 3, 5, 3, 2, 2, 2, 2, 4, 5,...
   ..@ label       : chr "My friends are better at statistics than me"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q10: dbl+lbl [1:2571] 2, 2, 2, 4, 2, 3, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 1, 2,...
   ..@ label       : chr "Computers are useful only for playing games"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q11: dbl+lbl [1:2571] 1, 2, 3, 2, 2, 2, 2, 2, 5, 2, 1, 2, 3, 2, 2, 2, 1, 3,...
   ..@ label       : chr "I did badly at mathematics at school"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q12: dbl+lbl [1:2571] 2, 3, 3, 2, 3, 4, 2, 3, 5, 3, 3, 3, 4, 4, 3, 3, 2, 3,...
   ..@ label       : chr "People try to tell you that SPSS makes statistics easier to understand but it do"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q13: dbl+lbl [1:2571] 2, 1, 2, 2, 3, 3, 2, 2, 5, 2, 1, 2, 4, 2, 2, 2, 1, 3,...
   ..@ label       : chr "I worry that I will cause irreparable damage because of my incompetence with com"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q14: dbl+lbl [1:2571] 2, 3, 4, 3, 2, 3, 2, 2, 5, 1, 2, 2, 4, 4, 3, 3, 1, 3,...
   ..@ label       : chr "Computers have minds of their own and deliberately go wrong whenever I use them"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q15: dbl+lbl [1:2571] 2, 4, 2, 3, 2, 5, 2, 3, 5, 2, 1, 3, 4, 4, 3, 2, 1, 4,...
   ..@ label       : chr "Computers are out to get me"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q16: dbl+lbl [1:2571] 3, 3, 3, 3, 2, 2, 2, 2, 5, 3, 2, 3, 4, 4, 4, 3, 2, 3,...
   ..@ label       : chr "I weep openly at the mention of central tendency"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:6] 1 2 3 4 5 9
   .. ..- attr(*, "names")= chr [1:6] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q17: dbl+lbl [1:2571] 1, 2, 2, 2, 2, 3, 2, 2, 5, 2, 2, 2, 3, 2, 2, 2, 2, 2,...
   ..@ label       : chr "I slip into a coma whenever I see an equation"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q18: dbl+lbl [1:2571] 2, 2, 3, 4, 3, 5, 2, 2, 5, 2, 2, 2, 3, 4, 3, 3, 1, 2,...
   ..@ label       : chr "SPSS always crashes when I try to use it"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q19: dbl+lbl [1:2571] 3, 3, 1, 2, 3, 1, 3, 4, 2, 3, 5, 3, 2, 1, 3, 2, 4, 2,...
   ..@ label       : chr "Everybody looks at me when I use SPSS"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q20: dbl+lbl [1:2571] 2, 4, 4, 4, 4, 5, 2, 3, 5, 3, 3, 4, 4, 5, 4, 3, 2, 3,...
   ..@ label       : chr "I can't sleep for thoughts of eigenvectors"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q21: dbl+lbl [1:2571] 2, 4, 3, 4, 2, 3, 2, 2, 5, 2, 2, 3, 4, 5, 4, 2, 1, 3,...
   ..@ label       : chr "I wake up under my duvet thinking that I am trapped under a normal distribution"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q22: dbl+lbl [1:2571] 2, 4, 2, 4, 4, 1, 4, 4, 3, 4, 5, 4, 3, 3, 4, 3, 4, 3,...
   ..@ label       : chr "My friends are better at SPSS than I am"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:6] 1 2 3 4 5 9
   .. ..- attr(*, "names")= chr [1:6] "Strongly agree" "Agree" "Neither" "Disagree" ...
 $ Q23: dbl+lbl [1:2571] 5, 2, 2, 3, 4, 4, 4, 4, 3, 4, 5, 4, 4, 1, 4, 4, 4, 4,...
   ..@ label       : chr "If I'm good at statistics my friends will think I'm a nerd"
   ..@ format.stata: chr "%12.0g"
   ..@ labels      : Named num [1:5] 1 2 3 4 5
   .. ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...
Code
describe(saq)
    vars    n mean   sd median trimmed  mad min max range  skew kurtosis   se
Q01    1 2571 2.37 0.83      2    2.34 0.00   1   5     4  0.65     0.61 0.02
Q02    2 2571 1.62 0.85      1    1.46 0.00   1   5     4  1.49     2.04 0.02
Q03    3 2571 2.59 1.08      3    2.57 1.48   1   5     4  0.09    -0.78 0.02
Q04    4 2571 2.79 0.95      3    2.74 1.48   1   5     4  0.39    -0.29 0.02
Q05    5 2571 2.72 0.96      3    2.68 1.48   1   5     4  0.46    -0.44 0.02
Q06    6 2571 2.23 1.12      2    2.09 1.48   1   5     4  0.93     0.15 0.02
Q07    7 2571 2.92 1.10      3    2.89 1.48   1   5     4  0.20    -0.85 0.02
Q08    8 2571 2.24 0.87      2    2.15 0.00   1   5     4  1.05     1.48 0.02
Q09    9 2571 2.85 1.26      3    2.83 1.48   1   5     4 -0.06    -1.15 0.02
Q10   10 2571 2.28 0.88      2    2.21 0.00   1   5     4  0.83     0.59 0.02
Q11   11 2571 2.26 0.88      2    2.18 0.00   1   5     4  0.84     0.90 0.02
Q12   12 2571 3.16 0.92      3    3.12 1.48   1   5     4  0.18    -0.21 0.02
Q13   13 2571 2.45 0.95      2    2.40 1.48   1   5     4  0.61     0.04 0.02
Q14   14 2571 2.88 1.00      3    2.84 1.48   1   5     4  0.29    -0.36 0.02
Q15   15 2571 2.77 1.01      3    2.72 1.48   1   5     4  0.43    -0.45 0.02
Q16   16 2571 2.88 0.92      3    2.82 1.48   1   5     4  0.40    -0.13 0.02
Q17   17 2571 2.47 0.88      2    2.40 0.00   1   5     4  0.76     0.49 0.02
Q18   18 2571 2.57 1.05      2    2.51 1.48   1   5     4  0.48    -0.23 0.02
Q19   19 2571 2.29 1.10      2    2.21 1.48   1   5     4  0.48    -0.72 0.02
Q20   20 2571 3.62 1.04      4    3.68 1.48   1   5     4 -0.39    -0.65 0.02
Q21   21 2571 3.17 0.98      3    3.12 1.48   1   5     4  0.12    -0.78 0.02
Q22   22 2571 2.89 1.04      3    2.93 1.48   1   5     4 -0.07    -0.68 0.02
Q23   23 2571 3.43 1.04      4    3.49 1.48   1   5     4 -0.59    -0.16 0.02

Observe the valence: positively vs negatively worded items in the scale. Generally, you may want to reverse-code so all items are in the same direction (all positive or all negative).

#Create a correlation matrix with all indicators.

# A lot of correlations below .2 (neg or pos) suggest this is not a suitable data set for performing data analysis

Code
corr_matrix <- correlate(saq)
corr_matrix
# A tibble: 23 × 24
   term      Q01     Q02    Q03    Q04     Q05     Q06    Q07     Q08     Q09
   <chr>   <dbl>   <dbl>  <dbl>  <dbl>   <dbl>   <dbl>  <dbl>   <dbl>   <dbl>
 1 Q01   NA      -0.0987 -0.337  0.436  0.402   0.217   0.305  0.331  -0.0923
 2 Q02   -0.0987 NA       0.318 -0.112 -0.119  -0.0742 -0.159 -0.0496  0.315 
 3 Q03   -0.337   0.318  NA     -0.380 -0.310  -0.227  -0.382 -0.259   0.300 
 4 Q04    0.436  -0.112  -0.380 NA      0.401   0.278   0.409  0.349  -0.125 
 5 Q05    0.402  -0.119  -0.310  0.401 NA       0.257   0.339  0.269  -0.0957
 6 Q06    0.217  -0.0742 -0.227  0.278  0.257  NA       0.514  0.223  -0.113 
 7 Q07    0.305  -0.159  -0.382  0.409  0.339   0.514  NA      0.297  -0.128 
 8 Q08    0.331  -0.0496 -0.259  0.349  0.269   0.223   0.297 NA       0.0157
 9 Q09   -0.0923  0.315   0.300 -0.125 -0.0957 -0.113  -0.128  0.0157 NA     
10 Q10    0.214  -0.0840 -0.193  0.216  0.258   0.322   0.284  0.159  -0.134 
# ℹ 13 more rows
# ℹ 14 more variables: Q10 <dbl>, Q11 <dbl>, Q12 <dbl>, Q13 <dbl>, Q14 <dbl>,
#   Q15 <dbl>, Q16 <dbl>, Q17 <dbl>, Q18 <dbl>, Q19 <dbl>, Q20 <dbl>,
#   Q21 <dbl>, Q22 <dbl>, Q23 <dbl>

#Q3 is not scaled in the same direction - we need to reverse code it

Code
glimpse(saq$Q03)
 dbl+lbl [1:2571] 4, 4, 2, 1, 3, 3, 3, 3, 1, 4, 5, 3, 3, 1, 3, 2, 5, 3, 4, ...
 @ label       : chr "Standard deviations excite me"
 @ format.stata: chr "%12.0g"
 @ labels      : Named num [1:5] 1 2 3 4 5
  ..- attr(*, "names")= chr [1:5] "Strongly agree" "Agree" "Neither" "Disagree" ...

#Mutate and create the reverse item for Q03, then use select to drop the original. Omision can be achieved using a minus sign on the item we want to eliminate

Code
saq.clean <-saq %>%
  mutate(.,
         Q03R = 6 - Q03) %>% # There is 5 items, add one then subtract from each to make the reverse code
  select(.,
         -Q03)

#double-check the reversed code

Code
glimpse(saq.clean$Q03R)
 num [1:2571] 2 2 4 5 3 3 3 3 5 2 ...

#Reliability 101: Calculating Coefficient Alpha

## start with a sub-scale - select the questions about computers

Code
computers <-saq.clean %>%
  select(.,
         Q06,
         Q07,
         Q10,
         Q13,
         Q14,
         Q15,
         Q18
         )

#Check correlations

Code
correlate(computers)
# A tibble: 7 × 8
  term     Q06    Q07    Q10    Q13    Q14    Q15    Q18
  <chr>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>  <dbl>
1 Q06   NA      0.514  0.322  0.466  0.402  0.360  0.513
2 Q07    0.514 NA      0.284  0.442  0.441  0.391  0.501
3 Q10    0.322  0.284 NA      0.302  0.255  0.295  0.293
4 Q13    0.466  0.442  0.302 NA      0.450  0.342  0.533
5 Q14    0.402  0.441  0.255  0.450 NA      0.380  0.498
6 Q15    0.360  0.391  0.295  0.342  0.380 NA      0.343
7 Q18    0.513  0.501  0.293  0.533  0.498  0.343 NA    

#how reliable would these items be as a scale? Get a cronbach’s alpha for this measure. lazy load psych version of alpha and not from other packages like ggplot – competition with same function names

Code
psych::alpha(computers)

Reliability analysis   
Call: psych::alpha(x = computers)

  raw_alpha std.alpha G6(smc) average_r S/N    ase mean   sd median_r
      0.82      0.82    0.81       0.4 4.6 0.0052  2.6 0.71     0.39

    95% confidence boundaries 
         lower alpha upper
Feldt     0.81  0.82  0.83
Duhachek  0.81  0.82  0.83

 Reliability if an item is dropped:
    raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r med.r
Q06      0.79      0.79    0.77      0.38 3.7   0.0063 0.0081  0.38
Q07      0.79      0.79    0.77      0.38 3.7   0.0063 0.0079  0.36
Q10      0.82      0.82    0.80      0.44 4.7   0.0053 0.0043  0.44
Q13      0.79      0.79    0.77      0.39 3.8   0.0062 0.0081  0.38
Q14      0.80      0.80    0.77      0.39 3.9   0.0060 0.0085  0.36
Q15      0.81      0.81    0.79      0.41 4.2   0.0056 0.0095  0.44
Q18      0.79      0.78    0.76      0.38 3.6   0.0064 0.0058  0.38

 Item statistics 
       n raw.r std.r r.cor r.drop mean   sd
Q06 2571  0.75  0.74  0.68   0.62  2.2 1.12
Q07 2571  0.75  0.73  0.68   0.62  2.9 1.10
Q10 2571  0.54  0.57  0.44   0.40  2.3 0.88
Q13 2571  0.72  0.73  0.67   0.61  2.4 0.95
Q14 2571  0.70  0.70  0.64   0.58  2.9 1.00
Q15 2571  0.64  0.64  0.54   0.49  2.8 1.01
Q18 2571  0.76  0.76  0.72   0.65  2.6 1.05

Non missing response frequency for each item
       1    2    3    4    5 miss
Q06 0.27 0.44 0.13 0.10 0.06    0
Q07 0.07 0.34 0.26 0.24 0.09    0
Q10 0.14 0.57 0.18 0.10 0.02    0
Q13 0.12 0.48 0.25 0.12 0.03    0
Q14 0.06 0.31 0.38 0.18 0.07    0
Q15 0.07 0.39 0.30 0.18 0.06    0
Q18 0.14 0.37 0.31 0.12 0.06    0

#what happens when we add an item that does not fit - divergent validity

Code
computers2 <-saq.clean %>%
  select(.,
         Q06,
         Q07,
         Q10,
         Q13,
         Q14,
         Q15,
         Q18,
         Q23
         )
Code
correlate(computers2)
# A tibble: 8 × 9
  term      Q06     Q07     Q10     Q13     Q14     Q15     Q18     Q23
  <chr>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>   <dbl>
1 Q06   NA       0.514   0.322   0.466   0.402   0.360   0.513  -0.0687
2 Q07    0.514  NA       0.284   0.442   0.441   0.391   0.501  -0.0703
3 Q10    0.322   0.284  NA       0.302   0.255   0.295   0.293  -0.0619
4 Q13    0.466   0.442   0.302  NA       0.450   0.342   0.533  -0.0530
5 Q14    0.402   0.441   0.255   0.450  NA       0.380   0.498  -0.0485
6 Q15    0.360   0.391   0.295   0.342   0.380  NA       0.343  -0.0620
7 Q18    0.513   0.501   0.293   0.533   0.498   0.343  NA      -0.0804
8 Q23   -0.0687 -0.0703 -0.0619 -0.0530 -0.0485 -0.0620 -0.0804 NA     
Code
psych::alpha(computers2)
Some items ( Q23 ) were negatively correlated with the first principal component and 
probably should be reversed.  
To do this, run the function again with the 'check.keys=TRUE' option

Reliability analysis   
Call: psych::alpha(x = computers2)

  raw_alpha std.alpha G6(smc) average_r S/N    ase mean   sd median_r
      0.76      0.76    0.76      0.28 3.1 0.0068  2.7 0.62     0.34

    95% confidence boundaries 
         lower alpha upper
Feldt     0.74  0.76  0.77
Duhachek  0.74  0.76  0.77

 Reliability if an item is dropped:
    raw_alpha std.alpha G6(smc) average_r S/N alpha se  var.r med.r
Q06      0.70      0.71    0.71      0.26 2.4   0.0085 0.0483  0.30
Q07      0.70      0.71    0.71      0.26 2.4   0.0085 0.0482  0.32
Q10      0.74      0.75    0.75      0.29 2.9   0.0073 0.0571  0.39
Q13      0.71      0.71    0.72      0.26 2.4   0.0083 0.0493  0.32
Q14      0.71      0.71    0.72      0.26 2.5   0.0082 0.0512  0.32
Q15      0.73      0.73    0.74      0.28 2.7   0.0077 0.0556  0.32
Q18      0.70      0.70    0.71      0.25 2.4   0.0086 0.0450  0.32
Q23      0.82      0.82    0.81      0.40 4.6   0.0052 0.0077  0.39

 Item statistics 
       n raw.r std.r r.cor r.drop mean   sd
Q06 2571  0.73  0.72  0.68  0.597  2.2 1.12
Q07 2571  0.73  0.72  0.68  0.597  2.9 1.10
Q10 2571  0.53  0.55  0.44  0.383  2.3 0.88
Q13 2571  0.71  0.71  0.67  0.590  2.4 0.95
Q14 2571  0.69  0.69  0.64  0.562  2.9 1.00
Q15 2571  0.62  0.63  0.54  0.473  2.8 1.01
Q18 2571  0.74  0.74  0.72  0.622  2.6 1.05
Q23 2571  0.12  0.11 -0.10 -0.092  3.4 1.04

Non missing response frequency for each item
       1    2    3    4    5 miss
Q06 0.27 0.44 0.13 0.10 0.06    0
Q07 0.07 0.34 0.26 0.24 0.09    0
Q10 0.14 0.57 0.18 0.10 0.02    0
Q13 0.12 0.48 0.25 0.12 0.03    0
Q14 0.06 0.31 0.38 0.18 0.07    0
Q15 0.07 0.39 0.30 0.18 0.06    0
Q18 0.14 0.37 0.31 0.12 0.06    0
Q23 0.06 0.12 0.27 0.42 0.12    0

#reliability 102: creating a scale score using alpha

Code
my.keys.list <- list(computers_var = c("Q06","Q07","Q10", "Q13","Q14", "Q15", "Q18"))

my.scales <- scoreItems(my.keys.list, saq.clean, impute = "none")
Code
print(my.scales, short = FALSE)
Call: scoreItems(keys = my.keys.list, items = saq.clean, impute = "none")

(Standardized) Alpha:
      computers_var
alpha          0.82

Standard errors of unstandardized Alpha:
      computers_var
ASE          0.0094

Standardized Alpha of observed scales:
     computers_var
[1,]          0.82

Average item correlation:
          computers_var
average.r           0.4

Median item correlation:
computers_var 
         0.39 

 Guttman 6* reliability: 
         computers_var
Lambda.6          0.81

Signal/Noise based upon av.r : 
             computers_var
Signal/Noise           4.7

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.
              computers_var
computers_var          0.82

 Average adjusted correlations within and between scales (MIMS)
[1] 0.4

 Average adjusted item x scale correlations within and between scales (MIMT)
[1] 0.69

Item by scale correlations:
 corrected for item overlap and scale reliability
    computers_var
Q06          0.68
Q07          0.68
Q10          0.44
Q13          0.67
Q14          0.64
Q15          0.54
Q18          0.72

Non missing response frequency for each item
       1    2    3    4    5 miss
Q06 0.27 0.44 0.13 0.10 0.06    0
Q07 0.07 0.34 0.26 0.24 0.09    0
Q10 0.14 0.57 0.18 0.10 0.02    0
Q13 0.12 0.48 0.25 0.12 0.03    0
Q14 0.06 0.31 0.38 0.18 0.07    0
Q15 0.07 0.39 0.30 0.18 0.06    0
Q18 0.14 0.37 0.31 0.12 0.06    0
Code
my.scores <- as_tibble(my.scales$scores)
Code
saq.clean1 <-bind_cols(saq.clean, my.scores)
glimpse(saq.clean1)
Rows: 2,571
Columns: 24
$ Q01           <dbl+lbl> 2, 1, 2, 3, 2, 2, 2, 2, 3, 2, 2, 2, 3, 2, 2, 3, 1, 2…
$ Q02           <dbl+lbl> 1, 1, 3, 1, 1, 1, 3, 2, 3, 4, 1, 1, 1, 2, 2, 1, 2, 2…
$ Q04           <dbl+lbl> 2, 3, 2, 4, 2, 2, 2, 2, 4, 3, 2, 3, 4, 2, 4, 2, 2, 3…
$ Q05           <dbl+lbl> 2, 2, 4, 3, 2, 4, 2, 2, 5, 2, 2, 4, 3, 2, 2, 2, 1, 3…
$ Q06           <dbl+lbl> 2, 2, 1, 3, 3, 4, 2, 2, 3, 1, 1, 3, 2, 2, 2, 2, 1, 4…
$ Q07           <dbl+lbl> 3, 2, 2, 4, 3, 4, 2, 2, 5, 2, 2, 3, 3, 3, 3, 2, 1, 3…
$ Q08           <dbl+lbl> 1, 2, 2, 2, 2, 2, 2, 2, 5, 2, 2, 1, 3, 2, 2, 2, 1, 2…
$ Q09           <dbl+lbl> 1, 5, 2, 2, 4, 4, 3, 4, 3, 3, 5, 3, 2, 2, 2, 2, 4, 5…
$ Q10           <dbl+lbl> 2, 2, 2, 4, 2, 3, 2, 2, 3, 2, 2, 2, 3, 3, 3, 3, 1, 2…
$ Q11           <dbl+lbl> 1, 2, 3, 2, 2, 2, 2, 2, 5, 2, 1, 2, 3, 2, 2, 2, 1, 3…
$ Q12           <dbl+lbl> 2, 3, 3, 2, 3, 4, 2, 3, 5, 3, 3, 3, 4, 4, 3, 3, 2, 3…
$ Q13           <dbl+lbl> 2, 1, 2, 2, 3, 3, 2, 2, 5, 2, 1, 2, 4, 2, 2, 2, 1, 3…
$ Q14           <dbl+lbl> 2, 3, 4, 3, 2, 3, 2, 2, 5, 1, 2, 2, 4, 4, 3, 3, 1, 3…
$ Q15           <dbl+lbl> 2, 4, 2, 3, 2, 5, 2, 3, 5, 2, 1, 3, 4, 4, 3, 2, 1, 4…
$ Q16           <dbl+lbl> 3, 3, 3, 3, 2, 2, 2, 2, 5, 3, 2, 3, 4, 4, 4, 3, 2, 3…
$ Q17           <dbl+lbl> 1, 2, 2, 2, 2, 3, 2, 2, 5, 2, 2, 2, 3, 2, 2, 2, 2, 2…
$ Q18           <dbl+lbl> 2, 2, 3, 4, 3, 5, 2, 2, 5, 2, 2, 2, 3, 4, 3, 3, 1, 2…
$ Q19           <dbl+lbl> 3, 3, 1, 2, 3, 1, 3, 4, 2, 3, 5, 3, 2, 1, 3, 2, 4, 2…
$ Q20           <dbl+lbl> 2, 4, 4, 4, 4, 5, 2, 3, 5, 3, 3, 4, 4, 5, 4, 3, 2, 3…
$ Q21           <dbl+lbl> 2, 4, 3, 4, 2, 3, 2, 2, 5, 2, 2, 3, 4, 5, 4, 2, 1, 3…
$ Q22           <dbl+lbl> 2, 4, 2, 4, 4, 1, 4, 4, 3, 4, 5, 4, 3, 3, 4, 3, 4, 3…
$ Q23           <dbl+lbl> 5, 2, 2, 3, 4, 4, 4, 4, 3, 4, 5, 4, 4, 1, 4, 4, 4, 4…
$ Q03R          <dbl> 2, 2, 4, 5, 3, 3, 3, 3, 5, 2, 1, 3, 3, 5, 3, 4, 1, 3, 2,…
$ computers_var <dbl> 2.142857, 2.285714, 2.285714, 3.285714, 2.571429, 3.8571…