[英]How to use Stargazer R package with factor analysis output
我過去曾使用過帶有回歸表的 stargazer。
但是我想知道如何將 stargazer 與因子分析和主成分分析的輸出一起使用。
我的代碼運行如下:
fa1 <- factanal(new2, factors = 4, rotation = "varimax", sort = TRUE)
print(fa1, digits = 3, cutoff = .5, sort = TRUE)
load <- fa1$loadings[,1:2]
plot(load,type="n")
text(load,labels=names(new2),cex=.7)
和
two <- pca(new2, nfactors = 3)
這不起作用 - 到目前為止我唯一的嘗試。
stargazer(fa1, type = "text", title="Descriptive statistics", digits=1, out="table1.txt")
更新:自發布以來,我已經能夠將對象轉換為數據框:
轉換 <- as.data.frame(unclass(fa1$loadings))
然后我成功地使用了上面的代碼,除了輸出似乎不包括單個因素分數。
見下文:
這可能不是一個完美的解決方案,您現在可能已經發現了,但是您可以做的是通過添加summary = FALSE
作為選項,使用 stagazer 單獨輸出因子分數。 通過這種方式,您只能將因子載荷作為輸出。 例如像這樣:
stargazer(fa1, summary = FALSE, title="Descriptive statistics", digits=1, out="table1.txt")
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.