Skip to contents

Fit binary-outcome CATE scores and estimate risk differences in nested subgroups. This is the binary-outcome interface used by catefit.

Usage

catefitbinary(
  data,
  outcome_model = NULL,
  outcome_method = "logistic",
  benefit_model = NULL,
  benefit_method = "t_learner",
  ps_model,
  ps_method = "glm",
  minPS = 0.01,
  maxPS = 0.99,
  higher.y = TRUE,
  prop.cutoff = seq(0.5, 1, length = 6),
  seed = NULL,
  ps.control = list(),
  B = 3,
  Kfold = 5,
  tree.depth = 2,
  n.trees.boosting = 200,
  plot.gbmperf = FALSE,
  ...
)

Arguments

data

A data frame containing the variables in the outcome and treatment models; a data frame with n rows (1 row per observation).

outcome_model

A formula specifying the outcome and baseline covariates.

outcome_method

Outcome-model method paired with benefit_method. For a T-learner, "logistic" (default) or "boosting"; for two-regression, "logistic".

benefit_model

Optional one-sided formula specifying the covariates and terms for the two-regression or contrast-regression score. The default NULL uses the covariates and terms of outcome_model. An intercept is required and offsets are not supported. T-learner scores use the outcome model directly and do not use this formula. In a mixed fit it applies only to two-regression and contrast regression. Continuous-outcome fitting is not implemented.

benefit_method

Score-construction methods; defaults to "t_learner". See catefit.

ps_model

A formula describing the treatment model (propensity-score model) to be fitted. The treatment must appear on the left-hand side. For binary outcomes, logical treatment values FALSE and TRUE are mapped to 0 and 1, respectively. Numeric 0/1 values or two distinct treatment labels are also accepted. If data are from a randomized controlled trial, specify ps_model = trt ~ 1 as an intercept-only model.

ps_method

A character value for the method to estimate the propensity score. Allowed values include one of: 'glm' for logistic regression with main effects only (default), or 'lasso' for a logistic regression with main effects and LASSO penalization on two-way interactions (added to the model if interactions are not specified in ps_model). Relevant only when ps_model has more than one variable.

minPS

A numerical value (in `[0, 1]`) below which estimated propensity scores should be truncated. Default is 0.01.

maxPS

A numerical value (in `(0, 1]`) above which estimated propensity scores should be truncated. Must be strictly greater than minPS. Default is 0.99.

higher.y

A logical value indicating whether higher (TRUE) or lower (FALSE) values of the outcome are more desirable. Default is TRUE.

prop.cutoff

A vector of numerical values (in `(0, 1]`) specifying percentiles of the estimated risk-difference CATE scores to define nested subgroups. Each element represents the cutoff to separate observations in nested subgroups (below vs above cutoff). The length of prop.cutoff is the number of nested subgroups. An equally-spaced sequence of proportions ending with 1 is recommended. Default is seq(0.5, 1, length = 6).

seed

An optional integer specifying an initial randomization seed for reproducibility. Default is NULL, corresponding to no seed.

ps.control

Named options for LASSO propensity-score interaction screening. Supported entry: solver = "C" (default) or solver = "R". Only affects screening when ps_method = "lasso"; the LASSO fit and interaction selection rule are unchanged. Kept separate from boosting's ... and other numerical controls.

B

Number of repetitions of cross-fitting for benefit_method = 'two_regression' or 'contrast_regression'. Default is 3.

Kfold

A positive integer specifying the number of folds used in cross-fitting to partition the data in benefit_method = 'two_regression' and 'contrast_regression'. Default is 5.

tree.depth

A positive integer specifying the maximum depth of boosting trees. Used when outcome_method = 'boosting'. Default is 2.

n.trees.boosting

The maximum number of boosting trees, used when outcome_method = 'boosting'. Default is 200.

plot.gbmperf

Whether to plot boosting performance measures when outcome_method = 'boosting'. Default is FALSE.

...

Additional boosting options. See boosting-control. Deprecated argument names from precmed 1.1.0 remain supported for backward compatibility and emit warnings.

Value

A catefit object containing treatment labels, fitted models, predicted risk-difference scores and nested subgroup risk differences for each requested method. Linear twoReg score coefficients are stored in coefficients.

Details

See the Binary outcomes section of catefit for the score methods, their assumptions, and interpretation. Subgroup effects are estimated on the fitting data and do not provide independent validation.

Author

Thomas Debray tdebray@fromdatatowisdom.com

Examples

# \donttest{
dat <- simulate_binary(n = 400, seed = 2026)
fit <- catefitbinary(data = dat,
                     outcome_model = y ~ age + previous_treatment,
                     outcome_method = "logistic",
                     benefit_method = "t_learner",
                     ps_model = trt ~ age + previous_treatment,
                     seed = 2026)
# }