plot.amlps {blapsr} | R Documentation |
Plot smooth functions of an additive model object.
Description
Displays a plot of the fitted additive smooth components of an
amlps
object. The routine can also be used to
print a table of point and set estimates of an additive smooth term for a
user-specified grid of values.
Usage
## S3 method for class 'amlps'
plot(x, xp, smoo.index, cred.int = 0.95, plot.cred = TRUE,
np = 100, fit.col = "blue", shade.col = "gray75", show.plot = TRUE,
show.info = TRUE, ...)
Arguments
x |
An object of class |
xp |
A numeric vector of grid values on which to compute a point estimate
and pointwise credible interval for the smooth function specified in
|
smoo.index |
The index of the smooth function. For instance
|
cred.int |
The level of the pointwise credible interval to be
computed for the smooth additive term. Default is |
plot.cred |
Logical. Should the credible intervals be plotted?
Default is |
np |
The number of points used to construct the plot of the smooth additive function. Default is 100 and allowed values are between 20 and 200. |
fit.col |
The color of the fitted curve. |
shade.col |
The shading color for the credible intervals. |
show.plot |
Logical. Should the plot be displayed? Default is
|
show.info |
Logical. Should the table of point and set estimates of
the smooth function on the specified |
... |
Further arguments to be passed to |
Details
Produces a plot of a smooth additive term fitted with the
amlps
function. On the y-axis, the estimated effective
dimension of the smooth term is also displayed. At the bottom of each
plot, vertical ticks indicate the location of the covariate values. The
labels on the x-axis correspond to the covariate name associated to the
smooth term.
Value
If xp
is unspecified (the default), the routine will only
return a plot of the estimated smooth curve. Otherwise, it provides a
list with the following components:
xp |
The chosen points on which to compute the smooth fit. |
sm.xp |
The estimated smooth fit at points specified in |
sm.low |
The lower bound of the pointwise credible interval for the
smooth additive function at points specified in |
sm.up |
The upper bound of the pointwise credible interval for the
smooth additive function at points specified in |
cred.int |
The chosen level to compute credible intervals. |
smoo.index |
The index of the smooth function. |
Author(s)
Oswaldo Gressani oswaldo_gressani@hotmail.fr.
See Also
amlps
, amlps.object
,
print.amlps
Examples
### Classic simulated data example
set.seed(3)
sim.data <- simgamdata(setting = 2, n = 200, dist = "gaussian", scale = 0.3)
plot(sim.data) # Scatter plot of response
data <- sim.data$data # Simulated data frame
# Fit model
fit <- amlps(y ~ z1 + z2 + sm(x1) + sm(x2), data = data, K = 20)
fit
# Plot fit of second function and results for a specific grid x
plot(fit, xp = c(-0.8, -0.4, 0, 0.4, 0.8), smoo.index = 2, ylim=c(-3, 3))