| Title: | Continuous Generalized Gradient Descent |
|---|---|
| Description: | Efficient procedures for fitting an entire regression sequences with different model types. Compatibility updates by Renova. |
| Authors: | Cun-Hui Zhang [aut, cre], Ofer Melnik [aut] |
| Maintainer: | Cun-Hui Zhang <[email protected]> |
| License: | GPL (>= 2) |
| Version: | 0.8.9001 |
| Built: | 2026-11-15 20:45:33 UTC |
| Source: | https://github.com/renova-r/cggd |
These CGGD models all provide the entire sequence of coefficients and fits, to the least squares fit. This package is based on the lars package.
cggd(x, y, beta0 = rep(0,2), kmax = 300, TRR=FALSE, t0 = 1, TRACE=FALSE, alpha1 = 0, alpha2 = 0, w = 1, tau = 1, tautil = -1, eps = -1, fctr=1e8)cggd(x, y, beta0 = rep(0,2), kmax = 300, TRR=FALSE, t0 = 1, TRACE=FALSE, alpha1 = 0, alpha2 = 0, w = 1, tau = 1, tautil = -1, eps = -1, fctr=1e8)
x |
matrix of predictors |
y |
response |
beta0 |
initial coefficient values |
kmax |
the maximum number of steps |
TRACE |
If TRUE, cggd prints out its progress |
TRR |
If TRUE builds a Threshold Ridge Regression (TRR) model. If FALSE builds a Functional Gradient Descent Kernel model. |
t0 |
The initial time in the TRR model. |
alpha1, alpha2, w
|
Values used in kernel generation. |
tau, tautil, eps
|
Values used in variable selection. |
fctr |
Used to tune the search routine. Smaller values tighten the search (more sampling). |
CGGD is a general method for performing different types of regressions while continuously varying regularization and other parameters (similar to LARS but broader). It returns the models fit along the continuous paths of parameter modification. Note that y is automatically centered and x is centered and normalized.
A "cggd" object is returned, for which plot and predict methods exist.
Some significant componenets of the object are:
beta.tk |
The coefficients of the model at the different steps (k). |
tk |
The time at the different steps (k). |
a.set.tk |
The active coefficients of the model at the different steps (k). |
Cun-Hui Zhang and Ofer Melnik
Cun-Hui Zhang (2007) "Continuous Generalized Gradient Descent" Journal of Computational and Graphical Statistics ; see also http://stat.rutgers.edu/~cunhui/software/CGGD.html.
plot, and predict methods for cggd, and cv.cggd
data(housing) attach(housing) object <- cggd(x,y) plot(object) object2 <- cggd(x,y,TRR=TRUE) plot(object2) detach(housing)data(housing) attach(housing) object <- cggd(x,y) plot(object) object2 <- cggd(x,y,TRR=TRUE) plot(object2) detach(housing)
Computes the K-fold cross-validated mean squared prediction error for cggd.
cv.cggd(x, y, nfolds = 6, kmax=40 , trace = FALSE, plot.it = TRUE, se=TRUE, ...)cv.cggd(x, y, nfolds = 6, kmax=40 , trace = FALSE, plot.it = TRUE, se=TRUE, ...)
x |
Input to cggd |
y |
Input to cggd |
nfolds |
Number of folds |
kmax |
Max number of iterations per model |
trace |
Show computations |
plot.it |
Plot it |
se |
Include standard error bands |
... |
Additional arguments to |
cv |
The CV loss curve at each value of k |
cv.error |
The standard error of the CV curve |
Cun-Hui Zhang and Ofer Melnik
Cun-Hui Zhang (2007) "Continuous Generalized Gradient Descent" Journal of Computational and Graphical Statistics ; see also http://stat.rutgers.edu/~cunhui/software/CGGD.html.
data(Wine) attach(Wine) cv.cggd(x.learning,y.learning,kmax=40,fctr=1e3) detach(Wine)data(Wine) attach(Wine) cv.cggd(x.learning,y.learning,kmax=40,fctr=1e3) detach(Wine)
The housing data frame has 506 rows and 13 attributes.
data(housing)data(housing)
This data frame contains the following columns:
a matrix with 13 columns of attributes
a numeric vector of median value of owner-occupied homes in 1000's
The x matrix has been standardized to have unit L2 norm in each column and zero mean. The matrix x2 consists of x plus certain interactions.
(a) Origin: This dataset was taken from the StatLib library which is maintained at Carnegie Mellon University. (b) Creator: Harrison, D. and Rubinfeld, D.L. 'Hedonic prices and the demand for clean air', J. Environ. Economics & Management, vol.5, 81-102, 1978. (c) Date: July 7, 1993 Can be found on the UCI data repository ftp://ftp.ics.uci.edu/pub/machine-learning-databases/housing/
The OJ datafile has both learning and test data.
data(OJ)data(OJ)
This data file contains the following items:
150 spectra (lines), sampled with 700 points (columns)
Corresponding level of saccharose, in a column vector (150 lines).
68 spectra (lines), sampled with 700 points (columns)
Corresponding level of saccharose, in a column vector (68 lines).
The goal is to estimate the level of saccharose of an orange juice from its observed near-infrared spectrum.
This database has been provided by Prof. Marc Meurens, Université catholique de Louvain, BNUT unit. Please acknowledge the origin of this database if you use it and/or publish about it. It can be found at http://www.ucl.ac.be/mlg/index.php?page=DataBases
Produce a plot of a cggd fit. The default is a complete coefficient path.
## S3 method for class 'cggd' plot(x, steps=5, breaks = TRUE, first_k=1,last_k=Inf, xvar=c("step","t"),omit.zeros = TRUE, eps = 1e-10, ...)## S3 method for class 'cggd' plot(x, steps=5, breaks = TRUE, first_k=1,last_k=Inf, xvar=c("step","t"),omit.zeros = TRUE, eps = 1e-10, ...)
x |
cggd object |
steps |
Number of steps to sample coefficients between each model iteration. |
breaks |
If |
first_k |
The starting k, model iteration, to plot from. |
last_k |
The final k, model iteration, to plot from. |
xvar |
The type of x variable against which to
plot. |
omit.zeros |
When the number of variables is much greater than
the number of observations, many coefficients will never be nonzero;
this logical (default |
eps |
Definition of zero above, default is |
... |
Additonal arguments for generic plot. Can be used to set xlims, change colors, line widths, etc |
NULL
Cun-Hui Zhang and Ofer Melnik
Cun-Hui Zhang (2007) "Continuous Generalized Gradient Descent" Journal of Computational and Graphical Statistics ; see also http://stat.rutgers.edu/~cunhui/software/CGGD.html.
data(housing) attach(housing) object <- cggd(x,y) plot(object) detach(housing)data(housing) attach(housing) object <- cggd(x,y) plot(object) detach(housing)
While cggd produces the entire path of solutions, predict.cggd
allows one to extract a prediction at a particular point along the path.
## S3 method for class 'cggd' predict(object, newx, t, type = c("fit", "coefficients"), mode=c("k","t"), ...)## S3 method for class 'cggd' predict(object, newx, t, type = c("fit", "coefficients"), mode=c("k","t"), ...)
object |
A fitted cggd object |
newx |
If type="fit", then newx should be the x values at which the fit is required. If type="coefficients", then newx can be omitted. |
t |
A value specifying the desired model. Its values depends on the mode argument. By default (mode="k"), t should take on values between 0 and max k (e.g., a step of 1.3 means .3 of the way between step 1 and 2.) |
type |
If type="fit", predict returns the fitted value. If type="coefficients", predict returns the coefficients. |
mode |
Mode="k" means the t= argument indexes the cggd step number, and the coefficients will be returned corresponding to the values at step t. If mode="t", then t is a time on the coefficient path. |
... |
additional parameters. |
Either the fitted value, or a vector of coefficients.
Cun-Hui Zhang and Ofer Melnik
Cun-Hui Zhang (2007) "Continuous Generalized Gradient Descent" Journal of Computational and Graphical Statistics ; see also http://stat.rutgers.edu/~cunhui/software/CGGD.html.
plot, cggd, cv.cggd
data(housing) attach(housing) object <- cggd(x,y) coef4.1 <- predict(object, t=4.1,type="coefficients", mode="k") detach(housing)data(housing) attach(housing) object <- cggd(x,y) coef4.1 <- predict(object, t=4.1,type="coefficients", mode="k") detach(housing)
The Wine data file has both learning and test data.
data(Wine)data(Wine)
This data file contains the following items:
94 spectra (lines), sampled with 256 points (columns)
Corresponding level of alcohol, in a column vector (94 lines).
30 spectra (lines), sampled with 256 points (columns)
Corresponding level of alcohol, in a column vector (30 lines).
To estimate the level of alcohol of a wine from its observed mean infrared spectrum.
This database has been provided by Prof. Marc Meurens, Université catholique de Louvain, BNUT unit. Please acknowledge the origin of this database if you use it and/or publish about it. It can be found at http://www.ucl.ac.be/mlg/index.php?page=DataBases