Description Usage Arguments Details Value Author(s) Examples
View source: R/predict.itrfit.R
Predict the options based on "itrfit"
object.
1 2 |
obj |
object of class inheriting from |
newdata |
an optional data frame or a data matrix in which to look for variables with which to predict. If omitted, the fitted options are used. |
option |
the option used for prediction. |
delta |
a numeric value greater than -1 used for predicting A-ITR, can be omitted if |
fence |
a numeric value greater than 0 used for predicting A-ITR, can be omitted if |
c |
a numeric value no less than 1, ignored unless |
There are two prediction methods for "itrfit"
object when option = "refine"
. One is based on bent loss, where a one-step estimation is applied. Another is based on differentiable loss, which is a two-step estimation procedure. We recommand the first method in practice.
predict.itrfit
preduces a 0-1 matrix of class "ITR"
, where the column names are the treatment levels and ith row indicates which treatments are suggested to ith patient. Specifically, 1
stands for "suggested" and 0
stands for "not suggested".
Haomiao Meng
1 2 3 4 5 6 7 8 9 10 11 12 13 14 | data(sim1)
train = sim1[1:1000, ]
test = sim1[3001:5000, ]
res = itrFit(train[, 1:2], train[, 3], train[, 4], kernel = "polynomial", d = 4, lambda = 5^(4:11)) #bent hinge loss fit
rule = predict(res, test[, 1:2], option = "normal") #prediction for ITR
plot(test[, 1], test[, 2], col = pred_to_num(rule) + 1)
rule = predict(res, test[, 1:2]) #prediction for A-ITR using the one-step estimation
plot(test[, 1], test[, 2], col = pred_to_num(rule) + 1)
res = itrFit(train[, 1:2], train[, 3], train[, 4], c = 1, method = "log", kernel = "polynomial", d = 2, lambda = 5^(0:8)) #common logistic loss (unbent) fit
rule = predict(res, test[, 1:2], c = 1.2) #prediction for A-ITR using the two-step estimation
plot(test[, 1], test[, 2], col = pred_to_num(rule) + 1)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.