data(EFV)
# \donttest{
Lnodes <- c("adherence.1","weight.1",
"adherence.2","weight.2",
"adherence.3","weight.3",
"adherence.4","weight.4")
Ynodes <- c("VL.0","VL.1","VL.2","VL.3","VL.4")
Anodes <- c("efv.0","efv.1","efv.2","efv.3","efv.4")
## ------------------------------------------------------------------
## Example 1: Static grid of Targets (vector abar)
## Each strategy uses the same target value at every time-point
## ------------------------------------------------------------------
abar_static <- seq(0, 10, by = 2)
m_static <- feasible(X = EFV,
Anodes = Anodes,
Lnodes = Lnodes,
Ynodes = Ynodes,
d.method = "parametric",
abar = abar_static,
grid.size = NULL,
left.boundary = 0,
right.boundary = 10)
## Feasible vs Target with time on x-axis (default).
## Colors indicate Targets (Abar), and short ticks show Abar at each time.
plot(m_static, which = "feasible")
## Feasible vs Target with time on x-axis.
plot(m_static, x.axis = "time", which = "feasible")
## Non-overlap ratio
plot(m_static, which = "nonoverlap")
## Facet by time to reduce overplotting
plot(m_static, which = "feasible", facet = "time")
## ------------------------------------------------------------------
## Example 2: Non-constant intervention strategies (matrix abar)
## Strategies can have different target values at different time-points
## ------------------------------------------------------------------
## Here rows define strategies and columns define time-points.
abar_matrix <- rbind(
c(0, 2, 4, 6, 8), # strategy 1
c(9, 6, 2, 1, 0), # strategy 2
c(1, 3, 5, 7, 9) # strategy 3
)
set.seed(456)
m_matrix <- feasible(X = EFV,
Anodes = Anodes,
Lnodes = Lnodes,
Ynodes = Ynodes,
d.method = "parametric",
abar = abar_matrix,
grid.size = 1,
left.boundary = 0,
right.boundary = 10)
## Feasible vs Target with time on the x-axis.
## Colors represent strategies; short ticks at each time show
## the corresponding Abar for each strategy.
plot(m_matrix,
x.axis = "time",
which = "feasible",
facet = "none")
## Feasible vs Target with strategy on the x-axis.
## Strategies no longer use the same target at all time-points,
## so the x-axis stays on the strategy index, and ticks at each
## strategy indicate the Abar values across time.
plot(m_matrix,
x.axis = "strategy",
which = "feasible",
facet = "none")
## Non-overlap ratio for these non-constant strategies,
## shown over time and faceted by strategy for clarity.
plot(m_matrix,
x.axis = "time",
which = "nonoverlap",
facet = "strategy")
# }
Run the code above in your browser using DataLab