[R-pkg-devel] How to obtain intercept of intercept-only glm in Fortran?
Michael Weylandt
m|ch@e|@wey|@ndt @end|ng |rom gm@||@com
Sat May 11 16:48:35 CEST 2019
On Sat, May 11, 2019 at 8:28 AM Wang, Zhu <wangz1 using uthscsa.edu> wrote:
>
> I am open to whatever suggestions but I am not aware a simple closed-form
> solution for my original question.
>
>
It would help if you could clarify your original question a bit more, but
for at least the main three GLMs, there are closed form solutions, based on
means of y. Assuming canonical links,
- Gaussian: intercept = mean(y)
- Logistic: intercept = logit(mean(y)) [Note that you have problems here
if your data is all 0 or all 1]
- Poisson: intercept = log(mean(y)) [You have problems here if your data is
all 0]
(Check my math on these, but I'm pretty sure this is right.)
Like I said above, this gets trickier if you add observation weights or
offsets, but the same ideas work.
Stepping back to the statistical theory: GLMs predict the mean of y,
conditional on x. If x doesn't vary (intercept only model), then the GLM is
just predicting the mean of y and the MLE for the mean of y is exactly that
under standard GLM assumptions - the sample mean of y.
We then just have to use the link function and its inverse to transform to
and from the observation space (where mean(y) lives) and the linear
predictor space (where the intercept term naturally lives).
Michael
[[alternative HTML version deleted]]
More information about the R-package-devel
mailing list