Mediation pathways and sample weights #350
-
Hi! Mediation Pathways:
Sample Weights:
Thank you. pg.mediation_analysis(data= df,
x='X’,
m=[‘M1’,’M2’],
y=‘Y’,
covar=[‘C1’,’C2’],
logreg_kwargs={'sample_weights':'Weights'}) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @sobhneek, One of the best reference I know on the topic of mediation is this paper: https://www.sciencedirect.com/science/article/abs/pii/S0005796716301887?via%3Dihub They recommend adding covariates to all the regressions in the mediation pathway, which is what Pingouin does. They also report a path diagram with covariates included for a single-mediator model: Regarding the pingouin/pingouin/regression.py Lines 890 to 898 in c22843f |
Beta Was this translation helpful? Give feedback.
Hi @sobhneek,
One of the best reference I know on the topic of mediation is this paper: https://www.sciencedirect.com/science/article/abs/pii/S0005796716301887?via%3Dihub
They recommend adding covariates to all the regressions in the mediation pathway, which is what Pingouin does. They also report a path diagram with covariates included for a single-mediator model:
Regarding the
sample_weights
, this will not work because thelogreg_kwargs
are passed to the LogisticRegression estimator but not to the.fit
method:pingouin/pingouin/regression.py
Lines 890 to 898 in c22843f