# [R-sig-ME] INterpretation and use of parameters from beta glmmadmb - apology

Emmanuel Charpentier emm.charpentier at free.fr
Wed Nov 21 09:21:38 CET 2012

```By the way, the mean of a beta(a, b) is a/(a+b) (semi-obvious) and the
variance is ab/((a+b)^2*(a+b+1)) (less obvious, but maxima dixit).

Still according to maxima, this pair of equations leads to:
a=m*(v+m*(1-m))/v and b=(m-1)*(v+m*(1-m))/v
after a slight cosmetic rearrangement.

HTH,

Emmanuel Charpentier

Le Wed, 21 Nov 2012 03:54:48 +0000, Ben Bolker wrote:

> Biuw, Martin <Martin.Biuw at ...> writes:
>
>> Hi all, I¡¯m using glmmADMB to fit a mixed model with a beta famiily,
>> and I would like some clarification on how to interpret the parameter
>> estimates. Specifically, I would like to use the results as input into
>> the R function ¡®dbeta¡¯, but I¡¯m not sure what in the glmmadmb output
>> corresponds to the shape1 and shape2 parameters of dbeta. I¡¯m assuming
>> the ¡®alpha¡¯, ¡®b¡¯ and ¡®stdbeta¡¯
>> components are the ones to go for. But which is which?
>
>> According to the dbeta help page, shape1 and shape2 corresponds to
>> alpha and beta respectively in the beta density function:
>> gamma(alpha+beta)/(gamma(alpha)gamma(beta))x^(alpha-1)(1-x)^(beta-1)
>> But how do these correspond to the ¡®alpha¡¯ (dispersion parameter) and
>> ¡®b¡¯ in the glmmadmb output? I get the most realistic results (when
>> comparing to the distribution of my data) if I let the the ¡®alpha¡¯
>> corresponds to shape2 (i.e. ¥â in the above expression) and ¡®b¡¯ to
>> shape1 (¥á in the expression). Maybe I¡¯m only being confused by the
>> nomenclature? But if I¡¯ve understood the maths behind the beta
>> distribution properly, when shape1 is greater than shape2 the
>> distribution is left-skewed, and the dispersion is determined by the
>> ratio shape2/shape1. And vice versa for a right-skewed distribution. So
>> how can I determine which goes in as shape1 and shape2 when calculating
>> my beta densities?
>
> We need a parameterization that separates the mean and the variance, for
> example as in the parameterization underlying the beta-binomial in
> Morris (1997), American Naturalist 150:299-327 (not quite the same thing
> but a parallel situation).
>
> Looking at the guts of the TPL (model definition) file we find:
>
>
>   df1b2variable ln_beta_density(double y,const df1b2variable & mu,
>     const df1b2variable& phi)
>   {
>     df1b2variable omega=mu*phi;
>     df1b2variable tau=phi-mu*phi;
>     df1b2variable lb=betaln(omega,tau);
>     df1b2variable d=(omega-1)*log(y)+(tau-1)*log(1.0-y)-lb;
>     return d;
>   }
>
> Where mu is the mean (as determined from a logit-linked linear model)
> and phi is the dispersion parameter.  Thus omega and tau are the shape
> parameters ...
>
> _______________________________________________
> R-sig-mixed-models at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models

```