# Bias in beta regression

I just wanted to check how good my Beta reg model was at recovering true values of the parameters, and I found surprisingly large differences. Same results when using the "betareg" package.

Here is an R code to simulate a Beta variable and to estimate a simple ("empty") Beta model.

Perhaps I have missed something obvious ... Any ideas?

Y = rbeta(n=1000, shape1=2, shape2=1.5)
hist(Y, freq=F, xlab='', ylab='', main='')
lines(density(Y, from=0, to=1), col='red')

fit = betareg(Y ~ 1)

mu = 1 / (1 + exp(-as.numeric(fit$coeff[1]))) pr = as.numeric(fit$coeff[2])

k = data.frame(true=c(2,1.5),mle=c(mu,pr))
rownames(k) = c('mean','precision')
k


Actually, the results obtained by beta regression are very accurate. Beta distribution as used in beta regression is reparametrized in terms of location $\mu = \alpha / (\alpha + \beta)$ and precision $\phi = \alpha + \beta$. So to obtain back the parameters of the standard beta distribution you need to take $\alpha = \phi\mu$ and $\beta = \phi(1-\mu)$, what gives you the desired estimates:

mu*pr
## [1] 2.108735
pr*(1-mu)
## [1] 1.489949


If you want to sample from the re-parametrized beta distribution you can use the rprop function from the extraDistr package (disclosure: I'm the author):

library(extraDistr)
Y = rprop(1000, 32, 0.37)
hist(Y, freq=F, xlab='', ylab='', main='')
lines(density(Y, from=0, to=1), col='red')

fit = betareg(Y ~ 1)

mu = 1 / (1 + exp(-as.numeric(fit$coeff[1]))) pr = as.numeric(fit$coeff[2])

k = data.frame(true=c(0.37, 32),mle=c(mu,pr))
rownames(k) = c('mean','precision')
k

• Many thanks! I completely forgot about the re-parameterization May 19, 2017 at 11:13
• Thanks @Tim for the clarification. Just two additional comments: Another worked example for the reparameterization is provided in stats.stackexchange.com/questions/114959/… And the next release of betareg will also contain a rbetar() function (with the _r_egression specification of the rbeta()) as well as a simulate() method for betareg objects. We are currently working on a revision and will hopefully release it in summer. May 19, 2017 at 15:01
• @AchimZeileis thanks for comment. I didn't notice the function! Btw thanks for a great package.
– Tim
May 20, 2017 at 19:05
• @Tim The function is currently hidden in the namespace and only in the development on R-Forge... or in other words: almost impossible to find ;-) But we will prepare a proper release. Re: Btw. Glad if the package is useful! May 20, 2017 at 19:21