# NOT RUN {
# }
# NOT RUN {
require(OpenMx)
data(myFADataRaw)
manifests = c("x1","x2","x3","x4","x5","x6")
# Build and run 1-factor raw-data CFA
m1 = mxModel("CFA", type="RAM", manifestVars=manifests, latentVars="F1",
# Factor loadings
mxPath("F1", to = manifests, values=1),
# Means and variances of F1 and manifests
mxPath(from="F1", arrows=2, free=FALSE, values=1), # fix var F1 @1
mxPath("one", to= "F1", free= FALSE, values = 0), # fix mean F1 @0
# Freely-estimate means and residual variances of manifests
mxPath(from = manifests, arrows=2, free=TRUE, values=1),
mxPath("one", to= manifests, values = 1),
mxData(myFADataRaw, type="raw")
)
m1 = mxRun(m1)
set.seed(170505) # Desirable for reproducibility
# ==========================
# = 1. Bootstrap the model =
# ==========================
m1_booted = mxBootstrap(m1)
# =================================================
# = 2. Estimate and accumulate a distribution of =
# = standardized values from each bootstrap. =
# =================================================
tmp = mxBootstrapStdizeRAMpaths(m1)
# tmp
# name Estimate SE
# 1 ind60_to_x1 1.0000000 0.00000000
# 2 ind60_to_x2 2.1803678 0.13901100
# 3 ind60_to_x3 1.8185115 0.15219019
# 4 ind60_to_dem60 1.4830002 0.39729395
# ...
# }
Run the code above in your browser using DataLab