Description Usage Arguments Value Examples
This function implments mpersonalized
and use cross validatation to tune penalty parameter.
The optimal penalty parameter is selected by minimizing
∑_{i=1}^{n_k}\frac{|\hat{C}_k(X_{i})|}{∑_{i=1}^{n_k}|\hat{C}_k(X_{i})|}\bigl [1\{\hat{C}_k(X_{i})>0\}-g_k(X_{i})\bigr]^2
in the leave-out fold, where \hat{C}_k(X_{i}) in the leave-out fold is independently estimated from the training set.
1 2 3 4 5 6 7 8 9 10 11 12 13 | mpersonalized_cv(problem = c("meta-analysis", "multiple outcomes"), X,
Trt, P = NULL, Xlist, Ylist, Trtlist,
Plist = replicate(length(Xlist), NULL, simplify = FALSE),
typelist = replicate(length(Xlist), "continuous", simplify = FALSE),
penalty = c("lasso", "GL", "SGL", "fused", "lasso+fused", "GL+fused",
"SGL+fused", "SGL+SL"), lambda1 = NULL, lambda2 = NULL,
tau0 = NULL, single_rule_lambda = NULL,
num_lambda1 = ifelse(!is.null(lambda1), length(lambda1), 10),
num_lambda2 = ifelse(!is.null(lambda2), length(lambda2), 10),
num_tau0 = ifelse(!is.null(tau0), length(tau0), 11), min_tau = 0.01,
num_single_rule_lambda = ifelse(!is.null(single_rule_lambda),
length(single_rule_lambda), 50), alpha = NULL, single_rule = FALSE,
cv_folds = 5, admm_control = NULL, contrast_builder_control = NULL)
|
problem |
A character string specifiy whether user want to solve "meta-analysis" or
"multiple outcomes" problem. For |
X |
Covariate matrix that should be supplied when |
Trt |
Treatment vector that should be supplied when |
P |
Propensity score vector when |
Xlist |
A list object that should be supplied when |
Ylist |
When |
Trtlist |
A list object that should be supplied when |
Plist |
A list object that should be supplied when |
typelist |
A list object with kth element denoting the type of outcome corresponding
to the kth element in |
penalty |
For different rules, the penalty could be "lasso", "GL", "SGL", "fused",
"lasso+fused", "GL+fused", "SGL+fused", or "SGL+SL". For single rule, the penalty could only be "lasso".
For |
lambda1 |
λ_1 in the framework of different rules. If not supplied, a default sequence will be computed. |
lambda2 |
λ_2 in the framework of different rules. If not supplied, a default sequence will be computed. |
tau0 |
Parameter τ_0 for the |
single_rule_lambda |
λ_{single} in the framework of single rule. |
num_lambda1 |
If |
num_lambda2 |
If |
num_tau0 |
If |
min_tau |
If |
num_single_rule_lambda |
If |
alpha |
α in the framework of different rules. If not supplied, a default value
will be used depending on |
single_rule |
A logical value, whether the single treatment framework is used. Deafult is |
cv_folds |
Number of folds needed for cross-validation. Default is 5 |
admm_control |
A list of parameters which user can specify to control the admm algorithm.
In |
contrast_builder_control |
A list of parameters which user can specify to control estimation of
contrast function. In |
An S3 object of class "mp_cv", which contains the information of the model with the optimal lambda. It can be supplied to some other functions in mperosnalized package for further analysis or prediction.
penalty_parameter_sequence |
A matrix object with each row denoting a configuration of the penalty parameters. |
opt_penalty_parameter |
Optimal penalty parameter chosen by minimizing the cross validation error. |
intercept |
The vector of intercepts corresponding to the optimal penalty parameter. |
beta |
The coefficient matrix corresponding to the optimal penalty parameter. |
number_covariates |
Number of candidate covariates considered. |
number_studies_or_outcomes |
Number of studies if |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 | set.seed(123)
sim_dat = simulated_dataset(n = 200, problem = "meta-analysis")
Xlist = sim_dat$Xlist; Ylist = sim_dat$Ylist; Trtlist = sim_dat$Trtlist
# fit different rules with group lasso penalty
mp_cvmod_diff = mpersonalized_cv(problem = "meta-analysis",
Xlist = Xlist, Ylist = Ylist, Trtlist = Trtlist,
penalty = "GL", single_rule = FALSE)
mp_cvmod_diff$intercept
mp_cvmod_diff$beta
# fit a single rule with lasso penalty
mp_cvmod_single = mpersonalized_cv(problem = "meta-analysis",
Xlist = Xlist, Ylist = Ylist, Trtlist = Trtlist,
penalty = "lasso", single_rule = TRUE)
mp_cvmod_single$intercept
mp_cvmod_single$beta
set.seed(NULL)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.