我试图使用非参数引导来引导可靠性估计 我已经写了下面的代码创建模型,然后引导1000次以获得两个可靠性统计信息Alpha和Omega 我是能够与置信区间得到Alpha和欧米茄为第一构建:visual =~ x1 + x2 + x3
但看到没有办法访问它的其他结构textual
和speed
当我运行的引导功能,我看到的结果为所有的自举以获得置信区间使用R
# bootstrapping with 1000 replications
results <- boot(data=data, statistic=reliability, R=500, formula=HS.model,parallel = 'snow')
> results$t0
visual textual speed total
alpha 0.6261171 0.8827069 0.6884550 0.7604886
omega 0.6253180 0.8851754 0.6877600 0.8453351
omega2 0.6253180 0.8851754 0.6877600 0.8453351
omega3 0.6120052 0.8850608 0.6858417 0.8596204
avevar 0.3705589 0.7210163 0.4244883 0.5145874
下面是我承认shodd尝试。谁能帮
library(lavaan)
library(semTools)
library(boot)
data <- HolzingerSwineford1939
HS.model <- 'visual =~ x1 + x2 + x3
textual =~ x4 + x5 + x6
speed =~ x7 + x8 + x9 '
# function to reliability stats
reliability <- function(formula, data, indices) {
data = data
d <- data[indices,] # allows boot to select sample
fit <- cfa(HS.model, data=d)
semTools::reliability(fit)
}
# bootstrapping with 500 replications
results <- boot(data=data, statistic=reliability, R=500, formula=HS.model,parallel = 'snow')
# Get the confidence intervals
conf_interval_alpha <- boot.ci(results, type="bca", index = 1)
# Retrieve the Alpha and confidence intervals
alpha <- conf_interval_alpha$t0
alpha.ci <- conf_interval_alpha$bca[,c(4,5)]
# Retrieve the Omega and confidence intervals
conf_interval_omega <- boot.ci(results, type="bca", index = 2)
omega <- conf_interval_omega$t0
omega.ci <- conf_interval_omega$bca[,c(4,5)]
谢谢您的帮助
基本调试...在新会话中执行此操作...并读取错误消息。我遇到的第一个错误是:ERsum(beta [i,],tau.found.sym.optim,m + 1,m + n)中的错误: dims [product 666]与对象的长度不匹配[999] 另外:警告信息: 在y - X%*%测试版: 较长的物体长度不是较短的物体长度的倍数 –
对不起,是的,我现在看到它。我会立即更新代码 –