【发布时间】:2015-10-07 11:23:50
【问题描述】:
我正在尝试根据不同数量的潜在类 nclass 选择最适合我的数据的 LCA 模型 (R package=poLCA)。
我想使用 for 循环为 1:5 潜在类运行模型,并为每个模型生成一个包含 G2、AIC 和 BIC 值的表。
## Generating a table of G2,AIC & BIC for different no of LCA classes (1:5) for 6 variables.
library(poLCA)
as.data.frame(mod_sum_v6)
for(i in 1:5){
lca_v6<- poLCA(cbind(A,B,C,D,E,F) ~ 1,
maxiter=50000,nclass=i,
nrep=1, data=data)
mod_sum_v6[i]<-c(lca_v6$Chisq,lca_v6$resid.df,lca_v6$Gsq,lca_v6$aic,lca_v6$bic)
}
【问题讨论】: