Hi! I’m currently implementing a Stan model using the Pystan interface and I have one of my parameters with a prior distribution \text{Beta}(\alpha_0,\beta_0 ). The parameter in question is usually calibrated with data such that the beta distribution has a specific mean and variance (currently, I just calculated \alpha_0 and \beta_0 separately and have my Stan code as `lambda_tests ~ beta(3.2, 9.43)`

), but I was wondering what the appropriate convention is for implementing this in my program? Should the Stan code take in \alpha_0 and \beta_0 as data (and the user chooses these by themselves)? Should it take in the desired mean and variance for the Beta distribution and calibrate \alpha_0 and \beta_0 accordingly from inside the model code? Is there a way to do this without making the prior dependant on data (Stan interprets this as likelihood and issues a warning)?

1 Like

The mean and variance of a beta density are not independent – if \mu is the mean then the variance is bounded above by \mu \cdot (1 - \mu). In regression settings where one wants to model the location of the beta density the breadth of the density is controlled not by the variance but rather by a concentration or disperation parameter. The Stan language includes includes the `beta_proportion`

density family which uses a concentration, or “sample size”, parameterization that would be appropriate.

The warning sounds like an unfortunate consequence of the over aggressive heuristics that were included in the most recent parser? If so they can be ignored.

1 Like

Thank you!