Description Usage Arguments Details Value Author(s) See Also Examples
Predicted values based on a unimodal regression object.
1 2 |
object |
Object of class |
newdata |
A numeric vector of values at which to evaluate the fitted spline function. |
... |
Further arguments (currently not used). |
predict.unireg
produces predicted values by evaluating the fitted regression spline function at the values in newdata
.
Returns a numeric vector of predicted function values.
Claudia Koellmann
unireg
,plot.unireg
,points.unireg
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 | 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))
|
Fitted unimodal spline of degree 3 with difference penalty of order 2
Coefficients -0.21 0.03 0.23 0.23 0.18 0.13 0.09 0.07 0.05
Mode of coefficients 3 4
Tuning parameter 20.09
Variance estimate 0
[1] 0.22276705 0.18015210 0.12398603 0.08550933
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.