# 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))) pr = as.numeric(fit$coeff)

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
##  2.108735
pr*(1-mu)
##  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))) pr = as.numeric(fit$coeff)

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
{"ft_lang_label":"__label__en","ft_lang_prob":0.730475,"math_prob":0.9801456,"size":641,"snap":"2022-27-2022-33","text_gpt3_token_len":196,"char_repetition_ratio":0.07849293,"word_repetition_ratio":0.0,"special_character_ratio":0.3322933,"punctuation_ratio":0.17449665,"nsfw_num_words":0,"has_unicode_error":false,"math_prob_llama3":0.99892914,"pos_list":[0],"im_url_duplicate_count":[null],"WARC_HEADER":"{\"WARC-Type\":\"response\",\"WARC-Date\":\"2022-07-02T11:45:49Z\",\"WARC-Record-ID\":\"<urn:uuid:84f9187a-95ae-4110-b8a2-ca19c734e1fa>\",\"Content-Length\":\"228863\",\"Content-Type\":\"application/http; msgtype=response\",\"WARC-Warcinfo-ID\":\"<urn:uuid:45b35b30-ef6d-4920-981f-a9ad3d8989d9>\",\"WARC-Concurrent-To\":\"<urn:uuid:2b7a1f07-3b08-4ae3-abc4-dbad3dddfd6f>\",\"WARC-IP-Address\":\"151.101.193.69\",\"WARC-Target-URI\":\"https://stats.stackexchange.com/questions/280498/bias-in-beta-regression\",\"WARC-Payload-Digest\":\"sha1:BQQKF7OKGIUXIIPOSE7UXMFOWZT3DPQJ\",\"WARC-Block-Digest\":\"sha1:V3JGGPGSMVPEWXW5FEK2PXJY3GCKC6YB\",\"WARC-Identified-Payload-Type\":\"text/html\",\"warc_filename\":\"/cc_download/warc_2022/CC-MAIN-2022-27/CC-MAIN-2022-27_segments_1656104054564.59_warc_CC-MAIN-20220702101738-20220702131738-00342.warc.gz\"}"}