weight.calculate.ps: The Inverse Probability Weight (IPW) for Average Treatment...

View source: R/Methods.R

weight.calculate.psR Documentation

The Inverse Probability Weight (IPW) for Average Treatment Effect (ATE)

Description

This function calculates the IPW for ATE as Tr/ps + (1-Tr)/(1-ps), where Tr is the treatment indicator and ps is the propensity score.

Usage

weight.calculate.ps(Z, ps, standardize = TRUE)

Arguments

Z

The binary treatment indicator. A vector with 2 unique numeric values in 0 = untreated and 1 = treated.

ps

The propensity score used to calculate the IPW weight. A vector with numeric values greater than 0 and less than 1. The length of "ps" should equal to the length of "Z".

standardize

If standardize the calculated IPW or not. When standardize = FALSE, the weights are calculated by the IPW definition shown in the description. standardize = TRUE by default, which makes the the sum of weights be 1 in the untreated/treated group.

Value

A list containing the following components:

  • "weight": The IPW weights calculated by the input propensity score

  • "ps": The input propensity score

Examples

KS = Kang_Schafer_Simulation(n = 1000, seeds = 5050)
tr = KS$Data[,2]
true.ps = KS$Data[,11]
true.w = weight.calculate.ps(Z = tr, ps = true.ps, standardize = TRUE)
summary(true.w$weight)
c(sum(true.w$weight[which(tr==0)]), sum(true.w$weight[which(tr==1)]))


fiona19832008/PSLB documentation built on April 14, 2022, 12:41 a.m.