cv.nnlasso: k-fold cross validation for penalized generalized linear...

Description Usage Arguments Value Note Author(s) References Examples

Description

The function does k-fold cross validation for selecting best value of regularization parameter.

Usage

1
2
cv.nnlasso(x,y,family=c("binomial","normal","poisson"),
k=5,nlambda=50,tau=1,plot=TRUE, errorbars=TRUE)

Arguments

x

x is matrix of order n x p where n is number of observations and p is number of predictor variables. Rows should represent observations and columns should represent predictor variables.

y

y is a vector of response variable of order n x 1.

family

family is either "normal" or "binomial" or "poisson".

k

Number of folds for cross validation. Default is k=5.

nlambda

Number of lambda values to be used for cross validation. Default is nlambda=50.

tau

Elastic net parameter, 0 ≤ τ ≤ 1 in elastic net penalty λ{τ|β|_1+(1-τ)|β|_2^2}. Default tau=1 corresponds to LASSO penalty.

plot

if TRUE, produces a plot of cross validated prediction mean squared errors/ deviances against lambda. Default is TRUE.

errorbars

If TRUE, error bars are drawn in the plot. Default is TRUE.

Value

Produces a plot and returns a list with following components:

lambda

Value of lambda for which average cross validation error is minimum

pmse

A vector of average cross validation errors for various lambda values

lambdas

A vector of lambda values used in cross validation

se

A vector containing standard errors of cross validation errors

Note

This function uses prediction means squared errors for normal family and deviance for binomial and poisson family.

Author(s)

Baidya Nath Mandal and Jun Ma

References

Mandal, B.N. and Ma, J. (2016). L1 regularized multiplicative iterative path algorithm for non-negative generalized linear models.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#normal family
data(car)
attach(car)
x=as.matrix(car[,1:10])
## Not run: cv.nnlasso(x,y,family="normal",k=5)
#binomial family with same data
## Not run: cv.nnlasso(x,y1,family="binomial",k=5)
detach(car)

#poisson family
x=matrix(rnorm(100*30),100,30)
y=sample(c(1:5),100,replace=TRUE)
## Not run: cv.nnlasso(x,y,family="poisson",k=5)

nnlasso documentation built on May 2, 2019, 8:19 a.m.

Related to cv.nnlasso in nnlasso...