estimate_ps: Estimate propensity score

View source: R/estimation.R

estimate_psR Documentation

Estimate propensity score

Description

This function trains the propensity score models using SuperLearner, applying cross-validation to compute out-of-fold estimates.

Usage

estimate_ps(
  A,
  X,
  folds,
  SL.library = c("SL.glm", "SL.mean"),
  V = 2L,
  threshold = 0.01
)

Arguments

A

A binary vector or matrix of length n indicating treatment assignment (0 or 1).

X

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

folds

A list of cross-validation folds (e.g., a list of indices for each fold).

SL.library

Vector of libraries for training SuperLearner (c("SL.glm", "SL.mean") by default).

V

Number of folds inside the SuperLearner (2L by default).

threshold

A numeric scalar that sets the minimum allowed value for upper and lower bound estimations (1e-2 by default). Constrains estimation to ⁠[threshold, 1 - threshold]⁠.

Value

A fold-specific function predicting propensity score given treatment (A) and covariates (X)


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