Description Usage Arguments Value Author(s) References See Also Examples
Uses cross-validation to estimate the regularization parameter for hierNet
1 | hierNet.cv(fit, x, y, nfolds=10,folds=NULL,trace=0)
|
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 |
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 |
Jacob Bien and Robert Tibshirani
Bien, J., Taylor, J., Tibshirani, R., (2013) "A Lasso for Hierarchical Interactions." Annals of Statistics. 41(3). 1111-1141.
hierNet,hierNet.path, hierNet.logistic,hierNet.logistic.path
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.