Learn R Programming

uniLasso (version 2.11)

uniCoef: Compare the nonzero coefficients and univariate counterparts

Description

For a cv.uniLasso object, compare the CV-selected nonzero coefficients to their univariate counterparts. Also works for a cv.glmnet object.

Usage

uniCoef(cv.object, info = NULL, s = c("lambda.min", "lambda.1se"), ...)

Value

a three-columns data frame with the second column being the non-zero coefficients from the cv.object, the first the corresponding univariate coefficients, and the third an indication if there was a sign change.

@examples

sigma <- 3 set.seed(1) n <- 100 p <- 20 x <- matrix(rnorm(n * p), n, p) beta <- matrix(c(rep(2, 5), rep(0, 15)), ncol = 1) y <- x %*% beta + rnorm(n)*sigma

cvfit <- cv.uniLasso(x, y) uniCoef(cvfit) cvfit2 <- cv.glmnet(x,y) uniCoef(cvfit2, info=cvfit$info)

Arguments

cv.object

a cv.uniLasso or a cv.glmnet object.

info

the result of a call to uniInfo(). If cv.object inherits from cv.uniLasso, the $info component will be used.

s

the value of lambda to be used, with default s="lambda.min". Alternatively, can be `s="lambda.1se".

...

other arguments to coef.