Learn R Programming

LorenzRegression (version 2.2.0)

PLR.CV: Cross-validation for penalized Lorenz regression

Description

PLR.CV performs k-fold cross-validation to select the grid and penalization parameters of the penalized Lorenz regression.

Usage

PLR.CV(object, k, seed.CV = NULL, parallel = FALSE, ...)

Value

An object of class c("PLR_cv", "PLR"). The returned list contains the following components:

path

See Lorenz.Reg for the original path. The cross-validation score is added.

lambda.idx

A vector indicating the index of the optimal lambda obtained by each selection method.

grid.idx

A vector indicating the index of the optimal grid parameter obtained by each selection method.

splits

A list storing the data splits used for cross-validation, as generated by vfold_cv.

Note: The returned object may have additional classes such as "PLR_boot" if bootstrap was performed.

Arguments

object

An object of class "PLR", i.e., the result of a call to Lorenz.Reg where penalty is either "SCAD" or "LASSO".

k

An integer specifying the number of folds in the k-fold cross-validation.

seed.CV

An optional integer specifying a seed for reproducibility in the creation of the folds. Default is NULL, in which case no seed is imposed.

parallel

A logical or numeric value controlling parallel computation. If TRUE, parallel processing is enabled using the maximum available cores minus one. If a numeric value is provided, it specifies the number of cores to use. Default is FALSE (no parallelization).

...

Additional arguments passed to either the cross-validation function vfold_cv from the rsample package or the underlying fit functions (Lorenz.GA, Lorenz.FABS, or Lorenz.SCADFABS). By default, the fit function uses the same parameters as in the original call to Lorenz.Reg, but these can be overridden by explicitly passing them in ....

Details

The parameter seed.CV allows for local seed setting to control randomness in the generation of the folds. The specified seed is applied to the respective part of the computation, and the seed is reverted to its previous state after the operation. This ensures that the seed settings do not interfere with the global random state or other parts of the code.

References

Jacquemain, A., C. Heuchenne, and E. Pircalabelu (2024). A penalised bootstrap estimation procedure for the explained Gini coefficient. Electronic Journal of Statistics 18(1) 247-300.

See Also

Lorenz.Reg, Lorenz.SCADFABS, Lorenz.FABS, Lorenz.boot

Examples

Run this code
# \dontshow{
utils::example(Lorenz.Reg, echo = FALSE)
# }
# Continuing the Lorenz.Reg(.) example:
PLR_CV <- PLR.CV(PLR, k = 5, seed.CV = 123)
# The object now inherits from the class "PLR_cv".
# Hence the methods (also) display the results obtained by cross-validation.
print(PLR_CV)
summary(PLR_CV)
coef(PLR_CV, pars.idx = "CV")
predict(PLR_CV, pars.idx = "CV")
plot(PLR_CV)
plot(PLR_CV, type = "diagnostic") # Plot of the scores depending on the grid and penalty parameters

Run the code above in your browser using DataLab