Dustin
Dustin

Reputation: 323

Is there a simple solution for plotting the interaction effect from a class RMA or RMA.MV?

I have used the rma.mv() function from the 'metafor' package. Now I would like to plot the interaction effects.

I have tried various solutions and the one that seems closest is the plot_model function from package 'sjPlot'. This will work when I do a lm but not with my actual rma.mv. My first question is does this even matter, if it is just the interaction I am concerned about? If so, my follow up question is how do I actually do it with class RMA or RMA.MV?

I have real (yet greatly reduced and simplified data set) like this;

LRRs.long<-structure(list(fullname = structure(c(1L, 1L, 1L, 2L, 2L, 2L, 
3L, 3L, 3L), .Label = c("Argemone glauca", "Bacopa monnieri", 
"Chenopodium oahuense"), class = "factor"), Treat = structure(c(1L, 
2L, 3L, 1L, 2L, 3L, 1L, 2L, 3L), .Label = c("10", "20", "35"), class = "factor"), 
    LRR = c(-0.954455598177961, -3.43398720448515, -3.43398720448515, 
    -0.206947246533427, -1.33340726127878, -3.59401011726068, 
    -0.0387710980425032, -0.7914266867076, -4.47267908945549), 
    LRR_var = c(0.336731047497513, 0.00631364800243193, 0.00631364800243193, 
    0.0106766272234543, 0.0245128677435665, 0.230755613454606, 
    0.00381238394178319, 0.0248419470726316, 0.00260356604424191
    ), Seedmass = c(0.0026402, 0.0026402, 0.0026402, 3.3e-05, 
    3.3e-05, 3.3e-05, 0.000234175, 0.000234175, 0.000234175)), row.names = c(1L, 
2L, 3L, 4L, 5L, 6L, 10L, 11L, 12L), class = "data.frame")

I tried;

library(metafor)
mass.initial.i<-rma.mv(LRR, LRR_var, mods=~Seedmass*Treat, random= list(~1|fullname), method="ML",digits=4,data=LRRs.long) # see struct = "CAR"
summary(mass.initial.i)
class(mass.initial.i)

mass.initial.Noi<-rma.mv(LRR, LRR_var, mods=~Seedmass + Treat, random= list(~1|fullname), method="ML",digits=4,data=LRRs.long) # see struct = "CAR"

anova(mass.initial.i, mass.initial.Noi)

library(sjPlot)
theme_set(theme_sjplot())
plot_model(mass.initial.i, type = "int")

And I get the error message; "Error: No interaction term found in model." But If I run a lm, e.g.;

lm.mass.initial.i<-lm(LRR ~ Seedmass * Treat -1, data=LRRs.long)
summary(lm.mass.initial.i)
class(lm.mass.initial.i)

Then feed that into plot_model(), e.g.;

plot_model(lm.mass.initial.i, type = "int")

It works just fine. Any help is greatly appreciated!

Upvotes: 2

Views: 97

Answers (0)

Related Questions