Description Usage Arguments Value Author(s) See Also Examples
This function serves two purposes from a fitted "owl" object. It can recommend treatments for a new independent sample with partial or full subject features observed up to a certain stage. If subject feautures, treatment assignments and outcomes are fully observed in the new sample, this function can also evaluate the estimated DTR on this new sample, returning the empirical value function and benefit function.
1 2 |
object |
fitted "owl" object |
H |
subject history information before treatment at the |
AA |
observed treatment assignments at the |
RR |
observed outcomes at the |
K |
number of stages of |
pi |
treatment assignment probabilities of the observed treatments at the K stages for all subjects in the new sample. It is a vector if |
... |
further arguments passed to or from other methods. |
fit |
fitted decision functions at the K stages for each subject in the new sample. It is a list of K vectors. |
probability |
estimated probability that treatment 1 (vs. -1) is the optimal treatment at each stage for each subject in the new sample. It's calculated by exp(fit)/(1 + exp(fit)). It is a list of K vectors. |
treatment |
recommennded optimal treatments at the K stages for each subject in the new sample. It is a list of K vectors. |
valuefun |
overall empirical value function under the fitted DTR evaluated on the new sample. It is returned only when |
benefit |
overall empirical benefit function under the estimated DTR evaluated on the new sample. It is returned only when |
pi |
treatment assignment probabilities of the assigned treatments at the K stages for each subject in the new sample. If |
Yuan Chen, Ying Liu, Donglin Zeng, Yuanjia Wang
Maintainer: Yuan Chen <yc3281@columbia.edu><irene.yuan.chen@gmail.com>
owl
, sim_Kstage
, ql
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | # simulate 2-stage training and test sets
n_train = 100
n_test = 500
n_cluster = 10
pinfo = 10
pnoise = 20
train = sim_Kstage(n_train, n_cluster, pinfo, pnoise, K=2)
H1_train = scale(train$X)
H2_train = scale(cbind(H1_train, train$A[[1]], H1_train * train$A[[1]]))
pi_train = list(rep(0.5, n_train), rep(0.5, n_train))
test = sim_Kstage(n_test, n_cluster, pinfo, pnoise, train$centroids, K=2)
H1_test = scale(test$X)
H2_test = scale(cbind(H1_test, test$A[[1]], H1_test * train$A[[1]]))
pi_test = list(rep(0.5, n_test), rep(0.5, n_test))
# estimate DTR with owl on the training sample
owl_train = owl(H=list(H1_train, H2_train), AA=train$A, RR=train$R, n=n_train, K=2,
pi=pi_train, loss='hinge', augment=TRUE, m=3)
# evaluate the DTR when full information are observed on the new sample
owl_test = predict(owl_train, H=list(H1_test, H2_test), AA=test$A, RR=test$R, K=2)
owl_test$treatment
owl_test$valuefun
owl_test$pi
# recommned the first-stage treatments only
owl_test2 = predict(owl_train, H=H1_test, K=1)
owl_test$treatment
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.