# NOT RUN {
gload <- gload<-matrix(c(.9,.8,.7),nrow=3) # a higher order factor matrix
fload <-matrix(c( #a lower order (oblique) factor matrix
.8,0,0,
.7,0,.0,
.6,0,.0,
0,.7,.0,
0,.6,.0,
0,.5,0,
0,0,.6,
0,0,.5,
0,0,.4), ncol=3,byrow=TRUE)
jensen <- sim.hierarchical(gload,fload) #the test set used by omega
round(jensen,2)
#compare this to a simulation of the bonds model
set.seed(42)
R <- sim.bonds()
R$R
#simulate a non-hierarchical structure
fload <- matrix(c(c(c(.9,.8,.7,.6),rep(0,20)),c(c(.9,.8,.7,.6),rep(0,20)),
c(c(.9,.8,.7,.6),rep(0,20)),c(c(c(.9,.8,.7,.6),rep(0,20)),c(.9,.8,.7,.6))),ncol=5)
gload <- matrix(rep(0,5))
five.factor <- sim.hierarchical(gload,fload,500,TRUE) #create sample data set
#do it again with a hierachical structure
gload <- matrix(rep(.7,5) )
five.factor.g <- sim.hierarchical(gload,fload,500,TRUE) #create sample data set
#compare these two with omega
#not run
#om.5 <- omega(five.factor$observed,5)
#om.5g <- omega(five.factor.g$observed,5)
# }
Run the code above in your browser using DataLab