HX: Compute the Inverse Propensity Score Weight (IPW)

View source: R/utils.R

HXR Documentation

Compute the Inverse Propensity Score Weight (IPW)

Description

This function computes the inverse propensity score weight based on treatment assignment and a propensity score model.

Usage

HX(A, X, prop_score)

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

prop_score

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

Value

A numeric value representing the inverse propensity score weight.

Examples

# Example usage:
prop_model <- function(A, X) { 0.5 }  # Constant propensity score for illustration
HX(1, data.frame(x1 = 1, x2 = 2), prop_model)


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