LASSO | R Documentation |
Applies the LASSO to raw spontaneous report data.
Every event is regressed on all the drugs in the data set.
The function returns a data frame with every drug-event pair
and the estimated regression coefficient.
In case there are not enough observations of an event (the
event must appear at least twice), the regression is not
performed. All the regression estimates for the drugs and that
particular event are set to 0
. The entries in the lambda
column of the data frame are set to NA
.
Shrinkage parameter
One can set the shrinkage parameter with the argument lambda
in a number of ways:
lambda = NULL
(Default). The parameter is set
through cross-validation. The number of folds can be set with
nfolds
(Default = 10). The loss function used can be set
with type.measure
(Default = deviance
). See for
other type.measure
options the function glmnet::cv.glmnet
.
The glmnet::cv.glmnet
function returns two estimates:
lambda.min
and lambda.1se
. To use the former, set
lambda.type
to "min"
(default). For the latter, type
"1se"
.
Set to one value, e.g., lambda = 0.5
. The same shrinkage parameter
is used for all events.
A vector of length n_events
, e.g., lambda = c(0.5, 0.8, 1)
. The
shrinkage parameters are specified for each event individually.
LASSO(
reports,
n_drugs,
n_events,
lambda = NULL,
nfolds = 10,
type.measure = "deviance",
lambda.type = "min",
alpha = 1,
event_ids = 1:n_events,
verbose = FALSE
)
reports |
A binary matrix, where each row represents a report |
n_drugs , n_events |
The number of drugs and events |
lambda |
Shrinkage parameter. Can be a list of length |
nfolds |
Number of folds used for cross-validation |
type.measure |
Loss function used (Default: |
lambda.type |
Type of estimate that is used (either |
alpha |
The elastic net mixing parameter (Default: 1.0 - LASSO) |
event_ids |
IDs of the events evaluated (Default: all) |
verbose |
Verbosity (Default: |
A data frame with the columns
drug_id |
ID for the drug (simply numbered 1,2,3,...etc.) |
event_id |
ID for the event (simply numbered 1,2,3,...etc.) |
lambda |
The shrinkage parameter |
LASSO |
The regression parameter after regressing all drugs to the event in question |
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.