Skip to contents

Creates propensity scores and inverse probability of treatment weights (IPTW) using a regularized logistic regression.

Usage

createPs(
  cohortMethodData,
  population = NULL,
  createPsArgs = createCreatePsArgs()
)

Arguments

cohortMethodData

An object of type CohortMethodData as generated using getDbCohortMethodData().

population

A data frame describing the population. This should at least have a rowId column corresponding to the rowId column in the CohortMethodData covariates object and a treatment column. If population is not specified, the full population in the CohortMethodData will be used.

createPsArgs

And object of type CreatePsArgs as created by the createCreatePsArgs() function

Details

IPTW estimates either the average treatment effect (ate) or average treatment effect in the treated (att) using stabilized inverse propensity scores (Xu et al. 2010).

References

Xu S, Ross C, Raebel MA, Shetterly S, Blanchette C, Smith D. Use of stabilized inverse propensity scores as weights to directly estimate relative risk and its confidence intervals. Value Health. 2010;13(2):273-277. doi:10.1111/j.1524-4733.2009.00671.x

Examples

data(cohortMethodDataSimulationProfile)
cohortMethodData <- simulateCohortMethodData(cohortMethodDataSimulationProfile, n = 1000)
#> Generating covariates
#> Generating treatment variable
#> Generating cohorts
#> Generating outcomes after index date
#> Generating outcomes before index date
ps <- createPs(cohortMethodData, createPsArgs = createCreatePsArgs())
#> Removing 1 redundant covariates
#> Removing 0 infrequent covariates
#> Normalizing covariates
#> Tidying covariates took 4.01 secs
#> Propensity model fitting finished with status OK
#> Creating propensity scores took 13.7 secs