library(psych)
library(modelsummary) # for summarizing dataCoefficient \(\alpha\) (Part I)
In the first part, we will first simulate some data with the true scores being known, and compute the reliability. We will then “brainwash” ourselves regarding any knowledge of the true scores, and estimate the \(\alpha\) reliability.
# Simulate true scores
set.seed(2033)
num_persons <- 100
num_items <- 3
true_score <- round(
rnorm(num_persons, mean = 3.5, sd = 1),
digits = 2)
# Simulate observed scores
item1 <- round(
true_score + runif(num_persons, min = -1, max = 1)
)
item2 <- round(
true_score + runif(num_persons, min = -1.5, max = 1.5)
)
item3 <- round(
true_score + runif(num_persons, min = -2, max = 2)
)
item_data <- data.frame(true_score, item1, item2, item3)
item_data true_score item1 item2 item3
1 2.58 3 4 2
2 3.20 4 3 3
3 1.82 3 1 0
4 3.03 4 4 3
5 3.52 3 4 6
6 4.16 4 4 6
7 3.71 3 4 2
8 2.49 2 3 1
9 2.64 3 2 1
10 1.81 2 1 0
11 3.18 2 3 2
12 4.14 3 5 4
13 3.40 2 2 3
14 2.97 2 4 2
15 4.00 3 5 5
16 4.92 5 4 5
17 3.23 3 2 4
18 4.06 5 3 2
19 4.76 4 6 5
20 2.76 3 3 1
21 2.91 4 2 2
22 3.68 4 5 2
23 3.72 4 4 3
24 2.60 2 1 3
25 4.33 5 4 5
26 2.54 3 2 4
27 3.50 4 2 4
28 4.08 4 3 3
29 3.71 4 4 3
30 4.43 5 5 6
31 3.34 3 5 2
32 3.95 5 3 3
33 5.27 5 5 4
34 2.97 3 4 2
35 2.11 2 1 1
36 3.47 3 4 2
37 2.54 2 2 4
38 2.00 2 3 1
39 3.54 4 5 2
40 3.83 4 3 3
41 3.47 3 4 2
42 4.14 5 5 3
43 2.01 2 2 4
44 5.22 6 6 6
45 2.96 4 4 2
46 1.54 1 1 3
47 4.26 5 5 3
48 2.53 3 3 3
49 3.71 4 5 6
50 3.29 4 5 5
51 4.25 5 4 4
52 4.29 4 4 5
53 2.63 3 3 5
54 4.85 5 6 5
55 3.23 3 3 3
56 2.74 2 2 4
57 2.75 2 3 1
58 3.46 3 3 3
59 2.98 3 4 4
60 4.50 5 4 5
61 4.69 6 4 3
62 4.99 4 6 4
63 3.94 5 3 5
64 3.29 4 3 2
65 3.87 4 5 3
66 4.72 5 3 5
67 4.17 4 3 5
68 5.01 6 4 4
69 3.18 3 4 3
70 3.34 4 3 2
71 4.93 5 5 4
72 2.40 3 2 2
73 1.89 2 2 2
74 3.07 3 3 3
75 5.11 6 6 5
76 4.50 4 5 6
77 3.03 4 2 5
78 3.67 4 3 2
79 2.65 3 1 2
80 4.48 5 6 4
81 1.64 1 0 2
82 2.96 3 2 3
83 2.56 2 3 3
84 4.30 5 6 4
85 4.33 5 4 4
86 3.25 2 3 5
87 3.07 4 3 1
88 3.12 3 2 3
89 2.85 4 2 2
90 3.64 3 5 3
91 3.90 3 3 2
92 3.10 3 4 2
93 1.68 1 1 3
94 3.43 3 5 2
95 2.33 2 3 2
96 1.52 1 3 1
97 4.16 5 5 6
98 2.66 3 2 3
99 2.98 3 4 5
100 3.88 3 4 3
datasummary(item1 + item2 + item3 ~ Mean + Var + Histogram,
data = item_data)Warning in attr(x, "align"): 'xfun::attr()' is deprecated.
Use 'xfun::attr2()' instead.
See help("Deprecated")
| Mean | Var | Histogram | |
|---|---|---|---|
| item1 | 3.50 | 1.42 | ▁▃▇▆▄▁ |
| item2 | 3.47 | 1.89 | ▂▄▇▆▄▂ |
| item3 | 3.22 | 2.15 | ▁▂▇▇▄▄▂ |
Next, we consider the composite of the three items by summing the scores for each person.
sum_scores <- rowSums(item_data[c("item1", "item2", "item3")])Each item has a true score. The true score for the item sum is the sum of the item true scores.
# Same true score for each item
true_score_sum <- true_score + true_score + true_score