Description Usage Arguments Details Value Author(s) References Examples
These functions are the main interface functions for calculating Nearly-isotonic solutions
1 2 3 | neariso(y, maxBreaks=100, lambda=NULL)
nearisoGetBreakpoints(nearisoPathObj, maxBreaks=100)
nearisoGetSolution(nearisoPathObj, lambda=nearisoGetBreakpoints(nearisoPathObj))
|
y |
response variable; numeric |
lambda |
penalty parameter vector (non-negative) for the difference of coefficients; numeric |
nearisoPathObj |
Solution object of class |
maxBreaks |
maximum number of breakpoints the function should return |
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.
Returns a list with the items
solObj |
Object of class |
lambda |
Values of |
df |
Number of different values for beta in the solution; degrees of freedom; same length as |
beta |
|
Holger Hoefling
Ryan Tibshirani, Holger Hoefling, Rob Tibshirani. Nearly-isotonic regression. 2010. To appear in Technometrics.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.