| stratifyByPs | R Documentation |
Use the provided propensity scores to stratify persons. Additional stratification variables for stratifications can also be used.
stratifyByPs(
population,
stratifyByPsArgs = createStratifyByPsArgs(),
cohortMethodData = NULL
)
population |
A data frame with the three columns described below |
stratifyByPsArgs |
An object of type |
cohortMethodData |
An object of type CohortMethodData as generated using
|
The data frame should have the following three columns:
rowId (numeric): A unique identifier for each row (e.g. the person ID).
treatment (integer): Column indicating whether the person is in the target (1) or comparator (0) group.
propensityScore (numeric): Propensity score.
Returns a tibble with the same columns as the input data plus one extra column: stratumId.
rowId <- 1:200
treatment <- rep(0:1, each = 100)
propensityScore <- c(runif(100, min = 0, max = 1), runif(100, min = 0, max = 1))
data <- data.frame(rowId = rowId, treatment = treatment, propensityScore = propensityScore)
result <- stratifyByPs(data, createStratifyByPsArgs(numberOfStrata = 5))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.