parse_formula: Parse the nonstandard balance formulas

Description Usage Arguments Value

View source: R/parse_formula.R

Description

This function takes nonstandard formulas as inputs and returns regular formulas as well as lists of weights to be used in generate_constraints().

Usage

1
parse_formula(balance_formula, default_rhs = NULL, data = NULL)

Arguments

balance_formula

a formula that may have multiple terms on the left hand side, "." on the left hand side, and coefficients, making it not a standard formula.

default_rhs

the list of balance_formulas can also contain entries that are just the character corresponding to a covariate to balance. If so, the covariate will be balanced according to default_rhs.

data

a data frame containing the relevant covariates in the columns. The number of rows should equal the length of treated.

Value

A named list containing new_formula: the standard formula to be used in generate_constraints, rhs_weights: a named list with the coefficients of the terms on the right hand side, and lhs_weights: a named list with coefficients of the terms on the left hand side.


natstrat documentation built on Oct. 15, 2021, 5:12 p.m.