我試圖使用非參數引導來引導可靠性估計 我已經寫了下面的代碼創建模型,然後引導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%*%測試版: 較長的物體長度不是較短的物體長度的倍數 –
對不起,是的,我現在看到它。我會立即更新代碼 –