Hi all, I have been trying to use nhanes data to do a mediation analysis. I tried mediation package first, but it can’t use the weights. I tried lavaan.survey package, but it doesn’t fit my logistics regression model. Any advice? Thx.
Hello @youlin and welcome to the forum!
If you have not already, please see the Survey analysis chapter of our Epi R Handbook, as it may have helpful tips for weighting.
Otherwise, perhaps you can post a small, anonymised example of your data and more about your desired output, using the {dpasta} package, as shown in this video?
@aspina may also have some advice.
yep you want to use the survey package (or the srvyr package which is a tidy-syntax wrapper), specifically the svyglm function
Thanks for your advice. I tried the survey package, but it doesn’t seem to support mediation analysis.
Thanks for your advice. I tried the survey and srvyr package, but they don’t seem to support mediation analysis.