[R-meta] Metafor modeling question
Dear Yuhang, Please see below for my answers. Best, Wolfgang
-----Original Message-----
From: R-sig-meta-analysis [mailto:r-sig-meta-analysis-bounces at r-project.org] On
Behalf Of Yuhang Hu via R-sig-meta-analysis
Sent: Sunday, 26 March, 2023 6:28
To: R meta
Cc: Yuhang Hu
Subject: [R-meta] Metafor modeling question
Dear All,
I have two questions about the following model:
mm <- rma.mv(y ~ SES, V, random = list(~SES|study, ~SES|outcome), struct =
c("GEN","GEN"))
fit to a dataset structurally similar to:
study outcome SES
1 A 1.5
1 A 1.7
1 B 1.5
1 B 1.7
2 A 2.1
3 A 1.1
3 A 2.3
3 B 1.1
3 B 2.3
Question 1: I know, if I used: "random = list(~1 | study, ~1| outcome)",
then 'study' and 'outcome' would be crossed, random effects. But are
'study' and 'outcome' in model 'mm' still crossed,
random effects? (In other words, can crossed random-effects have varying
coefficients in them)
Yes, they are crossed in this example.
Question 2: Is it possible (or useful) to plot residuals vs. fitted values for model 'mm'? If yes, how can we do that in metafor?
fitted(mm) gives you the fitted values and resid(mm) gives you the residuals, so you can just plot them against each other with plot(fitted(mm), resid(mm)) or you can use the standardized residuals on the y-axis with plot(fitted(mm), rstandard(mm)$z), since the residuals themselves are heteroscedastic, but the standardized residuals are ... well, standardized! Whether such a plot is useful is difficult to say in general, but I suppose it can be used in the same manner as it is used with primary data.
Many thanks for your help, Yuhang