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

Sparsenet uses coordinate descent on the MC+ nonconvex penalty family, and fits a surface of solutions over the two-dimensional parameter space. This penalty family is indexed by an overall strength paramter lambda (like lasso), and a convexity parameter gamma. Gamma = infinity corresponds to the lasso, and gamma = 1 best subset.

1 2 3 4 5 | ```
sparsenet(x, y, weights, exclude, dfmax = nvars + 1, pmax = min(dfmax *2, nvars),
ngamma = 9, nlambda = 50, max.gamma = 150, min.gamma = 1.000001,
lambda.min.ratio = ifelse(nobs < nvars, 0.01, 1e-04), lambda = NULL,
gamma = NULL, parms = NULL, warm = c("lambda", "gamma", "both"),
thresh = 1e-05, maxit = 1e+06)
``` |

`x` |
Input matrix of nobs x nvars predictors |

`y` |
response vector |

`weights` |
Observation weights; default 1 for each observation |

`exclude` |
Indices of variables to be excluded from the model. Default is none. |

`dfmax` |
Limit the maximum number of variables in the
model. Useful for very large |

`pmax` |
Limit the maximum number of variables ever to be nonzero |

`ngamma` |
Number of gamma values, if |

`nlambda` |
Number of lambda values, if |

`max.gamma` |
Largest gamma value to be used, apart from infinity
(lasso), if |

`min.gamma` |
Smallest value of gamma to use, and should be >1; default is 1.000001 |

`lambda.min.ratio` |
Smallest value for |

`lambda` |
A user supplied |

`gamma` |
Sparsity parameter vector, with 1<gamma<infty. Gamma=1 corresponds to best-subset regression, gamma=infty to the lasso. Should be given in decreasing order. |

`parms` |
An optional three-dimensional array: 2x ngamma x nlambda. Here the user can supply exactly the gamma, lambda pairs that are to be traversed by the coordinate descent algorithm. |

`warm` |
How to traverse the grid. Default is "lambda", meaning warm starts from the previous lambda with the same gamma. "gamma" means the opposite, previous gamma for the same lambda. "both" tries both warm starts, and uses the one that improves the criterion the most. |

`thresh` |
Convergence threshold for coordinate descent. Each
coordinate-descent loop continues until the maximum change in the
objective after any coefficient update is less than |

`maxit` |
Maximum number of passes over the data for all lambda/gamma values; default is 10^6. |

This algorithm operates like `glmnet`

, with its alpha parameter
which moves the penalty between lasso and ridge; here gamma moves it
between lasso and best subset.
The algorithm traverses the two dimensional gamma/lambda array in a nested loop, with
decreasing gamma in the outer loop, and decreasing lambda in the inner
loop. Because of the nature of the MC+ penalty, each coordinate update
is a convex problem, with a simple two-threshold shrinking scheme:
beta< lambda set to zero; beta > lambda*gamma leave alone; beta
inbetween, shrink proportionally. Note that this algorithm ALWAYS
standardizes the columns of x and y to have mean zero and variance 1
(using the 1/N averaging) before it computes its fit. The
coefficients reflect the original scale.

An object of class `"sparsenet"`

, with a number of
components. Mostly one will access the components via generic
functions
like `coef()`

, `plot()`

, `predict()`

etc.

`call` |
the call that produced this object |

`rsq` |
The percentage variance explained on the training data; an ngamma x nlambda matrix. |

`jerr` |
error flag, for warnings and errors (largely for internal debugging). |

`coefficients` |
A coefficient list with ngamma elements; each of these is a coefficient list with various components: the matrix beta of coefficients, its dimension dim, the vector of intercepts, the lambda sequence, the gamma value, the sequence of df (nonzero coefficients) for each solution. |

`parms` |
Irrespective how the parameters were input, the three-way array of what was used. |

`gamma` |
The gamma values used |

`lambda` |
The lambda values used |

`max.lambda` |
The entry value for lambda |

Rahul Mazumder, Jerome Friedman and Trevor Hastie

Maintainer: Trevor Hastie <[email protected]>

http://www.stanford.edu/~hastie/Papers/Sparsenet/jasa_MFH_final.pdf

`glmnet`

package, `predict`

, `coef`

, `print`

and `plot`

methods, and the `cv.sparsenet`

function.

1 2 3 4 5 6 7 |

```
Loading required package: glmnet
Loading required package: Matrix
Loading required package: foreach
Loaded glmnet 2.0-12
Loading required package: shape
Loaded sparsenet 1.2
12345678910
```

sparsenet documentation built on May 29, 2017, 2:19 p.m.

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.