wwiecek / baggr

R package for Bayesian meta-analysis models, using Stan
GNU General Public License v3.0
46 stars 12 forks source link

Full pooling and a single study #178

Open wwiecek opened 1 year ago

wwiecek commented 1 year ago

Right now you can't do this:

fe7n <- baggr(schools[1:7,], pooling = "full")
fe8u <- baggr(schools[8, ], pooling = "full",
              prior_hypermean = normal(treatment_effect(fe7n, s=T)$tau[["mean"]],
                                       treatment_effect(fe7n, s=T)$tau[["sd"]]))

(1) for fe8u you get:

Automatically chose Rubin model with aggregate data based on input data.
Error in prepare_prior(prior, data, stan_data, model, pooling, covariates,  : 
  You must specify hyper-SD prior manually when data has only one row.

But in full pooling there is no problem, prior_hypersd is not needed at all. So let's fix that error message and write some unit tests that cover both the old and new cases.

(2) for fe7n you get

Setting hyper-SD prior using 10 times the naive SD across sites
* hypersd [sigma_tau] ~ uniform(0, 112)

But that prior is meaningless! It's kind of OK that it gets set and stored, but it's not used, so the user should not be seeing this message. (Although best would be to not set it at all.)