Specify different distributions for different parameters in glmfit

1 view (last 30 days)
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
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
Fral on 14 May 2013
I guess I didn't use the right terminology, or maybe I didn't understand glm correctly, so let me explain a bit more more.
b = glmfit(X,y,distr), the way I understood it, b is what you call beta, y the response, and X the predictor. From my understanding, distr says how y changes as a result of changes in X, where X is what I called parameters. You had it as y|x ~ F(mu(x),phi(x)).
The issue I'm having, is I think it should be
y|xi ~ Fi(...)
Where the distribution with which y changes as a result of changes in x depend on x. For example, in my model I have two types of parameters which I think should have different Fis. Maybe this is what you meant by the Bayesian approach?

Sign in to comment.


Peter Perkins
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.

Tags

Products

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!