plot.policy_data {polle} | R Documentation |
Plot policy data for given policies
Description
Plot policy data for given policies
Usage
## S3 method for class 'policy_data'
plot(
x,
policy = NULL,
which = c(1),
stage = 1,
history_variables = NULL,
jitter = 0.05,
...
)
Arguments
x |
Object of class policy_data |
policy |
An object or list of objects of class policy |
which |
A subset of the numbers 1:2
|
stage |
Stage number for plot 2 |
history_variables |
character vector of length 2 for plot 2 |
jitter |
numeric |
... |
Additional arguments |
Examples
library("polle")
library("data.table")
setDTthreads(1)
d3 <- sim_multi_stage(2e2, seed = 1)
pd3 <- policy_data(data = d3$stage_data,
baseline_data = d3$baseline_data,
type = "long",
id = "id",
stage = "stage",
event = "event",
action = "A",
utility = "U")
# specifying two static policies:
p0 <- policy_def(c(1,1,0,0), name = "p0")
p1 <- policy_def(c(1,0,0,0), name = "p1")
plot(pd3)
plot(pd3, policy = list(p0, p1))
# learning and plotting a policy:
pe3 <- policy_eval(pd3,
policy_learn = policy_learn(),
q_models = q_glm(formula = ~t + X + X_lead))
plot(pd3, list(get_policy(pe3), p0))
# plotting the recommended actions at a specific stage:
plot(pd3, get_policy(pe3),
which = 2,
stage = 2,
history_variables = c("t","X"))
[Package polle version 1.4 Index]