R代码分享:使用PCA方法对于communality进行计算

该文介绍了使用PCA(主成分分析)计算communality的过程,包括数据矩阵化、计算四分相关系数、执行PCA生成特征向量、绘制特征值散点图以确定保留的组件数量,以及计算因子载荷的平方和作为communality的步骤。

有关于communality的介绍在此不加展开,采用的计算思路是源于此篇文章的supplement materials:

Livingston G, Huntley J, Sommerlad A, et al. Dementia prevention, intervention, and care: 2020 report of the Lancet Commission. Lancet 2020; published online July 30. http://dx.doi.org/10.1016/S0140-6736(20)30367-6.

https://www.thelancet.com/cms/10.1016/S0140-6736(20)30367-6/attachment/cee43a30-904b-4a45-a4e5-afe48804398d/mmc1.pdf

以下为纯代码分享:

# step1. input data on all risk factors in the model
# my original dataset: pca_set

my_matrix<-as.matrix(pca_set)

# step2. calculate tetrachoric correlation to generate correlation coefficients and 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值