conreg-methods {cobs} | R Documentation |
Summary Methods for 'conreg' Objects
Description
Methods for conreg
objects
Usage
## S3 method for class 'conreg'
fitted(object, ...)
## S3 method for class 'conreg'
residuals(object, ...)
## S3 method for class 'conreg'
knots(Fn, ...)
## S3 method for class 'conreg'
lines(x, type = "l", col = 2, lwd = 1.5, show.knots = TRUE,
add.iSpline = TRUE, force.iSpl = FALSE, ...)
## S3 method for class 'conreg'
plot(x, type = "l", col = 2, lwd = 1.5, show.knots = TRUE,
add.iSpline = TRUE, force.iSpl = FALSE,
xlab = "x", ylab = expression(s[c](x)),
sub = "simple concave regression", col.sub = col, ...)
## S3 method for class 'conreg'
predict(object, x, deriv = 0, ...)
## S3 method for class 'conreg'
print(x, digits = max(3, getOption("digits") - 3), ...)
Arguments
object , Fn , x |
an R object of class |
type , col , lwd , xlab , ylab , sub , col.sub |
plotting arguments as in
|
show.knots |
logical indicating the spline knots should be marked additionally. |
add.iSpline |
logical indicating if an interpolation
spline should be considered for plotting. This is only used when it
is itself concave/convex, unless |
force.iSpl |
logical indicating if an interpolating spline is drawn even when it is not convex/concave. |
deriv |
for |
digits |
number of significant digits for printing. |
... |
further arguments, potentially passed to methods. |
Author(s)
Martin Maechler
See Also
conreg
, ....
Examples
example(conreg, echo = FALSE)
class(rc) # "conreg"
rc # calls the print method
knots(rc)
plot(rc)
## and now _force_ the not-quite-concave cubic spline :
plot(rc, force.iSpl=TRUE)
xx <- seq(-0.1, 1.1, length=201) # slightly extrapolate
## Get function s(x) and first derivative s'(x) :
yx <- predict(rc, xx)
y1 <- predict(rc, xx, deriv = 1)
op <- par(las=1)
plot(xx, yx, type = "l",
main="plot(xx, predict( conreg(.), xx))")
par(new=TRUE) # draw the first derivative "on top"
plot(xx, y1, type = "l", col = "blue",
axes = FALSE, ann = FALSE)
abline(h = 0, lty="1A", col="blue")
axis(4, col="blue", col.axis="blue", col.ticks="blue")
mtext("first derivative s'(.)", col="blue")
par(op)