2017-07-26 3 views
0

私はsvyfactanal()関数を使用し因子スコアを得ることによって因子分析を実行しようとしていました。要因分析の実行に問題はありません。しかしsvyfactanalからの因子スコアの抽出

library(survey) 
factor1 <- svyfactanal(~ var1 + var2 + var3 ... + var12, 
         design = design, factors = 4, rotation = "promax", 
         scores = "regression") 

、私はそれぞれの観察のために因子得点を抽出したいとき、私は、エラーメッセージが表示されます。data.frameで

data1 <- cbind(data, factor1$scores) 

エラー(...、check.names = FALSEを): 引数は、行の数が異なる暗示:1297、

0それから手動因子得点をチェックし、私はこのメッセージを受信した:

factor1$scores 
# NULL 

svyfactanal()機能からこれらのスコアを抽出する方法はありますか?

答えて

1

svyfactanalは、異なる共分散行列をfactanalに渡すだけです。 factanalのドキュメントでは、得点は$ scoreです。 (ヘルプから):

v1 <- c(1,1,1,1,1,1,1,1,1,1,3,3,3,3,3,4,5,6) 
v2 <- c(1,2,1,1,1,1,2,1,2,1,3,4,3,3,3,4,6,5) 
v3 <- c(3,3,3,3,3,1,1,1,1,1,1,1,1,1,1,5,4,6) 
v4 <- c(3,3,4,3,3,1,1,2,1,1,1,1,2,1,1,5,6,4) 
v5 <- c(1,1,1,1,1,3,3,3,3,3,1,1,1,1,1,6,4,5) 
v6 <- c(1,1,1,2,1,3,3,3,4,3,1,1,1,2,1,6,5,4) 
m1 <- cbind(v1,v2,v3,v4,v5,v6) 
cor(m1) 
factanal(m1, factors = 3) # varimax is the default 
factanal(m1, factors = 3, rotation = "promax") 
# The following shows the g factor as PC1 
prcomp(m1) # signs may depend on platform 

## formula interface 
factanal(~v1+v2+v3+v4+v5+v6, factors = 3, 
     scores = "Bartlett")$scores 

あなただけの最初の因子得点を望んでいた場合、あなたが使用します。

factanal(~v1+v2+v3+v4+v5+v6, factors = 3, 
     scores = "Bartlett")$scores[,1] 

や、あなたの例のために、のようなもの:

factor1scores <- factor1$scores[,1] 
data1 <- cbind(data, factor1scores) 
関連する問題