naive_approach_algorithm: Naive approach main algorithm

View source: R/other_approaches.R

naive_approach_algorithmR Documentation

Naive approach main algorithm

Description

Learning an optimal treatment policy under constraints. This function begins by validating and preprocessing the input data, and assumes that the nuisance components mu0, nu0, and prop_score (train and test), have already been estimated. Subsequently, it estimates 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.

Usage

naive_approach_algorithm(
  X,
  A,
  Y,
  Xi,
  folds,
  mu0_train,
  mu0_test,
  nu0_train,
  nu0_test,
  prop_score_train,
  prop_score_test,
  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
)

Arguments

X

A matrix of covariates of size n x d (input data in ⁠[0,1]⁠).

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 ⁠[0,1]⁠).

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).

mu0_train

A function predicting primary outcome (Y) given treatment (A) and covariates (X) for training.

mu0_test

A fold-specific function predicting primary outcome (Y) given treatment (A) and covariates (X) for testing.

nu0_train

A function predicting adverse event outcome (Xi) given treatment (A) and covariates (X) for training.

nu0_test

A function predicting adverse event outcome (Xi) given treatment (A) and covariates (X) for testing.

prop_score_train

A function that estimates the propensity score given treatment (A) and covariates (X) for training.

prop_score_test

A function that estimates the propensity score given treatment (A) and covariates (X) for testing.

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 ⁠[0,1/2]⁠, 0.1 by default).

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 sigma_beta (FALSE by default).

root.path

Path to the folder where all results are to be saved.

Value

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)).


PLUCR documentation built on March 30, 2026, 5:08 p.m.