#simulate data
a <- matrix(c(
1.5,NA,
0.5,NA,
1.0,NA,
1.0,0.5,
NA,1.5,
NA,0.5,
NA,1.0,
NA,1.0),ncol=2,byrow=TRUE)
d <- matrix(c(
-1.0,NA,NA,
-1.5,NA,NA,
1.5,NA,NA,
0.0,NA,NA,
3.0,2.0,-0.5,
2.5,1.0,-1,
2.0,0.0,NA,
1.0,NA,NA),ncol=3,byrow=TRUE)
sigma <- diag(2)
sigma[1,2] <- sigma[2,1] <- .4
dataset <- simdata(a,d,2000,sigma)
#analyses
#CIFA for 2 factor crossed structure
model.1 <- confmirt.model()
F1 = 1-4
F2 = 4-8
COV = F1*F2
mod1 <- confmirt(dataset,model.1)
coef(mod1)
summary(mod1)
residuals(mod1)
#fix first slope at 1.5, and set slopes 7 & 8 to be equal
model.2 <- confmirt.model()
F1 = 1-4
F2 = 4-8
COV = F1*F2
SLOPE = F1@1 eq 1.5, F2@7 eq F2@8
mod2 <- confmirt(dataset,model.2)
anova(mod2,mod1)
#####
#bifactor
model.3 <- confmirt.model()
G = 1-8
F1 = 1-4
F2 = 5-8
mod3 <- confmirt(dataset,model.3)
coef(mod3)
summary(mod3)
residuals(mod3)
anova(mod1,mod3)
Run the code above in your browser using DataLab