rmodelingglmgamma-distributiongamma

In R, what is the default link function using the glm function with the gamma family


I have implemented a model using the glm() function and specifiy the family distribution as gamma:

glmer(FirstSteeringTime ~ error_rate + (1 + error_rate | pNum), family = Gamma, data = modellingdata)

I know that you can apply link functions such as "identity" or "log" to the gamma distributions. Thus I have two questions:

1) What is the default link function when I specify my model as I have without explicitly mentioned a link function?

2) What is the purpose of the different link functions? I'm confused as to the effect they have on my data...

Any help is most appreciated - thank you!


Solution

  • Typing args(Gamma) shows you the following:

    function (link = "inverse") 
    NULL
    

    That is, the canonical link function is the inverse link.

    As for the purpose of the link function it allows you to model non-linear relationships between your predictors and your response. In a simple linear regression you model the expected value directly as a linear combination of the predictors. In a glm on the other hand, you model a function of the expected value.

    The benefit of that is best seen with logistic regression. With the help of the link function you guarantee that the values are indeed between 0 and 1. Because without it some linear combinations may likely yield values outside this range.

    This questions is however very statistics related and is more appropriate on Cross Validated.