score_data: Run a logistic or probit model

Description Usage Arguments Value Examples

View source: R/score_data.R

Description

Run a logistic or probit model

Usage

1
score_data(reduced_data, model_type, match_on, fm, treat, tm, entry, id)

Arguments

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 formula in the form treat ~ x1 + x2 ... where treat is a binary treatment indicator (Treat = 1, Control = 0) and x1 and x2 are pre-treatment covariates. Both the treatment indicator and pre-treatment covariates must be contained in the input dataset.

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.

Value

A copy of reduced_data input with added propensity scores

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
## 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)

rollmatch documentation built on July 8, 2020, 6:56 p.m.