问题描述
我有一个数据框twin_dedup
,为此我只选择了需要输入到因子分析中的数值。我创建了因子模型fa_twindedup3
,但是现在如何将因子得分映射回twin_dedup
的原始数据框?我想要twin_dedup
中的所有变量和因子得分在哪里?
#removing missing values from background variables
twin_dedup <- twin[complete.cases(twin[,4:6]),]
t_subdedup = subset(twin_dedup,select = c("english","math","socsci","natsci","vocab"))
> head(twin_dedup)
id sex zygosity moed faed faminc english math socsci natsci vocab
1 1 2 1 3 4 2 14 13 17 18 14
2 1 2 1 3 4 2 11 14 15 10 12
3 2 2 1 1 1 1 20 20 16 16 13
4 2 2 1 1 1 1 17 19 13 13 14
5 3 2 1 1 1 1 11 8 15 16 12
6 3 2 1 1 1 1 16 13 13 8 15
fa_twindedup3 <- fa(t_subdedup,nfactors = 1,fm="wls",rotate = "varimax")
fa_twindedup3
> head(fa_twindedup3$scores)
WLS1
1 -1.1245230
2 -1.7486677
3 -0.9129794
4 -1.3063351
5 -1.6774486
6 -1.6304542
对此的任何帮助都是非常有用的。我想要最后一个数据框,其中包含twin_dedup
中的所有变量和fa_twindedup3$scores
中的一个变量
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)