Description Usage Arguments Details Value Author(s) Examples
According to Lovison (2014), if the link function is correctly specified then there is a linear relationship between the working response variable z and the linear predictor eta. This plot suggests if the link function is appropriate.
1 |
model |
a model supported by |
smooth |
logical, whether to plot a smoothing spline. |
xlab |
title for the x axis. |
ylab |
title for the y axis. |
main |
an overall title for the plot. |
pch |
type of points. |
lcol |
color of the smoothing line. |
lwd |
size of the smoothing line. |
... |
further arguments passed to |
The assumption behind the output plot is that the model is correctly specified. In the y-axis there is the working response variable while on the x-axis there is the linear predictor: the more their relationship is linear the more appropriate the link function should be.
Doesn't return a value, called for side effects.
Giuseppe Reale
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | ## Simulate the data
set.seed(5)
n.obs <- 100
x <- rnorm(n.obs)
shape <- 25
mu <- exp(1 + .5* x)
y <- rgamma(n.obs, rate = shape / mu, shape = shape)
true.mod <- glm(y ~ x, family = Gamma(link = 'log'))
wrong1 <- glm(y ~ x, family = Gamma(link = 'inverse'))
wrong2 <- glm(y ~ x, family = Gamma(link = 'identity'))
par(mfrow = c(2, 2))
linkLin(true.mod)
linkLin(wrong1)
linkLin(wrong2)
par(mfrow = c(1, 1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.