predict.ps2dglm: Predict function for 'ps2DGLM'

View source: R/predict_support.R

predict.ps2dglmR Documentation

Predict function for ps2DGLM

Description

Prediction function which returns both linear predictor and inverse link predictions at arbitrary (x, y) data locations (using ps2DGLM with class ps2dglm).

Usage

## S3 method for class 'ps2dglm'
predict(object, ..., XY, type = "mu")

Arguments

object

an object using ps2DGLM.

...

other parameters.

XY

a matrix of arbitrary (x, y) locations for desired prediction.

type

the mean value type = "mu" (default) or linear predictor type = "eta".

Value

pred

the estimated mean (inverse link function) (default) or the linear predictor prediction with type = "eta", for arbitary (x, y) locations in XY.

Author(s)

Paul Eilers and Brian Marx

References

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

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

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", link = "logit")
predict(fit, XY = cbind(Start, Age)[1:5,])

JOPS documentation built on Sept. 8, 2023, 5:42 p.m.

Related to predict.ps2dglm in JOPS...