### Two stages:
d <- sim_two_stage(5e2, seed=1)
pd <- policy_data(d,
action = c("A_1", "A_2"),
covariates = list(L = c("L_1", "L_2"),
C = c("C_1", "C_2")),
utility = c("U_1", "U_2", "U_3"))
pd
# evaluating the static policy a=1:
pe <- policy_eval(policy_data = pd,
policy = policy_def(1, reuse = TRUE),
g_models = g_glm(),
q_models = q_glm())
# getting the fitted g-functions:
(g_functions <- get_g_functions(pe))
# getting the fitted Q-functions:
(q_functions <- get_q_functions(pe))
# getting the fitted values:
head(predict(g_functions, pd))
head(predict(q_functions, pd))
Run the code above in your browser using DataLab