hierNet.cv: Cross-validation function for hierNet

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

Description

Uses cross-validation to estimate the regularization parameter for hierNet

Usage

1
hierNet.cv(fit, x, y, nfolds=10,folds=NULL,trace=0)

Arguments

fit

Object returned from call to hierNet.path or hierNet.logistic.path. All parameter settings will be taken from this object.

x

A matrix of predictors, where the rows are the samples and the columns are the predictors

y

A vector of observations, where length(y) equals nrow(x)

nfolds

Number of cross-validation folds

folds

(Optional) user-supplied cross-validation folds. If provided, nfolds is ignored.

trace

Verbose output? 0=no, 1=yes

...

Additional arguments to be passed to hierNet.path or hierNet.logistic.path

Value

lamlist

Vector of lambda values tried

cv.err

Estimate of cross-validation error

cv.se

Estimated standard error of cross-validation estimate

lamhat

lambda value minimizing cv.err

lamhat.1se

largest lambda value with cv.err less than or equal to min(cv.err)+ SE

folds

Indices of folds used in cross-validation

yhat

n by nlam matrix of predicted values. Here, ith prediction is based on training on all folds that do not include the ith data point.

nonzero

Vector giving number of non-zero coefficients for each lambda value

call

The call to hierNet.cv

Author(s)

Jacob Bien and Robert Tibshirani

References

Bien, J., Taylor, J., Tibshirani, R., (2013) "A Lasso for Hierarchical Interactions." Annals of Statistics. 41(3). 1111-1141.

See Also

hierNet,hierNet.path, hierNet.logistic,hierNet.logistic.path

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
set.seed(12)
x=matrix(rnorm(100*10),ncol=10)
x=scale(x,TRUE,TRUE)
y=x[,1]+2*x[,2]+ x[,1]*x[,2]+3*rnorm(100)
fit=hierNet.path(x,y)
fitcv=hierNet.cv(fit,x,y)
print(fitcv)
plot(fitcv)


x=matrix(rnorm(100*10),ncol=10)
x=scale(x,TRUE,TRUE)
y=x[,1]+2*x[,2]+ x[,1]*x[,2]+3*rnorm(100)
y=1*(y>0)
fit=hierNet.logistic.path(x,y)
fitcv=hierNet.cv(fit,x,y)
print(fitcv)
plot(fitcv)

pejovic/int3D documentation built on May 25, 2019, 12:45 a.m.