R language survival data for mediation analysis (3)--analyze data where the independent variable and the mediating variable are continuous variables

Mediator is an important statistical concept. If the independent variable X has a certain influence on the dependent variable Y through a certain variable M, then M is called the mediating variable of X and Y. At present, most domestic and foreign studies draw lessons from the causal stepwise regression method for testing. The causal step method was proposed by Baron and Kenny (1986), and its testing steps are divided into three steps. First, the regression of X on Y, test the significance of the regression coefficient c); second, the regression of X on M, test the significance of the regression coefficient a); third, the regression of X and M on Y, test Significance of regression coefficients b and c'). If the coefficients c, a and b are all significant, it means that there is a mediating effect. At this time, if the coefficient c' is not significant, the mediating effect is called full mediation; if the regression coefficient c' is significant, but c' < c, the mediating effect is called partial mediation. ). The effect size of the mediation effect is often measured by ab/c or ab/c'.
Insert image description here
In the last two articles, we have conducted mediation analysis on survival data. However, the first two articles have a shortcoming and cannot analyze data where the mediating variable is a continuous variable. During this period, many fans have recommended a lot of literature to me, which is about continuous variables as intermediary variables. I would like to express my gratitude.

There have been many literatures introducing mediation effect analysis for survival analysis (see references for specific literature). Today we introduce the two-stage mediation regression method for analysis.

Import data first

library(foreign)
library(plyr)
library(survival)
library(survminer)
bc<-read.csv("E:/r/test/xingen.csv",sep=',',header=TRUE)

Insert image description here
This is data related to the survival rate of patients after myocardial infarction and various risk factors, status outcome, time survival time, CHF fatigue, diabetes, VF with or without ventricular fibrillation, WMI heart pumping function, sex, and age.

Next, we use the two-stage classic mediation method for formal analysis. In our data, age is the exposure variable and is a continuous variable, the mediating variable cardiac output wmi is a continuous variable, death status is an outcome variable, and the others are covariates. . Let's define it first

bc$EXPOSURE<- bc$age
bc$M <- bc$wmi
bc$cov1<- bc$chf
bc$cov2<- bc$sex
bc$cov3<- bc$diabetes

This article is a reprinted article. The full text address is as follows: https://mp.weixin.qq.com/s?__biz=MzI1NjM3NTE1NQ==&mid=2247489118&idx=1&sn=17f8f050e61f6876a09a564a9fe48492&chksm=ea26f642dd517f54523f24 510bea72448debd14134e5d0b7f820a01dd1edfff4d6e85ac54eb2#rd

Guess you like

Origin blog.csdn.net/dege857/article/details/132779333