Cost functions for the assignment of a dynamic treatment rule to individual segments identified by realizations of segmentation covariate strata. These functions are used in conjunction with assign_rule for the assignment of a treatment rule. There are three types of cost functions:

1. cost_threshold, which enforces a fixed boundary for learning the dynamic treatment rule. This cost_fun requires a given cutoff against which to threshold the estimated CATE. Those segments with a CATE exceeding the threshold are assigned the treatment, while the treatment is withheld from those segments whose estimated CATE falls below.

2. cost_budget, which data adaptively learns a cost boundary for assignment of a treatment rule. This cost_fun requires as input a maximum proportion of units to receive treatment (and, optionally, any observation-level weights), used to derive a cutoff for thresholding of the estimated CATE. Those segments with estimated CATEs exceeding this learned threshold are assigned treatment and others not. Note that this procedure fails to solve the so-called knapsack problem, instead choosing to treat those segments with the highest estimated CATEs while possibly failing to exhaust the given budget.

3. cost_knapsack, which, similar to cost_budget, searches for a cost boundary for the assigment of a treatment rule data adaptively. In assigning segments to treatment, this routine solves the binary knapsack problem, using the approximate combinatorial optimization routine through knapsack. The result of this routine often mirrors that of cost_budget, except that solving the knapsack problem ensures that the budget is approximately exhausted.

cost_threshold(data_with_cate, threshold = 0, type = c("inferential",
"analytic"))

cost_budget(data_with_cate, budget, cost_weights = rep(1,
nrow(data_with_cate)), type = c("inferential", "analytic"))

cost_knapsack(data_with_cate, budget, use_segment_treatment_cost = FALSE,
type = c("inferential", "analytic"))

## Arguments

data_with_cate A data.table containing the input data, augmented with cross-validated nuisance parameter estimates and an estimate of the CATE. This input object should b ecreated by successive calls to set_est_data and est_cate, or through a wrapper function that composes these function calls automatically, and is passed on to the cost functions through assign_rule. A numeric value indicating the cutoff to be used in determining the treatment decision based on the estimated CATE. The default of zero assigns treatment to segments that ought to benefit from treatment while withholding treatment from those segments that ought to be harmed. It may suit to adjust this value based on the problem context. This is used in cost_threshold. A character string (of length one) specifying how the treatment decision based on the CATE is to be made. There are two options: "inferential" (the default) uses a hypothesis test to evaluate whether the estimated CATE is statistically different from a threshold and allocates a treatment decision based on the resultant p-value. "analytic" simply evaluates whether the estimated CATE exceeds a given threshold and assigns treatment to segments for which this holds. Note that in both cases the threshold must be either provided directly (as an input to cost_threshold) or will be discovered based on specified constraints (as in cost_budget). A numeric indicating the proportion of units to receive treatment. This proportion is used to discover a cutoff for thresholding of the estimated CATE. This is used in cost_budget. A numeric vector giving the observation-level weights to be used in computing the cutoff for thresholding of the CATE in cost_budget. By default, all units are given equal weight. A logical indicating whether the cost associated with treating a segment should be taken into account when deciding which segments to treat via cost_knapsack. This option defaults to FALSE, but if set to TRUE, the treatment cost must have been specified as an attribute previously.