predict.mp: Prediction for a Fitted "mp" Object

Description Usage Arguments Details Value Examples

Description

This function predicts optimal treatment of new subjects for a mpersonalized model. If different rules are used in the fitting procedure, an overall treatment recommendation based on all stuides/outcomes could be provided together with optimal treatments for each study/outcome.

Usage

1
2
3
## S3 method for class 'mp'
predict(object, newx = NULL, weight = NULL,
  overall_rec = TRUE, ...)

Arguments

object

A fitted "mp" object returned by "mpersonalized"

newx

Covariate matrix of new patients. If not supplied, by default the prediction is for the original dataset in the "mp" object. Notice: when problem = "meta-analysis" and the prediction is for the original dataset, subjects in each study are only predicted using the treatment recommendation rule of the study they belong to.

weight

A weight vector for the overall recommendation, only needed when overall_rec = TRUE. By default, equal weights are assigned to each study/outcome.

overall_rec

A logical value. If overall_rec = TRUE, an overall recommendation will be provided as an weighted average of the optimal treatment from each individual study/outcome. Only useful when newx is provided.

...

not used

Details

This function predicts for each penalty parameter in the penalty_parameter_sequence of the "mp" object. The overall recommended treatment is given as an weighted average of the recommended treatments from each study/outcome, and the weight can be specified by user.

Value

A list object of two elements. .

opt_treatment

A list object with each element denoting the prediction based on a penalty parameter configuration in mp$penalty_parameter_sequence. Specifically, if newx is provided, each element is a recommendation matrix with each row denoting a subject and each column denoting a study/outcome; otherwise, each element is a list of vectors with each vector representing the optimal treatment for each study/outcome. If overall_rec = TRUE, the weighted overall recommended treatment will be further provided as well. If the overall recommened treatment is equal to 0.5, it means the weighted sum is equal for 0 and 1.

benefit_score

A list object of benefit scores computed from g_1, …, g_K. Similar structure as opt_treatment.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
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 SGL penalty for this meta-analysis problem
mp_mod_diff = mpersonalized(problem = "meta-analysis",
                            Xlist = Xlist, Ylist = Ylist, Trtlist = Trtlist,
                            penalty = "SGL", single_rule = FALSE)

newx = matrix(rnorm(100 * mp_mod_diff$number_covariates), nrow = 100)

# predict on newx
pred_new = predict(object = mp_mod_diff, newx = newx, overall_rec = TRUE)

# predict on old dataset
pred_old = predict(object = mp_mod_diff)
set.seed(NULL)

chenshengkuang/mpersonalized documentation built on May 28, 2019, 7:16 p.m.