Title: | Rolling Entry Matching |
---|---|
Description: | Functions to perform propensity score matching on rolling entry interventions for which a suitable "entry" date is not observed for nonparticipants. For more details, please reference Witman et al. (2018) <doi:10.1111/1475-6773.13086>. |
Authors: | Rob Chew [aut, cre], Kasey Jones [aut, cre], Mahin Manley [aut], Allison Witman [res], Chris Beadles [res], Yiyan Liu [res], Ann Larson [res] |
Maintainer: | Rob Chew <[email protected]> |
License: | MIT + file LICENSE |
Version: | 2.0.3 |
Built: | 2025-02-10 04:59:07 UTC |
Source: | https://github.com/rtiinternational/rollmatch |
Preprocessing Step to Rolling Entry Matching
reduce_data(data, treat, tm, entry, id, lookback = 1)
reduce_data(data, treat, tm, entry, id, lookback = 1)
data |
Original dataset before reduce_data() was ran. |
treat |
String for name of treatment variable in data. |
tm |
String for time period indicator variable name in data. |
entry |
String for name of time period in which the participant enrolled in the intervention (in the same units as the tm variable). |
id |
String for individual id variable name in data. |
lookback |
The number of time periods to look back before the time period of enrollment (1-...). |
reduced_data
returns a dataset of reduced data ready
for propensity scoring and to use in the function score_data()
data(package="rollmatch", "rem_synthdata_small") reduced_data <- reduce_data(data = rem_synthdata_small, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id", lookback = 1) reduced_data
data(package="rollmatch", "rem_synthdata_small") reduced_data <- reduce_data(data = rem_synthdata_small, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id", lookback = 1) reduced_data
This dataset represents a synthetic population of individuals who resemble Medicare fee-for-service patients in terms of age, race, spending, inpatient visits, ED visits, chronic conditions, and dual eligibility. The quasi-panel dataset contains multiple observations of non-participants (one for each entry period). Participants enter the data once in the baseline period immediately preceding their unique entry into the intervention. Time-varying covariates (e.g., health conditions, spending, utilization) are dynamic for each entry period's non-participant observations.
rem_synthdata
rem_synthdata
A data frame with 254,400 observations and 20 variables:
The unique identifier for each individual.
The period in which the individual enrolled in treatment / entered the intervention.
Last baseline quarter before entry into the intervention.
Time variable, indicating the quarter that the variables are measured.
Treatment indicator variable (=1 if in treatment group and =0 if in control group).
The patient's age.
Race indicator variable (=1 if identified as Black, =0 if not).
Physical disability indicator variable (=1 if identified as disabled, =0 if not).
Disease indicator variable (=1 if identified as having End Stage Renal Disease (ESRD), =0 if not).
Ethnicity indicator variable (=1 if identified as Hispanic, =0 if not).
Gender indicator variable (=1 if identified as Male, =0 if not).
Race indicator variable (=1 if identified as White, =0 if not).
Indicates the person had an ED visit during LQ.
Indicates the person had an inpatient stay during LQ.
Count of ED visits during quarters LQ-5 to LQ-1.
Count of inpatient stays during quarters LQ-4 to LQ-1.
Number of months of dual Medicare-Medicaid eligibility in the previous year.
Number of chronic conditions.
Payments during the quarter.
Payments during the previous 4 quarters.
This dataset represents a synthetic population of individuals who resemble
Medicare fee-for-service patients in terms of age, race, spending,
inpatient visits, ED visits, chronic conditions, and dual eligibility.
The quasi-panel dataset contains multiple observations of non-participants
(one for each entry period). Participants enter the data once in the baseline
period immediately preceding their unique entry into the intervention.
Time-varying covariates (e.g., health conditions, spending, utilization) are
dynamic for each entry period's non-participant observations.
This is a smaller version of rem_synthadata
.
rem_synthdata_small
rem_synthdata_small
A data frame with 12,720 observations and 20 variables:
The unique identifier for each individual.
The period in which the individual enrolled in treatment / entered the intervention.
Last baseline quarter before entry into the intervention.
Time variable, indicating the quarter that the variables are measured.
Treatment indicator variable (=1 if in treatment group and =0 if in control group).
The patient's age.
Race indicator variable (=1 if identified as Black, =0 if not).
Physical disability indicator variable (=1 if identified as disabled, =0 if not).
Disease indicator variable (=1 if identified as having End Stage Renal Disease (ESRD), =0 if not).
Ethnicity indicator variable (=1 if identified as Hispanic, =0 if not).
Gender indicator variable (=1 if identified as Male, =0 if not).
Race indicator variable (=1 if identified as White, =0 if not).
Indicates the person had an ED visit during LQ.
Indicates the person had an inpatient stay during LQ.
Count of ED visits during quarters LQ-5 to LQ-1.
Count of inpatient stays during quarters LQ-4 to LQ-1.
Number of months of dual Medicare-Medicaid eligibility in the previous year.
Number of chronic conditions.
Payments during the quarter.
Payments during the previous 4 quarters.
rollmatch
is the last of 3 main functions in the rollmatch package
<rollmatch> implements a comparison group selection
methodology for interventions with rolling participant entry over time.
A difficulty in evaluating rolling entry interventions is that a suitable
"entry" date is not observed for non-participants. This method, called
rolling entry matching, assigns potential comparison non-participants
multiple counterfactual entry periods which allows for matching of
participant and non-participants based on data immediately preceding each
participant's specific entry period, rather than using data from a fixed
pre-intervention period.
rollmatch( scored_data, data, treat, tm, entry, id, vars, lookback, alpha = 0, standard_deviation = "average", num_matches = 3, replacement = TRUE )
rollmatch( scored_data, data, treat, tm, entry, id, vars, lookback, alpha = 0, standard_deviation = "average", num_matches = 3, replacement = TRUE )
scored_data |
Output from scored_data() or the output from reduce_data() with propensity scores labeled "score". |
data |
Original dataset before reduce_data() was ran. |
treat |
String for name of treatment variable in data. |
tm |
String for time period indicator variable name in data. |
entry |
String for name of time period in which the participant enrolled in the intervention (in the same units as the tm variable). |
id |
String for individual id variable name in data. |
vars |
Vector of column names used in the propensity score algorithm. This is used when creating the balance table. |
lookback |
The number of time periods to look back before the time period of enrollment (1-...). |
alpha |
Part of the pre-specified distance within which to allow
matching. The caliper width is calculated as the |
standard_deviation |
String. 'average' for average pooled standard deviation, 'weighted' for weighted pooled standard deviation, and 'None' to not use a standard deviation multiplication. Default is "average". |
num_matches |
Number of comparison beneficiary matches to attempt to assign to each treatment beneficiary. Default is 3. |
replacement |
Assign comparison beneficiaries with replacement (TRUE)
or without replacement (FALSE). If |
Rolling entry matching requires preliminary steps. This package will assist the user in steps 2 and 3. First, a quasi-panel dataset is constructed containing multiple observations of non-participants (one for each entry period). Participants enter the data once in the baseline period immediately preceding their unique entry into the intervention. Time-varying covariates (e.g., health conditions, spending, utilization) are dynamic for each entry period's non-participant observations. The user of rollmatch is expected to have already created this quasi-panel dataset. Second, the pool of potential comparisons for each participant is restricted to those that have the same "entry period" into the intervention (see function "reduce_data"). Finally, a predicted probability of treatment is obtained for participants and non-participants (e.g. through propensity score matching). The user can use function "score_data" to complete this step, or create use their own propensity score calculation.
The final step consists of the matching algorithm. The algorithm selects the best matched comparison(s) for each participant from the pool of non-participants with the same entry period. This is completed via the function "rollmatch".
rollmatch
returns an object of class "rollmatch".
An object of class "rollmatch" is a list containing the following components:
model |
The output of the model used to estimate the distance measure. |
scores |
The propensity scores used in the matching algorithm. |
data |
The original dataset with all matches added. |
summary |
A basic summary table with counts of matched and unmatched data. |
ids_not_matched |
A vector of the treatment IDs that were not matched. |
total_not_matched |
The number of treatment IDs not matched. |
matched_data |
R data.frame of matches with scores, matching information, and the weights of the individuals |
balance |
table showing the full treatment, full control, matched treatment, and matched comparison group means and standard deviations for the variables used in the model. |
data(package="rollmatch", "rem_synthdata_small") reduced_data <- reduce_data(data = rem_synthdata_small, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id", lookback = 1) fm <- as.formula(treat ~ qtr_pmt + yr_pmt + age) vars <- all.vars(fm) scored_data <- score_data(reduced_data = reduced_data, model_type = "logistic", match_on = "logit", fm = fm, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id") output <- rollmatch(scored_data, data=rem_synthdata_small, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id", vars = vars, lookback = 1, alpha = .2, standard_deviation = "average", num_matches = 3, replacement = TRUE) output
data(package="rollmatch", "rem_synthdata_small") reduced_data <- reduce_data(data = rem_synthdata_small, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id", lookback = 1) fm <- as.formula(treat ~ qtr_pmt + yr_pmt + age) vars <- all.vars(fm) scored_data <- score_data(reduced_data = reduced_data, model_type = "logistic", match_on = "logit", fm = fm, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id") output <- rollmatch(scored_data, data=rem_synthdata_small, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id", vars = vars, lookback = 1, alpha = .2, standard_deviation = "average", num_matches = 3, replacement = TRUE) output
Create propensity scores using a logistic or probit regression model
score_data(reduced_data, model_type, match_on, fm, treat, tm, entry, id)
score_data(reduced_data, model_type, match_on, fm, treat, tm, entry, id)
reduced_data |
Dataframe of reduced treatment and comparison data. See output of reduce_data(). |
model_type |
Use logistic regression ("logistic") or "probit" regression ("probit") to estimate the predicted probability of participating |
match_on |
Match on estimated propensity score ("pscore") or logit of estimated propensity score ("logit"). |
fm |
A |
treat |
String for name of treatment variable in data. |
tm |
String for time period indicator variable name in data. |
entry |
String for name of time period in which the participant enrolled in the intervention (in the same units as the tm variable). |
id |
String for individual id variable name in data. |
A copy of reduced_data input with added propensity scores
## Not run: data(package="rollmatch", "rem_synthdata_small") fm <- as.formula(treat ~ qtr_pmt + age + is_male + is_white) reduced_data <- reduce_data(data = rem_synthdata_small, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id", lookback = 1) scored_data <- score_data(reduced_data = reduced_data, model_type = "logistic", match_on = "logit", fm = fm, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id") head(scored_data) ## End(Not run)
## Not run: data(package="rollmatch", "rem_synthdata_small") fm <- as.formula(treat ~ qtr_pmt + age + is_male + is_white) reduced_data <- reduce_data(data = rem_synthdata_small, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id", lookback = 1) scored_data <- score_data(reduced_data = reduced_data, model_type = "logistic", match_on = "logit", fm = fm, treat = "treat", tm = "quarter", entry = "entry_q", id = "indiv_id") head(scored_data) ## End(Not run)