Psych:委托人-加载组件 [英] psych: principal - loadings components

查看:106
本文介绍了Psych:委托人-加载组件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的问题与心理软件包中的principal()函数有关.

My question is concerned with the principal() function in psych package.

set.seed(0)
x <- replicate(8, rnorm(10))
pca.x <- principal(x, nf=4, rotate="varimax")

我知道是否要查看加载表,可以使用loading.x <-loadings(pca.x),这样我将得到以下结果.

I know if I want to see the loadings table, I can use loading.x <-loadings(pca.x), than I will have the following results.

> loading.x
Loadings:
     RC1    RC3    RC4    RC2   
[1,]        -0.892 -0.205  0.123
[2,]  0.154  0.158  0.909       
[3,] -0.660  0.255 -0.249  0.392
[4,] -0.352  0.412  0.614 -0.481
[5,]  0.950 -0.208  0.117       
[6,] -0.302  0.111         0.860
[7,]  0.852        -0.195 -0.358
[8,] -0.109  0.903         0.265

                 RC1   RC3   RC4   RC2
SS loadings    2.323 1.934 1.373 1.342
Proportion Var 0.290 0.242 0.172 0.168
Cumulative Var 0.290 0.532 0.704 0.871

我的第一个困惑是加载对象.从技术上讲,它是一个矩阵,但从尺寸上看,它是8 * 4,这意味着不包括下部.

My first confusion is the loadings object. Technically, it is a matrix, but look at its dimension, it is 8 * 4, which means the lower part is not included.

基本上,我要实现的是仅提取此部分:

Basically, what I want to achieve is to extract this part alone:

                 RC1   RC3   RC4   RC2
SS loadings    2.323 1.934 1.373 1.342
Proportion Var 0.290 0.242 0.172 0.168
Cumulative Var 0.290 0.532 0.704 0.871

可以将其放在data.frame或矩阵中,而不是在控制台中查看它.似乎William Revelle在帖子从心理包的主要功能中提取输出作为数据框.可以单独提取下半部分,但是print函数仍然可以为我提供整个功能.

Either put it in a data.frame or a matrix, rather than looking at it in the console. It seems that William Revelle's answer in the post Extracting output from principal function in psych package as a data frame. is able to extract this lower part alone, but the print function still gives me the whole thing.

事实上,我也很好奇开发人员如何构造一个加载对象(我无法通过查看源代码来弄清楚它).另外,我需要的部分在"pca.x"列表中的其他地方找不到,至少没有格式化的表. 我在Mac和Psych 1.5.1.上使用的是Rstudio 0.98.1102,R 3.1.2.

In fact, I'm also curious how the developers are able to construct a loading object (I can't figure it out by look at source code). Also, the part I need I can't find elsewhere in the 'pca.x' list, at least not a formatted table. I am using Rstudio Version 0.98.1102, R 3.1.2, on a mac, and psych 1.5.1.

提前谢谢!

推荐答案

部分得到了回答,但是由于它是我的软件包,因此我将给出更完整的答案.

This was partly answered, but since it is my package, I will give a somewhat more complete answer.

在打印功能中计算PCA或FA因子负荷表的汇总表.它被返回(通过打印看不见).但是,它可以作为Vaccounted对象使用.

The summary table of the PCA or FA factor loadings tables is calculated in the print function. It it is returned (invisibly by print). However, it is available as the Vaccounted object.

即PCA或FA输出的摘要表

i.e. summary table of the PCA or FA output

set.seed(0)
x <- replicate(8, rnorm(10))
pca.x <- principal(x, nf=4, rotate="varimax")
p <- print(pca.x)

round(p$Vaccounted,2)   #shows the summary of the loadings table
                       PC1  PC3  PC4  PC2
SS loadings           2.32 1.93 1.37 1.34
Proportion Var        0.29 0.24 0.17 0.17
Cumulative Var        0.29 0.53 0.70 0.87
Proportion Explained  0.33 0.28 0.20 0.19
Cumulative Proportion 0.33 0.61 0.81 1.00

这也适用于fa功能.

This works for the fa function as well.

这篇关于Psych:委托人-加载组件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆