Learn R Programming

liso (version 0.2)

cv.liso: Liso Crossvalidation

Description

Applies crossvalidation to Liso

Usage

cv.liso(x, y, K = 10, lambda = NULL, trace = FALSE, plot.it = FALSE, se = TRUE, weights = rep(1, length(y)), weightedcv = FALSE, huber = Inf, covweights = rep(1, ncol(x)), gridsize = 50, gridmin = 0.01, ...)
plotCV(cv.object, se=TRUE, ...)

Arguments

x
Design matrix (without intercept).
y
Response value.
K
Number of CV folds.
lambda
Values of the penalty parameter lambda to be tried. For speed, it's advised that a decreasing vector be used. If NULL, a log grid used, using liso.maxlamb to calculate the maximum.
trace
If TRUE, print diagnostic information as calculation is done.
plot.it
If TRUE, plot a graph of CV error against lambda with plotCV.
weights
Observation weights. Should be a vector of length equal to the number of observations.
weightedcv
If TRUE, use observation weights when averaging CV error across folds.
huber
If less than Inf, huberisation parameter for huberised liso. (Experimental)
covweights
Covariate weights. Should be a vector of length equal to the number of covariates.
gridsize
Size of logarithmic grid of lambda values, if lambda is unspecified.
gridmin
Minimum of logarithmic grid of lambda values, if lambda is unspecified. Considered as a proportion of the maximum value of lambda.
cv.object
Object to be plotted.
se
If TRUE, add error bars to CV plot.
...
Additional arguments to be passed to liso.backfit or plot

Value

  • cv.liso creates a list of 5 components:
  • lambdaLambda values used.
  • cvMean or weighted mean CV for each lambda.
  • cv.errorSqrt of MLE estimated variance of CV for each lambda.
  • residmatFull length(lambda) x K matrix of CV errors.
  • optimlamLambda value that minimises CV error

References

Zhou Fang and Nicolai Meinshausen (2009), Liso for High Dimensional Additive Isotonic Regression, available at http://blah.com

See Also

liso.backfit

Examples

Run this code
## Use the method on a simulated data set

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

## Simulate design matrix and response
x <- matrix(runif(n * p, min = -2.5, max = 2.5), nrow = n, ncol = p)
y <- scale(3 * (x[,1]> 0), scale=FALSE)  + x[,2]^3 + rnorm(n)

## Do CV
CVobj <- cv.liso(x,y, K=10, plot.it=TRUE)

## Do the actual fit
fitobj <- liso.backfit(x,y,CVobj$optimlam)
plot(fitobj)

Run the code above in your browser using DataLab