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)
set.seed(123)
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)
## Full time x strategy summary
print(m_static)
## Use fewer digits in the numeric summaries
print(m_static, digits = 2)
## Focus on a subset of strategies (e.g., 1 and 3)
print(m_static, strategies = c(1, 3))
## Focus on early time points only (e.g., times 1, 2)
print(m_static, times = c(1, 2))
## Combine selection: only strategies 1 and 3 over times 1, 2, 3
print(m_static, strategies = c(1, 3), times = 1:3)
## ------------------------------------------------------------------
## Example 2: Non-constant intervention strategies (matrix abar)
## Strategies can have different target values at different time points
## ------------------------------------------------------------------
## Rows define strategies, columns define time points.
## The first row increases over time, the second decreases, the third increases.
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)
## Time x strategy summary where targets vary over time within strategies
print(m_matrix)
## Focus on strategies 1 and 3 over a subset of time points
print(m_matrix, strategies = c(1, 3), times = 1:3)
# }
Run the code above in your browser using DataLab