predict.multistep: Multidimensional step function evaluation

Description Usage Arguments Value Note Author(s) See Also Examples

View source: R/helper.R

Description

Evaluates a multistep type function at a given value

Usage

1
2
3
4
## 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

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## 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

liso documentation built on May 19, 2017, 4:46 p.m.

Search within the liso package
Search all R packages, documentation and source code