stand: Standardize covariate vector for balance constraint

Description Usage Arguments Value

View source: R/stand.R

Description

This function is used by generate_constraints() to standardize covariate vectors to become balance constraints. The function divides the covariate values by the treated or average group standard deviation (across strata).

Usage

1
stand(z, x, denom_variance = "treated", treated = 1, autogen_missing = 50)

Arguments

z

a factor with the ith entry equal to the treatment of unit i.

x

a covariate vector with ith entry equal to the covariate value of unit i. This should have the same order of units and length as z.

denom_variance

character stating what variance to use in the standardization: either the default "treated", meaning the standardization will use the treated variance (across all strata), where the treated group is declared in the treated argument, or "pooled", meaning the standardization will use the average of the variances of each treatment group.

treated

which treatment value should be considered the treated units. This must be one of the values of z.

autogen_missing

whether to automatically generate missingness constraint and how heavily to prioritize it. Should be a numeric or NULL value. NULL indicates that a constraint to balance the rate of missingness (denoted by NA in x) should not be automatically generated. Note that this is not recommended unless the user has already accounted for missing values. If not NULL, autogen_missing should be a numeric stating how heavily to prioritize generated missingness constraints over covariate constraint. The default is 50.

Value

A list with two components:

covariate

a balance constraint for the standardized covariate values of all unites.

missingness

a corresponding balance constraint for the rate of missingness if autogen_missing not NULL, otherwise NULL.


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