Learn R Programming

liso (version 0.2)

predict.multistep: Multidimensional step function evaluation

Description

Evaluates a multistep type function at a given value

Usage

## S3 method for class 'multistep':
predict(object, newx, \dots)
## 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.

See Also

multistep

Examples

Run this code
## 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

Run the code above in your browser using DataLab