#test the unidimensionality of the five factors of the bfi data set.
unidim(bfi.keys,bfi)
if(require(psychTools)) {
unidim(psychTools::ability.keys,psychTools::ability)
}
#Try a known 3 factor structure
x <- sim.minor(nfact=3,bipolar=FALSE) #this makes all the items positive
unidim(x$model)
keys.list <- list(first =paste0("V",1:4) ,second = paste0("V",5:8),
third=paste0("V",9:12),all= paste0("V",1:12))
unidim(keys.list, x$model)
x <- sim.minor(nfact=3)
unidim(keys.list,x$model) #we flip the negative items
#what about a hierarchical model?
H <- sim.hierarchical() # by default, a nice hierarchical model
H.keys <- list(First = paste0("V",1:3),Second=paste0("V",4:6),Third=paste0("V",7:9),
All = paste0("V",1:9))
unidim(H.keys,H)
Run the code above in your browser using DataLab