Multivariate meta analysis incorporating standard errors

Hi,

I have a (somewhat) a meta-analysis problem, where I want to estimate the effect and incorporate the standard errors.

The toy data are in a dput under this question

My (simplified) model looks something like this:

fit1 <- brm(estimate0 | se(ses0, sigma = TRUE) ~ 0 + Intercept,
            data = test_data, chains = 2, cores = 2,
            backend = "cmdstanr")

However, I would also like to have multivariate estimation for several parameters and their related standard errors.

So, something like this:


test_formula <- bf(
  estimate0 | se(ses0) ~ 0 + Intercept,
  estimate1 | se(ses1) ~ 0 + Intercept,
  estimate2 | se(ses2) ~ 0 + Intercept
)

fit2 <- brm(test_formula,
            data = test_data, chains = 2, cores = 2,
            backend = "cmdstanr")

But if I run it, I get the

Error: The parameter 'estimate1' is not a valid distributional or non-linear parameter. Did you forget to set 'nl = TRUE'?

error. And I am not entirely sure where should I put the nl = TRUE parameter. If I append it after the formula, I get the same error message.

Is this even possible to do in brms? Maybe I’m trying to do something that is simply not doable?

Thanks!

MacOS
brms_2.20.1
structure(list(estimate0 = c(-2.74876373618311, -2.97829517727648, 
-3.31587179960804, -2.74622067026356, -1.97689255696711, -2.38463858769863, 
-2.657051516499, -3.5771158198616), estimate1 = c(3.30028118767104, 
3.09510917773597, 2.47541717757146, 3.03921954392546, 2.73840806363676, 
2.53757808570781, 3.54507678579056, 4.46954149336329), estimate2 = c(1.72890925213394, 
2.75946765179713, 1.65250309785428, 0.949840140911668, -0.793179529482053, 
0.128334536390859, -0.984729153591692, 2.30698570416319), ses0 = c(0.729243965561863, 
0.591756617157621, 0.670143362916103, 0.389684055042382, 0.459217661595079, 
0.364738955731592, 0.261757424628417, 0.495091983220812), ses1 = c(0.943796250030539, 
0.617538169919119, 0.68466894862678, 0.533789454127428, 0.70084072236695, 
0.540122226154277, 0.471813632890032, 0.629923958348362), ses2 = c(1.87350515405701, 
2.01540207975469, 1.29377800859925, 1.27629805597475, 1.002161114072, 
0.985230655070162, 0.65625735868238, 1.80747985819466)), row.names = c(NA, 
-8L), class = c("tbl_df", "tbl", "data.frame"))

Hey Peter,
I think it’s just the multivariate bf syntax. Paul’s vignette is really helpful here: Estimating Multivariate Models with brms • brms

This ran for me, but note I had compilation issues with cmdstan:

test_formula_v2 <- mvbf(
  bf(estimate0 | se(ses0) ~ 0 + Intercept),
  bf(estimate1 | se(ses1) ~ 0 + Intercept),
  bf(estimate2 | se(ses2) ~ 0 + Intercept),
  rescor = T # may want this; brms asks you explicitly define anyways
)
get_prior(test_formula_v2, test_data)

# fit2 <- brm(test_formula_v2,
#             data = test_data, chains = 2, cores = 2,
#             backend = "cmdstanr")
# compilation issue?
# try w/o cmdstan
fit2 <- brm(test_formula_v2,
            data = test_data, chains = 2, cores = 2)
  # this compiles+runs now for me

Not sure what to make of the compilation error, but at least vanilla rstan backend worked fine on my machine (Windows 10; brms ver. 2.19.0).

Hope that helps

Super! Thank you very much!

I just missed the mvbf syntax.
And it compiled with cmdstanr no problem for me.

Thanks again!

1 Like