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
rowIdcolumn corresponding to therowIdcolumn in the CohortMethodData covariates object and atreatmentcolumn. If population is not specified, the full population in the CohortMethodData will be used.- createPsArgs
And object of type
CreatePsArgsas created by thecreateCreatePsArgs()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 = 100)
#> Generating covariates
#> Generating treatment variable
#> Generating cohorts
#> Generating outcomes after index date
#> Generating outcomes before index date
ps <- createPs(cohortMethodData, createPsArgs = createCreatePsArgs())
#> Removing 0 redundant covariates
#> Removing 0 infrequent covariates
#> Normalizing covariates
#> Tidying covariates took 4.89 secs
#> Warning: All coefficients (except maybe the intercept) are zero. Either the covariates are completely uninformative or completely predictive of the treatment. Did you remember to exclude the treatment variables from the covariates?
#> Propensity model fitting finished with status OK
#> Creating propensity scores took 5.73 secs