Sparse regression model

sparse_regression(
  x,
  y,
  cross_validation = FALSE,
  seed = 1,
  penalty = "L0",
  algorithm = "CD",
  regulators_num = ncol(x),
  n_folds = 10,
  subsampling_ratio = 1,
  r_threshold = 0,
  computation_method = "cor",
  verbose = TRUE,
  ...
)

Arguments

x

The matrix of regulators.

y

The vector of target.

cross_validation

Logical value, default is FALSE, whether to use cross-validation.

seed

The random seed for cross-validation, default is 1.

penalty

The type of regularization, default is L0. This can take either one of the following choices: L0, L0L1, and L0L2. For high-dimensional and sparse data, L0L2 is more effective.

algorithm

The type of algorithm used to minimize the objective function, default is CD. Currently CD and CDPSI are supported. The CDPSI algorithm may yield better results, but it also increases running time.

regulators_num

The number of non-zore coefficients, this value will affect the final performance. The maximum support size at which to terminate the regularization path.

n_folds

The number of folds for cross-validation, default is 10.

subsampling_ratio

The percent of all samples used for sparse_regression, default is 1.

r_threshold

Threshold of \(R^2\) or correlation coefficient, default is 0.

computation_method

The method used to compute `r“.

verbose

Logical value, default is TRUE, whether to print progress messages.

...

Parameters for other methods.

Value

Coefficients

Examples

data("example_matrix")
sparse_regression(
  x = example_matrix[, -1],
  y = example_matrix[, 1]
)
#>  [1]  0.006073601  0.006290166  0.010752371 -0.001518502 -0.013052947
#>  [6]  0.016748325 -0.024070066  0.069284763 -0.563969602  0.217868939
#> [11]  0.007553373 -0.017714243  0.023644447 -0.018219713  0.015716106
#> [16]  0.005408364 -0.028352269