Predict (or evaluate) a Spline Density.
predict.SplineDensity.RdPredict (or evaluate) a Spline Density.
Usage
# S3 method for SplineDensity
predict(object, newdata = NULL, deriv = 0, ...)Arguments
- object
-
A
SplineDensityobject. - newdata
-
Numeric vector giving the values where the density (or its derivative) will be evaluated.
- deriv
-
Integer giving the a derivation order. It can be set to \(-1\) to get the indefinite integral.
- ...
-
Not used yet.
Value
A list containing two numeric vectors x and y
representing the prediction abscissae and the corresponding predicted values.
Details
The density or one of its derivatives or the cumulative distribution
function is evaluated at the points given in newdata.
Examples
set.seed(1234)
SD <- rSplineDensity(order = 4, xmax = 10)
#> Warning: Recycling array of length 1 in vector-array arithmetic is deprecated.
#> Use c() or as.vector() instead.
xg <- seq(from = -1, to = 11, length.out = 200)
p <- predict(SD, newdata = xg)
plot(p, type = "l", main = "density")
pm1 <- predict(SD, newdata = xg, deriv = -1)
plot(pm1, type = "l", main = "cdf")