ridgetrace {GCEstim}R Documentation

Function to obtain the ridge trace and choose the support limits given a formula

Description

Function to obtain the ridge trace and choose the support limits given a formula

Usage

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
)

Arguments

formula

An object of class formula (or one that can be coerced to that class): a symbolic description of the model to be fitted.

data

A data frame (or object coercible by as.data.frame to a data frame) containing the variables in the model.

subset

an optional vector specifying a subset of observations to be used in the fitting process.

na.action

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.

offset

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.

contrasts

An optional list. See the contrasts.arg of model.matrix.default.

lambda

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.

lambda.min

Minimum value for the lambda sequence.

lambda.max

Maximum value for the lambda sequence.

lambda.n

The number of lambda values. The default is lambda.n = 100.

penalize.intercept

Boolean value. if TRUE, the default, the intercept will be penalized.

errormeasure

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".

cv

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.

cv.nfolds

number of folds used for cross-validation when cv = TRUE. The default is cv.nfolds = 5.

seed

A single value, interpreted as an integer, for reproducibility or NULL for randomness. The default is seed = 230676.

Value

An object of class ridgetrace is a list containing at least the following components:

lambda

the lambda sequence used

max.abs.coef

a named vector of coefficients (maximum absolute coefficients)

max.abs.residual

the maximum absolute residual

coef.lambda

a data.frame with the coefficients for each lambda tested

error.lambda

a vector with the in sample error

error.lambda.cv

a data.frame with cross-validation errors

call

the matched call

Author(s)

Jorge Cabral, jorgecabral@ua.pt

Examples

res.ridgetrace <-
  ridgetrace(
    formula = y ~ X001 + X002 + X003 + X004 + X005,
    data = dataGCE)

res.ridgetrace


[Package GCEstim version 0.1.0 Index]