predict.unireg {uniReg} | R Documentation |
Predict method for unireg
objects.
Description
Predicted values based on a unimodal regression object.
Usage
## S3 method for class 'unireg'
predict(object, newdata, ...)
Arguments
object |
Object of class |
newdata |
A numeric vector of values at which to evaluate the fitted spline function. |
... |
Further arguments (currently not used). |
Details
predict.unireg
produces predicted values by evaluating the fitted regression spline function at the values in newdata
.
Value
Returns a numeric vector of predicted function values.
Author(s)
Claudia Koellmann
See Also
unireg
,plot.unireg
,points.unireg
Examples
x <- sort(rep(0:5,20))
n <- length(x)
set.seed(41333)
func <- function(mu){rnorm(1,mu,0.05)}
y <- sapply(dchisq(x,3),func)
# plot of data
plot(jitter(x), y, xlab="x (jittered)")
# fit with default settings
fit <- unireg(x, y, g=5)
# short overview of the fitted spline
fit
# prediction at interim values
predict(fit, c(1.5,2.5,3.5,4.5))
[Package uniReg version 1.1 Index]