hierNet.path: Fit a path of hierNet models- lasso models with interactions

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

View source: R/funcs.R

Description

One of the main functions in the hierNet package. Fits a path of hierNet models over different values of the regularization parameter. Calls hierNet, which builds a regression model with hierarchically constrained pairwise interactions. Required inputs are an x matrix of features (the columns are the features) and a y vector of values. Reasonably fast for moderate sized problems (100-200 variables). We are currently working on an alternate algorithm for large scale problems.

Usage

1
2
3
4
5
6
hierNet.path(x, y,
             lamlist = NULL, delta=1e-8, minlam = NULL, maxlam = NULL, nlam=20, flmin=.01,
             diagonal = TRUE, strong = FALSE, aa = NULL, zz = NULL,
             stand.main = TRUE, stand.int = FALSE,
             rho = nrow(x), niter = 100, sym.eps = 0.001, 
             step = 1, maxiter = 2000, backtrack = 0.2, tol = 1e-05, trace = 0)

Arguments

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)

lamlist

Optional vector of values of lambda (the regularization parameter). L1 penalty param is lamdbda * (1-delta).

delta

Elastic Net parameter. Squared L2 penalty param is lambda * delta. Not a tuning parameter: Think of as fixed and small. Default 1e-8.

minlam

Optional minimum value for lambda

maxlam

Optional maximum value for lambda

nlam

Number of values of lambda to be tried

flmin

Fraction of maxlam; minlam= flmin*maxlam. If computation is slow, try increasing flmin to focus on the sparser part of the path

diagonal

Flag specifying whether to include "pure" quadratic terms, th_jjX_j^2, in the model. Default TRUE.

strong

Flag specifying strong hierarchy (true) or weak hierarchy (false). Default false

aa

An *optional* argument, a list with results from a previous call

zz

An *optional* argument, a matrix whose columns are products of features, computed by the function compute.interactions.c

stand.main

Should main effects be standardized? Default TRUE

stand.int

Should interactions be standardized? Default FALSE

rho

ADMM parameter: tuning parameter (>0) for ADMM. If there are convergence problems, try decreasing rho. Default n.

niter

ADMM parameter: number of iterations

sym.eps

ADMM parameter Thresholding for symmetrizing with strong=TRUE

step

Stepsize for generalized gradient descent

maxiter

Maximum number of iterations for generalized gradient descent

backtrack

Backtrack parameter for generalized gradient descent

tol

Error tolerance parameter for generalized gradient descent

trace

Output option; trace=1 gives verbose output

Value

bp

p by nlam matrix of estimated "positive part" main effects (p=#variables)

bn

p by nlam matrix of estimated "negative part" main effects

th

p by p by nlam array of estimated interaction coefficients

obj

nlam values of objective function, one per lambda value

lamlist

Vector of values of lambda used

mx

p-vector of column means of x

sx

p-vector of column standard deviations of x

my

mean of y

mzz

column means of feature product matrix

szz

column standard deviations of feature product matrix

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,predict.hierNet, hierNet.cv

Examples

1
2
3
4
5
6
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)
print(fit)

Example output

i,lam= 1 129.72
GG converged in 1 iterations.
i,lam= 2 101.8
GG converged in 20 iterations.
i,lam= 3 79.89
GG converged in 26 iterations.
i,lam= 4 62.69
GG converged in 26 iterations.
i,lam= 5 49.2
GG converged in 26 iterations.
i,lam= 6 38.61
GG converged in 48 iterations.
i,lam= 7 30.3
GG converged in 57 iterations.
i,lam= 8 23.78
GG converged in 62 iterations.
i,lam= 9 18.66
GG converged in 55 iterations.
i,lam= 10 14.64
GG converged in 63 iterations.
i,lam= 11 11.49
GG converged in 60 iterations.
i,lam= 12 9.02
GG converged in 119 iterations.
i,lam= 13 7.08
GG converged in 122 iterations.
i,lam= 14 5.55
GG converged in 139 iterations.
i,lam= 15 4.36
GG converged in 147 iterations.
i,lam= 16 3.42
GG converged in 200 iterations.
i,lam= 17 2.68
GG converged in 374 iterations.
i,lam= 18 2.11
GG converged in 291 iterations.
i,lam= 19 1.65
GG converged in 602 iterations.
i,lam= 20 1.3
GG converged in 657 iterations.
Call:
hierNet.path(x = x, y = y)

      Lambda Objective Number of main effects Number of interactions
 [1,] 129.72    604.54                      1                      0
 [2,] 101.80    596.67                      1                      1
 [3,]  79.89    578.15                      4                      2
 [4,]  62.69    551.28                      4                      2
 [5,]  49.20    521.57                      4                      2
 [6,]  38.61    492.44                      7                      6
 [7,]  30.30    463.48                      8                      7
 [8,]  23.78    434.86                      8                     11
 [9,]  18.66    406.66                      8                     11
[10,]  14.64    380.64                      9                     12
[11,]  11.49    357.57                     10                     13
[12,]   9.02    337.13                     10                     20
[13,]   7.08    316.64                     10                     23
[14,]   5.55    295.96                     10                     24
[15,]   4.36    276.25                     10                     26
[16,]   3.42    258.17                     10                     30
[17,]   2.68    241.73                     10                     33
[18,]   2.11    226.67                     10                     34
[19,]   1.65    212.84                     10                     42
[20,]   1.30    199.61                     10                     45

hierNet documentation built on March 18, 2018, 5:31 p.m.