Computes a ridge or LASSO estimate for a given regression problem, with penalty parameter chosen to minimize bias and variance.
festLASSO(
X,
y,
loss = c("fMSE", "fMBV", "both"),
ind = 1,
lseq,
B = 500,
penalize,
rescale.lambda = TRUE,
scale = FALSE,
returnMSE = FALSE,
postsamp,
returnPS = FALSE,
nPost = 1000,
se.version = c("varExp", "full", "none"),
...
)festRidge(
X,
y,
loss = c("fMSE", "fMBV", "both"),
ind = 1,
lseq,
penalize,
scale = FALSE,
returnMSE = FALSE,
postsamp,
returnPS = FALSE,
nPost = 1000,
se.version = c("varExp", "full", "none"),
XtXlamIinv = NULL,
...
)
Design matrix for the regression. Assumed to contain only numeric values, so
any factors should be coded according to desired contrast (e.g., via model.matrix
)
Outcome vector. Unless X
contains an intercept column, this should typically be centered.
Loss function for choosing the penalty parameter. See details.
Vector of integers or logicals indicating which coefficients the loss is to be computed on.
Sequence of penalty values to consider.
Number of future datasets to simulate for each point in posterior sample.
See estRidge
If TRUE
, then lambda is rescaled to account for the
default re-scaling done by glmnet
. Can also be a scalar scaling factor.
Logical indicating whether the design matrix X be scaled. See details.
Logical indicating whether mse object should be returned.
List containing posterior sample (from samplePosterior
). If
missing, then a posterior sample is drawn. Currently checks on the provided
postsamp
are limited, so use with caution. Designed to facilitate
simulations or other scenarios where it may be pre-computed.
logical indicating whether or not the full posterior sample should be included in output.
Size of posterior sample to compute
String indicating which version of standard errors to use. See vcovfestRidge
.
Other arguments passed to samplePosterior
explicit value of (X'X + diag(penalty))^-1. Useful for simulations to save computation.
The value of the ridge or LASSO penalty is selected by minimizing the
posterior expectation of the loss function, which is chosen by the argument
loss
. Possible options are fMBV
, which uses the loss function
\(fMBV = max(Bias(\beta)^2, Var(\beta))\) and fMSE
, which uses the loss function
\(fMSE = Bias(\beta)^2 + Var(\beta)\).
To balance the influence of covariates, it is recommended
that the design matrix be standardized. This can be done by
the user or via the argument scale
. If scale=TRUE
,
then coefficient and standard error estimates are back-transformed.
Use the XtXlamIinv
argument with caution. No checks are done on the provided
value. Note that lseq
is re-ordered to be decreasing, and provided values
of XtXlamIinv
must account for this.