Specify different distributions for different parameters in glmfit
Show older comments
Hi,
The parameters in my GLM model have different distributions. Some are normal, others are Poisson. I'm wondering whether I can specify distributions specific to a parameter. I know that I can specify my own distribution function, so I was thinking that maybe I can use my own function to select between the alternating parameters. But how would I know which parameter glm is fitting when it calls my function?
Thanks in advance.
Answers (2)
Peter Perkins
on 14 May 2013
In the usual notation and terminology, a GLM is specified as
mu(x) = E[y|x] = h(x*beta)
y|x ~ F(mu(x),phi(x))
where beta is a column of location parameters, phi is the dispersion parameter, x is a vector of predictors variables, y is the response variable, h is the inverse link function, and F is a distribution. beta and phi are unknowns to be estimated. That's the model that glmfit fits.
If you're thinking of those parameters as themselves having distributions, then that's a Bayesian model. That's fine, but it's not what glmfit does. Perhaps by "parameters", you mean something else?
1 Comment
Fral
on 14 May 2013
Peter Perkins
on 15 May 2013
> From my understanding, distr says how y changes as a result of changes in X
No. The distribution in a GLM describes the random variation in y. The link function and the regression coefficients (beta) describe how y depends on x. The distribution has no effect on how y depends on x, except that glmfit uses the csnonical link by default, so in effect, specifying a distribution also specifies the link.
Your original question asked about distributions on "parameters". One way to interpret that is that you meant that you want beta to be a random variable. That's a Bayesian approach, and glmfit doesn't do that. This:
> y|xi ~ Fi(...)
sounds like you want each element of the response vector to have a different distribution. If I understand your notation correctly, that's not a GLM either. But then you say
> Where the distribution with which y changes as a result of changes in x depend on x
and again, in a GLM, all of the dependency of y on x is captured by
E[y] = h(x*beta)
So I can't tell what you're asking. Sorry.
Categories
Find more on Univariate Discrete Distributions in Help Center and File Exchange
Products
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!