NIR: Near-Isotonic Regression

Description Usage Arguments Details Value Author(s) References Examples

Description

These functions are the main interface functions for calculating Nearly-isotonic solutions

Usage

1
2
3
neariso(y, maxBreaks=100, lambda=NULL)
nearisoGetBreakpoints(nearisoPathObj, maxBreaks=100)
nearisoGetSolution(nearisoPathObj, lambda=nearisoGetBreakpoints(nearisoPathObj))

Arguments

y

response variable; numeric

lambda

penalty parameter vector (non-negative) for the difference of coefficients; numeric

nearisoPathObj

Solution object of class nearisoPath as returned by nir

maxBreaks

maximum number of breakpoints the function should return

Details

neariso is the main function to calculate a Nearly-isotonic regression fit and returns an object of class nearisoPath. If lambda=NULL, then the breakpoints of the linear solution path of beta are chosen, however at most maxBreaks. See nirGetBreakpoints for what happens if there are more than maxBreaks breakpoints.

nearisoGetSolution takes an object of class nearisoPath and returns an object of the same class, but with the solution calculated for the given value of lambda. Advantage in comparison to neariso is that it uses the already calculated solution and does not recompute the entire solution path, therefore being faster.

nearisoGetBreakpoints returns the lambda values at which the piecewise linear solution paths for beta have a breakpoint. If there are more than maxBreaks such breakpoints, only maxBreaks representative breakpoints will be returned, including the first and last.

Value

Returns a list with the items

solObj

Object of class nearisoSolObj in which the whole solution path is saved in compact form; used as basis to recalculate fits with new values of lambda in nearisoGetSolution

lambda

Values of lambda for which the solution was calculated

df

Number of different values for beta in the solution; degrees of freedom; same length as lambda

beta

length(y) x length(lambda) matrix with the solution

Author(s)

Holger Hoefling

References

Ryan Tibshirani, Holger Hoefling, Rob Tibshirani. Nearly-isotonic regression. 2010. To appear in Technometrics.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
library(neariso)
# generate some artificial data
y <- rnorm(1000) + (1:1000)/3000

### run the algorithm as default; will output solution at 100 breakpoints for lambda
res0 <- neariso(y)

### apply function nir and get solution directly
lambda = 0:10/10
res <- neariso(y, lambda=lambda)

### apply the function and get the solution later
res2 <- neariso(y, lambda=NULL)
res2 <- nearisoGetSolution(res2, lambda=lambda)

### look at the breakpoints
lambdaBreaks <- nearisoGetBreakpoints(res2, maxBreaks=1000)
res3 <- nearisoGetSolution(res2, lambda=lambdaBreaks)

neariso documentation built on May 1, 2019, 8:21 p.m.

Related to NIR in neariso...