add_balance_table: Add the balancing table to the final output

Description Usage Arguments Value Examples

View source: R/utility_functions.R

Description

Add the balancing table to the final output

Usage

1
2
add_balance_table(scored_data, vars, tm, id, combined_output, treat,
  matches)

Arguments

scored_data

The dataframe from score_data()

vars

See rollmatch()

tm

See rollmatch()

id

See rollmatch()

combined_output

A list of output for the rollmatch package. See make_output

treat

See rollmatch()

matches

Dataframe containing the matches from comparison_pool

Value

output returns a list with the additional output:

balance

The balancing table.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Not run: 
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(model_type = "logistic", match_on = "logit", fm = fm,
                          reduced_data = reduced_data, treat = "treat",
                          tm = "quarter", entry = "entry_q", id = "indiv_id")
comparison_pool <- compare_pool(scored_data, treat = "treat",
                                tm = "quarter", entry = "entry_q",
                                id = "indiv_id")
trimmed_pool <- trim_pool(alpha = .2, comparison_pool = comparison_pool,
                          scored_data = scored_data, treat = "treat",
                          tm = "quarter", standard_deviation = 'average')
matches <- create_matches(trimmed_pool = trimmed_pool, tm = "quarter",
                          num_matches = 3, replacement = TRUE)
matches <- add_matches_columns(matches)
combined_output <- make_output(scored_data = scored_data,
                               data = rem_synthdata_small,
                               matches = matches,
                               treat = "treat", tm = "quarter",
                               entry = "entry_q", id = "indiv_id", lookback = 1)
# Add balance table to the output
output <- add_balance_table(scored_data = scored_data, vars = vars,
                            tm = "quarter", id = "indiv_id",
                            combined_output = combined_output,
                            treat = "treat", matches = matches)

## End(Not run)

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