关于成分数据分析的问题

代码如下:

library(compositions)

library(readxl)

data <- read_excel("C:/Users/Arvin/Desktop/Rproject/数据1.xlsx")

# 选择需要用作成分的列和协变量、因变量的列

comp_cols <- c("SLP", "LPA", "MVPA", "SB")

covariate_col <- "Gender"

response_col <- "Health"

# 提取成分数据

comp <- data[, comp_cols]

comp <- acomp(comp)

#构建回归模型

ilr_comp <- ilr(comp)

lm_model <- lm(data[[response_col]] ~ ilr_comp + data[[covariate_col]])

#输出经过ilr转换之后的多元回归分析结果

summary(lm_model)

在上述的代码当中,对SLP、LPA、MVPA、SB进行了ilr转换,构建了回归模型,然后再进行了多元回归分析,主要是想知道四种行为对健康这一因变量的影响,但是输出的结果是这样的:

Call:

lm(formula = data[[response_col]] ~ ilr_comp + data[[covariate_col]])

Residuals:

    Min      1Q  Median      3Q     Max

-4.4562 -0.7854  0.1069  0.8792  2.2847

Coefficients:

                      Estimate Std. Error t value Pr(>|t|)    

(Intercept)            5.60516    0.17658  31.743  < 2e-16 ***

ilr_comp1              0.02019    0.09443   0.214 0.830762    

ilr_comp2             -0.22391    0.06067  -3.690 0.000236 ***

ilr_comp3             -0.02547    0.10870  -0.234 0.814766    

data[[covariate_col]] -0.34550    0.08030  -4.303 1.85e-05 ***

---

Signif. codes:  0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1

Residual standard error: 1.279 on 1028 degrees of freedom

Multiple R-squared:  0.03856, Adjusted R-squared:  0.03482

F-statistic: 10.31 on 4 and 1028 DF,  p-value: 3.477e-08

然后查了一下chatgpt,它的解释是ilr转换会对数据进行降维,因此在结果中出现了ilr_comp1  ilr_comp2  ilr_comp3  这三个因子,但是这三个因子又不对应上述的四种行为,不是我想要的结果,我想要的是四种行为在经过了ilr转换之后,各个行为对因变量健康的β值以及P值,这时候该如何解决? 

感谢感谢感谢!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值