plot.ps2dglm {JOPS}R Documentation

Plotting function for ps2DGLM

Description

Plotting function for 2D P-spline (GLM) smooothing (using ps2DGLM with class ps2dglm).

Usage

## S3 method for class 'ps2dglm'
plot(x, ..., xlab = " ", ylab = " ", Resol = 100, se = 2)

Arguments

x

the P-spline object, usually from ps2DGLM.

...

other parameters.

xlab

label for the x-axis, e.g. "my x" (quotes required).

ylab

label for the y-axis, e.g. "my y" (quotes required).

Resol

resolution for plotting, default Resol = 100.

se

a scalar, e.g. se = 2 to produce twice se surfaces, set se > 0 (or set se = 0 to supress).

Value

Plot

a plot of the mean (inverse link) 2D P-spline (GLM) smooth surface.

Author(s)

Paul Eilers and Brian Marx

References

Eilers, P.H.C. and Marx, B.D. (2021). Practical Smoothing, The Joys of P-splines. Cambridge University Press.

Eilers, P.H.C., Marx, B.D., and Durban, M. (2015). Twenty years of P-splines, SORT, 39(2): 149-186.

Examples

library(fields)
library(JOPS)
# Extract data
library(rpart)
Kyphosis <- kyphosis$Kyphosis
Age <- kyphosis$Age
Start <- kyphosis$Start
y <- 1 * (Kyphosis == "present") # make y 0/1
fit <- ps2DGLM(
  Data = cbind(Start, Age, y),
  Pars = rbind(c(1, 18, 10, 3, .1, 2), c(1, 206, 10, 3, .1, 2)),
  family = "binomial"
)
plot(fit, xlab = "Start", ylab = "Age")
#title(main = "Probability of Kyphosis")

[Package JOPS version 0.1.19 Index]