predict.pspfit {JOPS} | R Documentation |
Predict function for psNormal
, psBinomial
, psPoisson
Description
Prediction function which returns both linear
predictor and inverse link predictions at arbitrary data locations
(using psNormal
, psBinomial
, psPoisson
with class pspfit
).
Usage
## S3 method for class 'pspfit'
predict(object, ..., x, type = "mu")
Arguments
object |
an object using |
... |
other parameters. |
x |
a scalar or vector of arbitrary |
type |
the mean value |
Value
pred |
the estimated mean (inverse link function) (default)
or the linear predictor prediction with |
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(JOPS)
library(boot)
# Extract the data
Count <- hist(boot::coal$date, breaks = c(1851:1963), plot = FALSE)$counts
Year <- c(1851:1962)
xl <- min(Year)
xr <- max(Year)
# Poisson smoothing
nseg <- 20
bdeg <- 3
fit1 <- psPoisson(Year, Count, xl, xr, nseg, bdeg, pord = 2, lambda = 1)
names(fit1)
plot(fit1, xlab = "Year", ylab = "Count", se = 2)
predict(fit1, x = fit1$x[1:5])
predict(fit1, x = fit1$x[1:5], type = "eta")
[Package JOPS version 0.1.19 Index]