Function to obtain the ridge trace and choose the support limits given a formula
ridgetrace(
formula,
data,
subset,
na.action,
offset,
contrasts = NULL,
lambda = NULL,
lambda.min = 0.001,
lambda.max = 1,
lambda.n = 100,
penalize.intercept = TRUE,
errormeasure = c("RMSE", "MSE", "MAE", "MAPE", "sMAPE", "MASE"),
cv = TRUE,
cv.nfolds = 5,
seed = 230676
)An object of class
ridgetrace is a list containing
at least the following components:
the lambda sequence used
a named vector of coefficients (maximum absolute coefficients)
the maximum absolute residual
a data.frame with the coefficients for each lambda tested
a vector with the in sample error
a data.frame with cross-validation errors
the matched call
An object of class formula (or one that
can be coerced to that class): a symbolic description of the model to be
fitted.
A data frame (or object coercible by
as.data.frame to a data frame) containing the variables
in the model.
an optional vector specifying a subset of observations to be used in the fitting process.
a function which indicates what should happen when the data
contain NAs. The default is set by the na.action setting of
options, and is na.fail if that is
unset. The ‘factory-fresh’ default is na.omit. Another
possible value is NULL, no action. Value
na.exclude can be useful.
this can be used to specify an a priori known component to be
included in the linear predictor during fitting. This should be NULL
or a numeric vector or matrix of extents matching those of the response. One
or more offset terms can be included in the formula
instead or as well, and if more than one are specified their sum is used.
See model.offset.
An optional list. See the contrasts.arg of
model.matrix.default.
The default is lambda = NULL and a lambda sequence will
be computed based on lambda.n, lambda.min and lambda.max.
Supplying a lambda sequence overrides this.
Minimum value for the lambda sequence.
Maximum value for the lambda sequence.
The number of lambda values. The default is
lambda.n = 100.
Boolean value. if TRUE, the default, the
intercept will be penalized.
Loss function (error) to be used for the selection
of the support spaces. One of c("RMSE","MSE", "MAE", "MAPE", "sMAPE", "MASE").
The default is errormeasure = "RMSE".
Boolean value. If TRUE the error, errormeasure,
will be computed using cross-validation. If FALSE the error will be
computed in sample. The default is cv = TRUE.
number of folds used for cross-validation when
cv = TRUE. The default is cv.nfolds = 5.
A single value, interpreted as an integer, for reproducibility
or NULL for randomness. The default is seed = 230676.
Jorge Cabral, jorgecabral@ua.pt
res.ridgetrace <-
ridgetrace(
formula = y ~ X001 + X002 + X003 + X004 + X005,
data = dataGCE)
res.ridgetrace
Run the code above in your browser using DataLab