Evaluates a multistep type function at a given value
Usage
## S3 method for class 'multistep'
predict(object, newx, ...)
## S3 method for class 'multistep'
e1 * e2
Arguments
object
A multistep object.
newx
Values to evaluate the represented function at. Each row is considered to be a separate observation.
...
Additional arguments for compatibility.
e1
Either a multistep object or a matrix to evaluate it at.
e2
Either a multistep object or a matrix to evaluate it at. One of e1, e2 must be a matrix, or vector.
Value
Produces a vector of results.
Note
predict(object, newx) is equivalent to object * newx, which is also equivalent to newx * object.
Author(s)
Zhou Fang
See Also
multistep
Examples
## Produces a 2d step function
set.seed(79)
n <- 100; p <- 2
## Choose some random knots
x <- matrix(runif(n * p, min = -2.5, max = 2.5), nrow = n, ncol = p)
obj = multistep(rep(0.1, (n-1)*p), x)
x2 <- matrix(runif(n * p, min = -2.5, max = 2.5), nrow = n, ncol = p)
predict(obj,x) - obj*x