I’m trying to fit a hierarchical model using rstanarm, and since my outcome variable is a proportion, I’m trying to use beta regression.
So I initially tried to just specify “Beta” in the family argument in stan_glmer:
library(rstanarm)
stan_glmer(p~ (1|group),family=Beta,data=plot.data)
This produced the following error message:
Error in stan_glm.fit(x = X, y = y, weights = weights, offset = offset, :
'family' must be one of binomial, gaussian, Gamma, inverse.gaussian, poisson, neg_binomial_2, Beta regression
This error message made me think I could just change the argument to “Beta regression” and then fit my model. However, this still didn’t work (error message included below):
> stan_glmer(p~ (1|group),family="Beta regression",data=plot.data)
Error in get(f, mode = "function", envir = parent.frame(2)) : object 'Beta regression' of mode 'function' was not found
I even tried all of the following iterations with no success:
stan_glmer(p~ (1|group),family="Beta.regression",data=plot.data)
stan_glmer(p~ (1|group),family="Beta_regression",data=plot.data)
stan_glmer(p~ (1|group),family="Betaregression",data=plot.data)
Finally, I ruled out the possibility that none of the distributions named my initial error message would work when plugged into the family argument. I know that this cannot be the case because this worked fine:
stan_glmer(p~ (1|group),family="gaussian",data=plot.data)
Despite the fact that the error message from my initial code suggested that I could specify a beta distribution with stan_glmer, is this actually not possible?