# How to apply glm(generalized linear model) in this simple example?

We are given
1) Y = $(Y_1,Y_2,...,Y_n)^T$ ~ Exponential
2) E[Y] = $\mu$ = X$\beta$, where X $\in R^{nxr}$ and $\beta \in R^r$

My question is can we apply the glm in this case? The case where the canonical link does not relate $\mu$ and $X\beta$. If the answer is Yes, then how? if no, then what is the suitable modelling technique instead?

In addition, if we are given Y = $(Y_1,Y_2,...,Y_n)^T$ ~ Poisson or Inverse Gaussian instead, how can we apply glm?

Since you have $\mu = X\beta$ this is the identity link.

To fit an exponential GLM, you fit a gamma GLM but instead of estimating the dispersion parameter $\phi$ from the data, you specify that it's 1.

This doesn't affect the parameter estimation, only the standard errors.

[Consequently in R you simply specify the dispersion parameter when calling summary (summary(myExpGLMfitobject,dispersion=1)) . See ?summary.glm.]

For the Poisson and Inverse Gaussian cases you simply specify the relevant family. [In R, see ?family.]

• Yes this is the identical link, which is why precisely it is NOT the canonical link, since in the case where y's are exponentially distributed, the canonical link should be inverse. – mathguy Jul 22 '16 at 13:46
• Btw, in r, is there anyway to specify the link function no matter how ridiculous the link function is? Like what if somebody suspects the link function in the data to be arcsin(E(y)) = Xb? – mathguy Jul 22 '16 at 13:48
• @mathguy you can write your own link function (you also supply some other things along with it, such as the inverse link). The help on family contains an example for the binomial. Beware, however that as you move away from the canonical link (in some sense), the easier it becomes to encounter difficulties in optimizing the likelihood. (Good starting points will often help, but some of the potential problems are inherent). – Glen_b Jul 23 '16 at 2:20