trimByPs: Trim persons by propensity score

Description Usage Arguments Details Value Examples

View source: R/PsFunctions.R

Description

Use the provided propensity scores to trim subjects with extreme scores.

Usage

1
trimByPs(population, trimFraction = 0.05)

Arguments

population

A data frame with the three columns described below

trimFraction

This fraction will be removed from each treatment group. In the target group, persons with the highest propensity scores will be removed, in the comparator group person with the lowest scores will be removed.

Details

The data frame should have the following three columns:

Value

Returns a tibble with the same three columns as the input.

Examples

1
2
3
4
5
rowId <- 1:2000
treatment <- rep(0:1, each = 1000)
propensityScore <- c(runif(1000, min = 0, max = 1), runif(1000, min = 0, max = 1))
data <- data.frame(rowId = rowId, treatment = treatment, propensityScore = propensityScore)
result <- trimByPs(data, 0.05)

escott12/CohortMethod documentation built on Dec. 20, 2021, 6:37 a.m.