Dear everybody! This is my very first post and I would appreciate it very much if somebody has time enough and could help me. I am currently working on a meta-analysis on sex differences in the association between air pollutants and cardiovascular mortality. I calculated a mixed effects model including an interaction of a factor (sex) and a continuous variable (publication year). However, I find it difficult to interpret the estimates, and I get stuck when I want to graph the results. Here are the code and the results. The continuous variable ?publication year? is called ?moderator? in my program. Question 1: Are my following interpretations correct? The Test of moderators shows that main effects and interaction term has no significant effect (p-value 0.3482), explaining no heterogeneity between studies (R2=0%). The interaction between sex and publication year is not significant (pval=0.3176). Meaning of model results: Intercept ? estimate for men, when moderator (=publication year) = 0 Moderator ? estimate for moderator (=publication year); with each 1 year that an article is published later, the average estimate for the association between air pollution and cardiovascular mortality increases by 0.0001 (not significant) Factor(sex)women ? estimate indicates the effect of women compared to men; women have a 0.2127 lower average mortality risk related to air pollutants than men (not significant) Moderator:factor(sex)women ? estimate indicate by how much the risk in women increases with each increase of one year of publication compared to men (0.0001 greater increase than men; not significant). Question 2: How can I present the results graphically? I would need an intercept and a slope for each sex group showing the change in the average mortality risk by a 1-year increase in publication year. I would calculate it from the model results: Intercept men: -0.1013 (estimate intrcpt) Slope men: 0.0001 (estimate moderator) Intercept women: -0.1013 ? 0.2127 (estimate intrcpt + estimate factor(sex)women) Slope women: 0.0001+0.0001 (estimate moderator + estimate moderator:factor(sex)women) However, I am not really convinced that this is correct. And I think there is a more elegant and easier way, isn?t there? I think it does not make sense to calculate a model without intercept (mods=~moderator:factor(sex)-1), which would give me the slopes, I guess, but then I have just a slope but no intercept. Thank you very much for your help in advance! Best, Ute Helmholtz Zentrum M??nchen Helmholtz Zentrum Muenchen Deutsches Forschungszentrum fuer Gesundheit und Umwelt (GmbH) Ingolstaedter Landstr. 1 85764 Neuherberg www.helmholtz-muenchen.de Aufsichtsratsvorsitzende: MinDir.in Prof. Dr. Veronika von Messling Geschaeftsfuehrung: Prof. Dr. med. Dr. h.c. Matthias Tschoep, Kerstin Guenther Registergericht: Amtsgericht Muenchen HRB 6466 USt-IdNr: DE 129521671 -------------- next part -------------- An HTML attachment was scrubbed... URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20210105/d2b9678f/attachment-0001.html> -------------- next part -------------- A non-text attachment was scrubbed... Name: image002.jpg Type: image/jpeg Size: 58972 bytes Desc: not available URL: <https://stat.ethz.ch/pipermail/r-sig-meta-analysis/attachments/20210105/d2b9678f/attachment-0001.jpg>
[R-meta] metafor: Interaction between a factor and a continous variable
2 messages · Kraus, Ute, Dr., Wolfgang Viechtbauer
1 day later
Dear Ute, Please see my responses below. Best, Wolfgang
-----Original Message----- From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-project.org] On Behalf Of Kraus, Ute, Dr. Sent: Tuesday, 05 January, 2021 10:56 To: r-sig-meta-analysis at r-project.org Subject: [R-meta] metafor: Interaction between a factor and a continous variable Dear everybody! This is my very first post and I would appreciate it very much if somebody has time enough and could help me. I am currently working on a meta-analysis on sex differences in the association between air pollutants and cardiovascular mortality. I calculated a mixed effects model including an interaction of a factor (sex) and a continuous variable (publication year). However, I find it difficult to interpret the estimates, and I get stuck when I want to graph the results. Here are the code and the results. The continuous variable ?publication year? is called ?moderator? in my program.
Just as a sidenote: It is better to post code/output as text and not as an inline image.
Question 1: Are my following interpretations correct? The Test of moderators shows that main effects and interaction term has no significant effect (p-value 0.3482), explaining no heterogeneity between studies (R2=0%). The interaction between sex and publication year is not significant (pval=0.3176).
Correct.
Meaning of model results: Intercept ? estimate for men, when moderator (=publication year) = 0
Correct.
Moderator ? estimate for moderator (=publication year); with each 1 year that an article is published later, the average estimate for the association between air pollution and cardiovascular mortality increases by 0.0001 (not significant)
Correct, but to be precise, the coefficient is the one for men.
Factor(sex)women ? estimate indicates the effect of women compared to men; women have a 0.2127 lower average mortality risk related to air pollutants than men (not significant)
Assuming that this is what 'beta' reflects, this is also correct.
Moderator:factor(sex)women ? estimate indicate by how much the risk in women increases with each increase of one year of publication compared to men (0.0001 greater increase than men; not significant).
Correct.
Question 2: How can I present the results graphically? I would need an intercept and a slope for each sex group showing the change in the average mortality risk by a 1-year increase in publication year. I would calculate it from the model results: Intercept men: -0.1013 (estimate intrcpt) Slope men: 0.0001 (estimate moderator) Intercept women: -0.1013 ? 0.2127 (estimate intrcpt + estimate factor(sex)women) Slope women: 0.0001+0.0001 (estimate moderator + estimate moderator:factor(sex)women)
This is all correct.
However, I am not really convinced that this is correct. And I think there is a more elegant and easier way, isn?t there?
You can use predict() and anova() to also obtain these results: predict(df, newmods = c(0,0,0)) predict(df, newmods = c(0,1,0)) predict(df, newmods = c(1,0,0), intercept=FALSE) predict(df, newmods = c(1,0,1), intercept=FALSE) anova(df, L=c(1,0,0,0)) anova(df, L=c(1,0,1,0)) anova(df, L=c(0,1,0,0)) anova(df, L=c(0,1,0,1)) Sidenote: This shows a bit of an inconsistency in how predict() and anova() works in metafor. For the former, the intercept is included in the linear combination by default (if the model actually has an intercept term) and its inclusion/exclusion is not controlled via the 'newmods' argument but by the 'intercept' argument, while in anova() one needs to specify a linear combination that also pertains to the intercept term.
I think it does not make sense to calculate a model without intercept (mods=~moderator:factor(sex)- 1), which would give me the slopes, I guess, but then I have just a slope but no intercept.
There is also a way to specify the model such that it gives the intercept and slope for both groups directly. Use: mods = ~ factor(sex) + factor(sex):moderator - 1
Thank you very much for your help in advance! Best, Ute Helmholtz Zentrum M??nchen Helmholtz Zentrum M?nchen Deutsches Forschungszentrum f?r Gesundheit und Umwelt (GmbH) Ingolst?dter Landstr. 1 85764 Neuherberg www.helmholtz-muenchen.de Aufsichtsratsvorsitzende: MinDir.in Prof. Dr. Veronika von Messling Gesch?ftsf?hrung: Prof. Dr. med. Dr. h.c. Matthias Tsch?p, Kerstin G?nther Registergericht: Amtsgericht M?nchen HRB 6466 USt-IdNr: DE 129521671