Hello,
Can you please help with the mediation test for hierarchical data?
Here are the variables:
- y: binary outcome
- m: binary mediator
- x: binary treatment variable
- c1, c2: covariates
- pat_id: patient id, indicating encounter data (a total of 13,236 rows) is clustered by patients (n~ 9900).
Before I ran the mediation test, I used mixed-effects models to examine X-Y association and X-M association. Then to investigate the possible mediation effect, I tried the mediate command below based on the recommendation of bootstrapping at https://library.virginia.edu/data/ar...ation-analysis.
1. mediate (y c1 c2, logit) (m c1 c2, logit) (x), vce (bootstrap, cluster(pat_id) reps (500) seed (1234))
Hello,
Can you please help with the mediation test for hierarchical data?
Here are the variables:
- y: binary outcome
- m: binary mediator
- x: binary treatment variable
- c1, c2: covariates
- pat_id: patient id, indicating encounter data (a total of 13,236 rows) is clustered by patients (n~ 9900).
However, vce(cluster) in mediate command cannot address the hierarchical data structure, so I tried gsem.
2. gsem (m <- x c1 c2 M1[pat_id], logit) (y <- x m c1 c2 M2[pat_id], logit), cov(M1[pat_id]*M2[pat_id]@0)
gsem, coeflegend
*indirect effect
nlcom _b[m:x]*_b[y:m]
*total effect
nlcom _b[y:x]+_b[m:x]*_b[y:m]
From the results, I calculated the proportion of total effect mediated as indirect effect 1.000/ total effect 1.448*100, which equals 69%. Do you have any concerns regarding this proportion?
Lastly, the bootstrapping takes very long. Do you have other suggestions?
3. bootstrap , reps(500) seed(1234): gsem (m <- x c1 c2 M1[pat_id], logit) (y <- x m c1 c2 M2[pat_id], logit), cov(M1[pat_id]*M2[pat_id]@0)
Thank you very much in advance.
Jungwon
Can you please help with the mediation test for hierarchical data?
Here are the variables:
- y: binary outcome
- m: binary mediator
- x: binary treatment variable
- c1, c2: covariates
- pat_id: patient id, indicating encounter data (a total of 13,236 rows) is clustered by patients (n~ 9900).
Before I ran the mediation test, I used mixed-effects models to examine X-Y association and X-M association. Then to investigate the possible mediation effect, I tried the mediate command below based on the recommendation of bootstrapping at https://library.virginia.edu/data/ar...ation-analysis.
1. mediate (y c1 c2, logit) (m c1 c2, logit) (x), vce (bootstrap, cluster(pat_id) reps (500) seed (1234))
Hello,
Can you please help with the mediation test for hierarchical data?
Here are the variables:
- y: binary outcome
- m: binary mediator
- x: binary treatment variable
- c1, c2: covariates
- pat_id: patient id, indicating encounter data (a total of 13,236 rows) is clustered by patients (n~ 9900).
However, vce(cluster) in mediate command cannot address the hierarchical data structure, so I tried gsem.
2. gsem (m <- x c1 c2 M1[pat_id], logit) (y <- x m c1 c2 M2[pat_id], logit), cov(M1[pat_id]*M2[pat_id]@0)
gsem, coeflegend
*indirect effect
nlcom _b[m:x]*_b[y:m]
*total effect
nlcom _b[y:x]+_b[m:x]*_b[y:m]
From the results, I calculated the proportion of total effect mediated as indirect effect 1.000/ total effect 1.448*100, which equals 69%. Do you have any concerns regarding this proportion?
Lastly, the bootstrapping takes very long. Do you have other suggestions?
3. bootstrap , reps(500) seed(1234): gsem (m <- x c1 c2 M1[pat_id], logit) (y <- x m c1 c2 M2[pat_id], logit), cov(M1[pat_id]*M2[pat_id]@0)
Thank you very much in advance.
Jungwon

Comment