Learn R Programming

liso (version 0.2)

multistep: Multidimensional step functions

Description

Produces a multistep object

Usage

multistep(coefchain,x=NULL,intercept=0,sortedx = apply(x,2,sort),names = NULL, pinters=NULL,...)

Arguments

coefchain
Vector of step sizes at each observation point for each vector, concatentated as a single vector.
x
Matrix of observations coefchain corresponds to.
intercept
Intercept value. i.e. value of mean(f(x)).
sortedx
x sorted in each column.
names
Names to be assigned to covariates.
pinters
The values of the component functions at the left ends of each range.
...
Additional variables to be stored in the final object.

Value

  • Produces a multistep object.

Details

This function generates a multistep object, to represent a function that is the sum of right-continuous step functions on each input. Internally, the function is stored in a sparse format.

sortedx and pinters are calculated, if not provided.

Multistep objects may be plotted. They may also be evaluated at a particular vector value, or matrix of values, through the * operator or the predict function.

See Also

plot.multistep,summary.multistep,predict.multistep

Examples

Run this code
## Produces a 2d step function

set.seed(79)
n <- 100; p <- 2

## Pick 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)
obj * x2 - obj*x
image( outer(-50:50/10, -50:50/10, function(x,y) obj*c(x,y)))

Run the code above in your browser using DataLab