#test the unidimensionality of the five factors of the bfi data set.
unidim(psychTools::bfi.keys,psychTools::bfi)
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 =c(1:4),second = 5:8,third=9:12,all=1:12)
unidim(keys.list, x$model)
x <- sim.minor(nfact=3)
unidim(keys.list,x$mode) #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