Re: Using glmfit to estimate gamma mean AND variance



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.

.



Relevant Pages

  • Re: degrees of freedom for chi-square testing of goodness of fit
    ... With equal and known variance? ... You fit an exponential curve to a ... The chi-squared test is a hypothesis test. ... chi-squared distribution with k degrees of freedom, ...
    (sci.math)
  • Re: Probit analysis
    ... In a log-likelihood ratio test, you would fit the probit model ... compared with a chi-square distribution. ...
    (sci.stat.math)
  • Re: Goodness of fitting of a distribution
    ... plot that points out that the best distribution that fit my data is a ... linear combination of a weibull and a normal distribution. ... I don't need to read your Berkeley Symposium to know that the K-S ... it is the large number of bins which reduces the ...
    (sci.stat.math)
  • Re: Goodness of fitting of a distribution
    ... plot that points out that the best distribution that fit my data is a ... linear combination of a weibull and a normal distribution. ... It is the chi-squared test with many classes which has ... it is the large number of bins which reduces the ...
    (sci.stat.math)
  • Re: how many bins for goodness of fit
    ... hypothesized distribution, even if they are of no meaning. ... discovered this when it didn't fit for 10000 observations but did fit ... the higher ups that the RNG was working. ... the bins, and so can lose much power. ...
    (sci.stat.math)