evalITR: Evaluate a Fitted ITR or A-ITR

Description Usage Arguments Value Author(s) Examples

View source: R/evalITR.R

Description

Evaluate the goodness of fit for predicted ITR or A-ITR.

Usage

1
2
## S3 method for class "ITR"
evalITR(rule, a, y, p = 1/d[2])

Arguments

rule

object of class inheriting from "ITR".

a

an optional 0-1 matrix with the same dimemsion of the first argument or a vector indicating the actual treaments the patients received.

y

a numeric vector indicating the outcome after taking the treatment.

p

a numeric vector with each element between 0 to 1, indicating the probability of the treatment been assigned to the patient.

Value

evalFit returns a numeric value indicating the expected outcome under the fitted rule.

Author(s)

Haomiao Meng

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
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))

rule = predict(res, test[, 1:2], option = "normal")
evalITR(rule, test[, 3], test[, 4]) #evaluate prediction for ITR

rule = predict(res, test[, 1:2])
evalITR(rule, test[, 3], test[, 4]) #evaluate prediction for A-ITR

menghaomiao/itrrnr documentation built on June 21, 2020, 2:22 a.m.