Question

Picking up on what should have been a question here rather than on the old Google Groups, I have been looking to parameterize a Beta-distributed linear model in PyMC, which Chris Fonnesbeck has suggested as being:

"just a reparameterization of the beta where \alpha = \mu \phi and \beta = (1-\mu) \phi. So, all you would need is something like: new_beta = Lambda('new_beta', lambda x=x, mu=mu, phi=phi: beta_like(x, mu*phi, (1-mu)*phi))"

which is great - my next question is where to plunk the linear model component, which I think should be on \mu, for example:

$$\mu = \exp(b_0+b_1x)$$

and with a gamma-distributed \phi:

phi = Gamma('phi', alpha=0.001, beta=0.001)

Is this correct? NB we're on PyMC2 here

Thanks Aaron

Was it helpful?

Solution

It depends on how you want your linear model to affect the beta model. As you have mu described here, it is not the mean of the beta, its just the normalizing constant of the mean. If you want alpha and beta described as the mean and variance of the beta, it is something like the following:

alpha = mu * (mu*(1-mu)/var - 1)
beta = (1 - mu) * (mu*(1-mu)/var - 1)

Maybe a simpler approach would be in terms of a mean mu and sample size nu:

alpha = mu * nu
beta = (1-mu) * nu
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top