Skip to contents

Get the indices of nonzero coefficients from the overall model in a fitted ptLasso or cv.ptLasso object, excluding the intercept.

Usage

get.overall.support(fit, s = "lambda.min", gamma = "gamma.min")

Arguments

fit

fitted "ptLasso" or "cv.ptLasso" object.

s

the choice of lambda to use. May be "lambda.min", "lambda.1se" or a numeric value. Default is "lambda.min".

gamma

for use only when 'relax = TRUE' was specified during training. The choice of 'gamma' to use. May be "gamma.min" or "gamma.1se". Default is "gamma.min".

Value

This returns a vector containing the indices of nonzero coefficients (excluding the intercept).

See also

ptLasso, cv.ptLasso.

Author

Erin Craig and Rob Tibshirani
Maintainer: Erin Craig <erincr@stanford.edu>

Examples

# Train data
set.seed(1234)
out = gaussian.example.data()
x = out$x; y=out$y; groups = out$group;

fit = ptLasso(x, y, groups = groups, family = "gaussian", type.measure = "mse")

get.overall.support(fit, s="lambda.min") 
#>  [1]   1   2   3   4   5   6   7   8   9  10  11  12  13  15  21  25  27  29  31
#> [20]  35  36  38  43  45  46  48  50  52  54  56  57  59  61  62  63  65  69  73
#> [39]  79  80  84  88  94  98 100 105 109
get.overall.support(fit, s="lambda.1se") 
#>  [1]  1  2  3  4  5  6  7  8  9 10 11 54 56 57 69 84

cvfit = cv.ptLasso(x, y, groups = groups, family = "gaussian", type.measure = "mse")

get.overall.support(cvfit, s="lambda.min") 
#>  [1]   1   2   3   4   5   6   7   8   9  10  11  12  13  15  21  25  27  29  31
#> [20]  35  36  38  43  45  46  48  50  52  54  56  57  59  61  62  63  65  69  73
#> [39]  79  80  84  88  93  94  98 100 105 109 112 115
get.overall.support(cvfit, s="lambda.1se") 
#>  [1]   1   2   3   4   5   6   7   8   9  10  11  27  35  36  38  45  50  52  54
#> [20]  56  57  61  62  63  69  80  84  88 100