linkLin: Checking linearity of link function

Description Usage Arguments Details Value Author(s) Examples

View source: R/linkLin.R

Description

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.

Usage

1
linkLin(model, smooth = TRUE, xlab, ylab, main, pch, lcol, lwd, ...)

Arguments

model

a model supported by glmxdiag.

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 plot

Details

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.

Value

Doesn't return a value, called for side effects.

Author(s)

Giuseppe Reale

Examples

 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))

glmxdiag documentation built on Jan. 10, 2022, 9:07 a.m.

Related to linkLin in glmxdiag...