View source: R/predict_support.R
predict.pspfit | R Documentation |
psNormal
, psBinomial
, psPoisson
Prediction function which returns both linear
predictor and inverse link predictions at arbitrary data locations
(using psNormal
, psBinomial
, psPoisson
with class pspfit
).
## S3 method for class 'pspfit'
predict(object, ..., x, type = "mu")
object |
an object using |
... |
other parameters. |
x |
a scalar or vector of arbitrary |
type |
the mean value |
pred |
the estimated mean (inverse link function) (default)
or the linear predictor prediction with |
Paul Eilers and Brian Marx
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.
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.