Learn R Programming

inferCSN (version 1.2.0)

fit_srm: Sparse regression model

Description

Sparse regression model

Usage

fit_srm(
  x,
  y,
  cross_validation = FALSE,
  seed = 1,
  penalty = "L0",
  regulators_num = ncol(x),
  n_folds = 5,
  verbose = TRUE,
  ...
)

Value

A list of the sparse regression model. The list has the three components: model, metrics, and coefficients.

Arguments

x

The matrix of regulators.

y

The vector of target.

cross_validation

Whether to use cross-validation. Default is FALSE.

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.

regulators_num

The number of regulators for target.

n_folds

The number of folds for cross-validation. Default is 5.

verbose

Whether to print progress messages. Default is TRUE.

...

Parameters for other methods.

Examples

Run this code
data(example_matrix)
fit_srm(
  x = example_matrix[, -1],
  y = example_matrix[, 1]
)

Run the code above in your browser using DataLab