Skip to content
Prev 2336 / 5636 Next

[R-meta] metafor - specifying spatial random effects

Dear Grace,

you need to create a variable that is a constant, so:

datasub$const <- 1

and then you can use:

random = ~ Longitude + Latitude | const

The post you are referring to is outdated. At that time, the rma.mv() function did not yet have spatial correlation structures. Now you can just use the 'struct' argument to specify the spatial correlation structure and the optimization is done for you.

With respect to your second question: To me, the choice (whether to include location as a fixed or a random effect) comes down to whether I am actually interested in differences between the specific locations that make up the spatial configuration of your data points (in which case I would use a fixed effect) or I just want to account for possible dependency due to the spatial configuration (in which case I would use a random effect).

Best,
Wolfgang