plotnpc {sglg} | R Documentation |
Plotting a natural cubic splines or P-splines.
Description
plotnpc
displays a graph of a fitted nonparametric effect, either natural cubic spline or P-spline, from an object of class sglg.
Usage
plotnpc(fit, conf_lev)
Arguments
fit |
an object of the class sglg. This object is returned from the call to glg(), sglg(), survglg() or ssurvglg(). |
conf_lev |
is the confidence level of the asymptotic confidence band. Default value is 0.05. |
Author(s)
Carlos Alberto Cardozo Delgado <cardozorpackages@gmail.com>
References
Eilers P.H.C. and Marx B.D. (1996). Flexible smoothing with B-splines and penalties. Statistical Science. 11, 89-121.
Wood, S. (2017). Additive generalized models: An R introduction. Chapman and Hall.
Examples
set.seed(1)
n <- 300
error <- rglg(n,0,0.5,1)
t <- as.matrix((2*1:n - 1)/(2*n))
colnames(t) <- "t"
f_t <- cos(4*pi*t)
y <- 0.8 + f_t + error
colnames(y) <- "y"
data <- as.data.frame(cbind(y,1,t))
fit1 <- sglg(y ~ 1,npc=t,data=data,basis = "deBoor",alpha0=0.0001)
summary(fit1)
# The adjusted (black) non-linear component
plotnpc(fit1,conf_lev=0.02)
[Package sglg version 0.2.2 Index]