Termplots

An example for Termplot

The following screenshot demonstrates this with the example of different non-linear specifications of the effect of a predictor variable x on a response variable y. The data for this screenshot are generated so that the 'true' effect of x on y is .

Output of *Termplot*

This is how this plot was produced:

library(memisc)
library(splines)
xyz <- data.frame(
  x = 1:100,
  z = factor(rep(LETTERS[1:4],25))
)
xyz <- transform(xyz,
  y = rnorm(100,sin(x/10)+x/50+as.numeric(z))
)
yxz.lin <- glm(y ~ x + z, data=xyz)
yxz.bs <- glm(y ~ bs(x,6) + z, data=xyz)
yxz.ns <- glm(y ~ ns(x,6) + z, data=xyz)
yxz.poly <- glm(y ~ poly(x,6) + z, data=xyz)
yxz.sincos <- glm(y ~ sin(x/10) + cos(x/10) + x + z, data=xyz)

Termplot(yxz.lin,yxz.bs,yxz.ns,yxz.poly,yxz.sincos,variables="x", span.smth=1/3)