TestCronbachAlpha {cmm}  R Documentation 
Data set TestCronbachAlpha
is a simulated data set that is used to demonstrate
the statistical testing of three relevant hypotheses involving Cronbach's alpha:
H01: alpha equals a particular criterion;
H02: testing the equality of two alpha coefficients for independent samples; and
H03: testing the equality of two alpha coefficients for dependent samples.
This R document file may be regarded as an appendix to Kuijpers, Van der Ark, and Croon (2012) who discussed this topic. Hence, all references to equations pertain to this paper. The Details section describes the required objects for testing the three hypotheses. The Examples section describes the actual code required for for testing the three hypotheses.
data(TestCronbachAlpha)
A 400 by 21 matrix, representing the dichotomous item scores of 400 respondents from two groups for two tests.
The first column is the grouping variable: Group 1
and Group 2
each consist of 200 observations.
Columns 211 are the items score of Test 1. Columns 1221 are the item scores of Test 2. So each test includes
J = 10 items having K = 2 item scores.
Note that in Kuijpers et al. (2012), k is used rather than K; k = K  1.
Data files
TestCronbachAlphaH1 < TestCronbachAlpha[1:200,2:11]
TestCronbachAlphaH2 < TestCronbachAlpha[1:400,1:11]
and
TestCronbachAlphaH3 < TestCronbachAlpha[1:200,2:21]
will be used to test hypotheses H01, H02, and H03, respectively.
Vector m is estimated under the general categorical marginal model g(m) = d.
Objects coeff
, bt
, and at
define function g(m).
coeff  Includes the design matrices and functions (i.e., exp and log) of the coefficients of interest. 
Function SpecifyCoefficient returns the design matrices and functions of several prespecified coefficients, including Cronbach's alpha.  
The argument arg in SpecifyCoefficient specifies for which of the J marginals Cronbach's alpha should be computed, and it specifies the number of response categories K. 

Furthermore, the argument data in SpecifyCoefficient specifies for which data set Cronbach's alpha should be computed (for example for data set mydata ). 

For hypothesis H01, which involves only one Cronbach's alpha, coeff is obtained by 

coeff = SpecifyCoefficient(name = "CronbachAlpha", arg = list(list(1 : J), K), data = mydata) 

For H01, object coeff includes the design matrices and functions in Equation 10. 

For hypothesis H02, which involves two alpha coefficients derived from two independent samples, coeff is obtained by 

coeff = SpecifyCoefficient(name = "CronbachAlpha", arg = list(list(2 : (J + 1), 2 : (J + 1)), c(K, K), 1), data = mydata, ) 

For H02, coeff now includes the design matrices and functions in Equation 19. 

For hypothesis H03, which involves two dependent alpha coefficients, coeff is obtained by 

coeff = SpecifyCoefficient(name="CronbachAlpha", arg=list(list(test1, test2),c(K,K)), data=mydata,) 

For H03, object coeff includes the design matrices and functions in Equation 23. 

bt  Is called the constraint matrix and relates the coefficients defined in coeff . Hypothesis H01 pertains to one Cronbach's alpha, so bt is the scalar 1. For hypotheses H02 and H03 bt equals design matrix A6. 
at  Is called the marginal matrix. The marginal matrix was not specified for hypotheses H01 and H02, which is equivalent to including the identity matrix as the marginal matrix in Equations 10 (H01) and 18 (H02). Hence at = I. 
For hypotheses H03 the marginal matrix is equal to design matrix A_0 (p. 16). Function MarginalMatrix constructs the marginal matrix.  
d  Vector d in Equation 9. 
Function MarginalModelFit estimates the categorical marginal model (CMM), and requires the following arguments: the vector of observed frequencies, n
, and model
specifications in coeff
, bt
, at
, and d
.
In the example for testing hypothesis H01, data set TestCronbachAlphaH1
was used, which contained the 200 itemscore vectors from the first group,
for the first test. For this data set, Cronbach's alpha is equal to 0.793. If a researcher wants to test whether this value is
significantly above .75, the software code for the first example in the paragraph
Examples
can be used (see below). First, the R package cmm
needs to be invoked. Second, vector n,
the number of items J, the number of categories K, and criterion c in hypothesis H01 have to be defined.
The fit of this marginal model
is evaluated by G^2, with D = 1 degree of freedom. In general, G^2 pertains to a twosided test. However, here H01 is a onesided hypothesis,
the value of G^2 at the 2 alpha level is used. For alpha = 0.05, H01 must be rejected if G^2 > 2.71 (i.e., p = .10) and r_alpha > c.
The results of the analysis show that G^2 = 3.301 with p = 0.069, so for this example we can conclude that the alpha of this data set (i.e.,
r_alpha = 0.793) is significantly above .75.
For testing hypothesis H02, data set TestCronbachAlphaH2
was used, which contained the itemscore vectors from the two independent groups for the first
test, and an additional variable indicating group membership.
For this data set, Cronbach's alpha for the first independent group is equal to 0.793, for the second independent group alpha is equal to 0.737. To test
whether the alphas of the two independent groups are equal, the software code for the second example in the paragraph Examples can be used (see below).
Note that the first item indicates group membership. Hence, for J items, vector n is based on J+1 patterns. G^2 is used to assess the
fit of this marginal model with D = 1 degree of freedom, so H02 must be rejected if G^2 > 3.84 (i.e., alpha = .05).
The results of the analysis show that G^2 = 2.774 with p = 0.096, so for this example we can conclude that the alphas of the two independent samples
(i.e., r_alpha_g1 = 0.793 and r_alpha_g1 = 0.737) are equal.
For hypothesis H03, data set TestCronbachAlphaH3
was used, which contained the 200 itemscore vectors from the first group for the two tests.
The data of each test forms one dependent group. For this data set,
Cronbach's alpha for the first dependent group is equal to 0.793, for the second dependent group alpha is equal to 0.696. For H03, the marginal matrix
is not implemented in the package as a code yet, so it has to be computed ad hoc. To test whether the alphas of the two dependent groups are equal, the
software code for the third example in the paragraph Examples can be used (see below). G^2 is used to assess the fit of this marginal model
with D = 1 degree of freedom. The results of the analysis show that G^2 = 9.898 with p = 0.002. Using alpha = .05, we can conclude
that the alphas of the two dependent samples (i.e., r_alpha_t1 = 0.793 and r_alpha_t1 = 0.696) are not equal to each other.
Renske E. Kuijpers, L. Andries van der Ark
Kuijpers, R. E., Van der Ark, L. A., & Croon, M. A. (2012). Testing hypotheses involving Cronbach's alpha using marginal models. Manuscript submitted for publication.
cmm, SpecifyCoefficient, MarginalMatrix
,
data(TestCronbachAlpha)
#Example 1: Testing H01.
# Invoke cmm
library(cmm)
# Data
TestCronbachAlphaH1 < TestCronbachAlpha[1 : 200, 2 : 11]
# Transform data into vector of frequencies n
n < as.matrix(table(apply(TestCronbachAlphaH1, 1, paste, collapse = "")))
# Specify number of items
J < 10
# Specify number of item scores
K < 2
# Specify criterion for Hypothesis H01
criterion < .75
# Compute object coeff
coeff < SpecifyCoefficient(name = "CronbachAlpha", arg = list(list(1 : J), K),
data = TestCronbachAlphaH1)
# Compute object at (marginal matrix)
L < ncol(coeff[[1]][[5]])
at < diag(L)
# Compute object bt (constraint matrix)
bt < matrix(1)
# Compute object d
d < criterion
# Compute CMM
model < list(bt, coeff, at, d)
fit < MarginalModelFit(n, model, MaxError = 1e04)
#Example 2: Testing H02.
# Data
TestCronbachAlphaH2 < TestCronbachAlpha[1 : 400, 1 : 11]
# Transform data into vector of frequencies n
n < as.matrix(table(apply(TestCronbachAlphaH2, 1, paste, collapse = "")))
# Specify number of items
J < 10
# Specify number of item scores
K < 2
# Compute object coeff
coeff < SpecifyCoefficient(name = "CronbachAlpha", arg = list(list(2 : (J + 1),
2 : (J + 1)), c(K, K), 1), data = TestCronbachAlphaH2,)
# Compute object at (marginal matrix)
L < ncol(coeff[[1]][[5]])
at < diag(L)
# Compute object bt (constraint matrix)
bt < matrix(c(1,1),1,2)
# Compute object d
d < rep(0,nrow(bt))
# Compute CMM
model < list(bt,coeff,at,d)
fit < MarginalModelFit(n, model, MaxError = 1e04)
#Example 3: Testing H03.
# Data
TestCronbachAlphaH3 < TestCronbachAlpha[1 : 200, 2 : 21]
# Transform data into vector of frequencies n
n < as.matrix(table(apply(TestCronbachAlphaH3, 1, paste, collapse = "")))
# Specify number of items
J < 20
# Specify number of item scores
K < 2
# Specify which items belong to which test
test1 < 1 : 10
test2 < 11 : 20
# Compute object coeff
coeff < SpecifyCoefficient(name = "CronbachAlpha", arg = list(list(test1,
test2), c(K, K)), data = TestCronbachAlphaH3,)
# Compute object at (marginal matrix)
x < dimnames(n)[[1]]
p1 < sort(unique(substr(x, test1[1] ,test1[length(test1)])))
p2 < sort(unique(substr(x, test2[1] ,test2[length(test2)])))
U1 < matrix(NA, length(p1), length(x))
for (h1 in 1 : length(p1))
U1[h1, ] < as.numeric(substr(x, test1[1], test1[length(test1)]) == p1[h1])
U2 < matrix(NA, length(p2), length(x))
for (h2 in 1 : length(p2))
U2[h2, ] < as.numeric(substr(x, test2[1], test2[length(test2)]) == p2[h2])
at < rbind(U1, U2)
# Compute object bt (constraint matrix)
bt < matrix(c(1, 1), 1, 2)
# Compute object d
d < rep(0, nrow(bt))
# Compute CMM
model < list(bt, coeff, at, d)
fit < MarginalModelFit(n, model, MaxError = 1e04)