Re: Using glmfit to estimate gamma mean AND variance
- From: Sameh <samehm@xxxxxxxxx>
- Date: Mon, 22 Dec 2008 07:31:21 -0800 (PST)
Hi Peter,
Thank you so much for the reply.
You are right. I am trying to fit a regression model, and the
distribution I'm trying to fit is gamma. I can use glmfit to estimate
the betas, and glmval to calculate the predicted values, E(mu), for a
new predictor vector X. I was wondering, however, how to calculate the
variance of the mean Var(mu) to be able to estimate BOTH parameters of
a gamma distribution for that vector. Does that make sense?
Thank you again for your help.
Sam
On Dec 22, 9:50 am, Peter Perkins
<Peter.PerkinsRemoveT...@xxxxxxxxxxxxx> wrote:
Sameh wrote:
I am trying to use glmfit to estimate both parameters of a gamma
distribution. I have found out that I can use glmval to compute the
mean for any test X after the fitting is done, but I cannot compute
its variance. What I am trying to do is to, given a certain X,
estimate the gamma distribution that most likely fits the distribution
that X is from.
Sam, ordinarily GLMFIT is used to fit a regression model, not a single distribution. To fit a gamma distribution to data, you'd want to use GAMFIT. I can't tell which of those things you're after, but since youmention something that sounds like a predictor variable, I'll assume you mean regression.
GLMs have the concept of a link function and a variance function. You get to pick the link (for a gamma, it's the reciprocal by default), and that determines the mean as a function of X*beta. The distribution you're fitting determines the variance, and in this case the variance function is mu^2. There's also the dispersion parameter, which scales the variance function to give you the actual variance. That's the 's' field (you have to square it for variance) in the stats output from GLMFIT. So the variance is a function of the mean, scaled by the dispersion.
Hope this helps.
.
- Follow-Ups:
- Re: Using glmfit to estimate gamma mean AND variance
- From: Peter Perkins
- Re: Using glmfit to estimate gamma mean AND variance
- References:
- Using glmfit to estimate gamma mean AND variance
- From: Sameh
- Re: Using glmfit to estimate gamma mean AND variance
- From: Peter Perkins
- Using glmfit to estimate gamma mean AND variance
- Prev by Date: Re: old MEX files Matlab 2008 and Ubuntu 8.10
- Next by Date: cepstrum analysis
- Previous by thread: Re: Using glmfit to estimate gamma mean AND variance
- Next by thread: Re: Using glmfit to estimate gamma mean AND variance
- Index(es):
Relevant Pages
|