predict.nuisance_functions {polle}R Documentation

Predict g-functions and Q-functions

Description

predict() returns the fitted values of the g-functions and Q-functions when applied to a (new) policy data object.

Usage

## S3 method for class 'nuisance_functions'
predict(object, new_policy_data, ...)

Arguments

object

Object of class "nuisance_functions". Either g_functions or q_functions as returned by policy_eval() or policy_learn().

new_policy_data

Policy data object created by policy_data().

...

Additional arguments.

Value

data.table with keys id and stage and variables g_a or Q_a for each action a in the actions set.

Examples

library("polle")
### Single stage:
d <- sim_single_stage(5e2, seed=1)
pd <- policy_data(d, action="A", covariates=list("Z", "B", "L"), utility="U")
pd
# defining a static policy (A=1):
pl <- policy_def(1, name = "A=1")

# doubly robust evaluation of the policy:
pe <- policy_eval(policy_data = pd,
                  policy = pl,
                  g_models = g_glm(),
                  q_models = q_glm())
# summarizing the estimated value of the policy:
pe

# getting the fitted g-function values:
head(predict(get_g_functions(pe), pd))

# getting the fitted Q-function values:
head(predict(get_q_functions(pe), pd))

[Package polle version 1.4 Index]