View source: R/other_approaches.R
| oracular_approach_algorithm | R Documentation |
Learns an optimal treatment policy under constraints using true data structures.
It begins by validating and preprocessing the input data.
Subsequently, it approximates the optimal treatment policy via the Frank-Wolfe optimization algorithm.
The procedure includes an inner grid search over candidate values of lambda and beta to identify the policy
that maximizes the expected primary outcome (policy value) while satisfying a constraint on the expected rate of adverse events.
oracular_approach_algorithm(
X,
A,
Y,
Xi,
folds,
ncov,
delta_Mu,
delta_Nu,
scenario_mu,
scenario_nu,
Lambdas = seq(1, 8, by = 1),
alpha = 0.1,
precision = 0.05,
B = c(0.05, 0.1, 0.25, 0.5),
centered = FALSE,
root.path
)
X |
A matrix of covariates of size n x d (input data in |
A |
A binary vector of size n indicating treatment assignment (0 or 1). |
Y |
A numeric vector or matrix of length n representing primary outcomes (in |
Xi |
A numeric vector or matrix of length n indicating adverse events (0 or 1). |
folds |
A list of cross-validation folds (e.g., a list of indices for each fold). |
ncov |
An integer indicating the number of covariates in synthetic setting. |
delta_Mu |
A function that computes the treatment effect (mu difference) from covariates. |
delta_Nu |
A function that computes the selection effect (nu difference) from covariates. |
scenario_mu |
String indicating the type of scenario for delta_Mu ("Linear", "Threshold", "Mix"). |
scenario_nu |
String indicating the type of scenario for delta_Nu ("Linear", "Threshold", "Mix"). |
Lambdas |
A sequence of non-negative numeric scalars controlling the penalty for violating the constraint (seq(1,8,by=1) by default). |
alpha |
A numeric scalar representing the constraint tolerance (in |
precision |
A numeric scalar defining the desired convergence precision (0.05 by default). The number of Frank-Wolfe iterations (K) is inversely proportional to this value, calculated as 1/precision. |
B |
A vector of non-negative scalars controlling the sharpness of the treatment probability function (c(0.05, 0.1, 0.25, 0.5) by default). |
centered |
A logical value indicating whether to apply centering in |
root.path |
Path to the folder where all results are to be saved. |
A list of matrices (theta_0 and theta_final), or theta_0 alone. These matrices are used to construct the optimal treatment rule in two steps. First, build psi using the make_psi function and evaluate it at X (i.e., psi(X)). Then, obtain the optimal treatment rule by applying sigma_beta to the selected beta attribute (sigma_beta(psi(X), beta)).
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.