Inverse gaussian family with stan_glmer?

Hi there,

I’m building a mixed effects model, where each simulated observation of an individual will be grouped by a “method” by which the response was simulated (input data are simulated, not observed).
Model specification is:

AAC ~ Days + (Days | method)

AAC is the ratio of a thermal power plant’s operational capacity (how much power did they generate in a day?) divided by the nameplate capacity (how much are they capable of generating?). Simulated observations are daily AAC for each power plant. For this toy experiment, assume there are only two days, which are consecutive.

In rstanarm, this looks like:

b <- stan_glmer(
  AAC ~ Days + (Days | method),
  family = gaussian(),
  data = all_test,
  prior = normal(0, 1, autoscale = TRUE),
  prior_intercept = normal(0, 1, autoscale = TRUE),
  prior_covariance = decov(regularization = 2),
  prior_aux = cauchy(0, 1, autoscale = TRUE), 
  cores = 4,
  iter = 2000,
  # reproducible blogging
  seed = 8675309
)

The challenge I’m confronted with is that the family of the distribution shouldn’t really be gaussian – I just modeled it like this to throw together a first model. I’d like to specify it like this with inverse gaussian, but executing this code does nothing – it doesn’t even execute:

b <- stan_glmer(
  AAC ~ Days + (Days | method),
  family = inverse.gaussian(),
  data = all_test,
  prior = normal(0, 1, autoscale = TRUE),
  prior_intercept = normal(0, 1, autoscale = TRUE),
  prior_covariance = decov(regularization = 2),
  prior_aux = cauchy(0, 1, autoscale = TRUE), 
  cores = 4,
  iter = 2000,
  # reproducible blogging
  seed = 8675309
)

Am I specifying the family correctly? I also tried defining a new response variable, log(AAC), but I see the same thing – model doesn’t execute. Plot shows partially pooled slopes (blue) with the data (black).

@betanalpha
SEcoal_methods_slopes_waterloew

Still relying on a normal prior :-/

Can someone more advanced than me in bayesian modeling point me to the better prior for this model to use in rstanarm?

The simulated lines (in figure, right) shouldn’t extend above 1.0.

@betanalpha ?
SWcoalRCepa

Apologies – I don’t have enough experience in rstanarm to offer any help. My advice would be to move to implementing the model in full Stan where you’ll have the flexibility to code up an inverse normal density without much difficulty. For example I implemented a few special cases in Some Ruminations on Containment Prior Modeling.

1 Like

Thanks for the direction to this case study!

1 Like