LambdaGridRegression {sharp} | R Documentation |
Grid of penalty parameters (regression model)
Description
Generates a relevant grid of penalty parameter values for penalised
regression using the implementation in glmnet
.
Usage
LambdaGridRegression(
xdata,
ydata,
tau = 0.5,
seed = 1,
family = "gaussian",
resampling = "subsampling",
Lambda_cardinal = 100,
check_input = TRUE,
...
)
Arguments
xdata |
matrix of predictors with observations as rows and variables as columns. |
ydata |
optional vector or matrix of outcome(s). If |
tau |
subsample size. Only used if |
seed |
value of the seed to initialise the random number generator and
ensure reproducibility of the results (see |
family |
type of regression model. This argument is defined as in
|
resampling |
resampling approach. Possible values are:
|
Lambda_cardinal |
number of values in the grid of parameters controlling the level of sparsity in the underlying algorithm. |
check_input |
logical indicating if input values should be checked (recommended). |
... |
additional parameters passed to the functions provided in
|
Value
A matrix of lambda values with one column and as many rows as
indicated in Lambda_cardinal
.
See Also
Other lambda grid functions:
LambdaGridGraphical()
,
LambdaSequence()
Examples
# Data simulation
set.seed(1)
simul <- SimulateRegression(n = 100, pk = 50, family = "gaussian") # simulated data
# Lambda grid for linear regression
Lambda <- LambdaGridRegression(
xdata = simul$xdata, ydata = simul$ydata,
family = "gaussian", Lambda_cardinal = 20
)
# Grid can be used in VariableSelection()
stab <- VariableSelection(
xdata = simul$xdata, ydata = simul$ydata,
family = "gaussian", Lambda = Lambda
)
print(SelectedVariables(stab))