get_cod: Evaluate the Effective Random Forest Adjusted Sample

View source: R/get_cod.R

get_codR Documentation

Evaluate the Effective Random Forest Adjusted Sample

Description

This function returns the "coefficient of distortion" (COD) which reflects the exent to which the effective sample produced via random forest adjustment differs from the nominal (raw) data sample prior to covariate adjustment (see Aronow and Samii 2016). The COD is the weighted mean of a given de-meaned and standardized covariate used in covariate adjustment where the weights are equivalent to the squared residual error for a given observation from the random forest regression used to partial out variation in the explanatory variable of interest given the set of covariates adjusted for via random forest adjustment. The COD thus represents the difference in standard deviation units between the effective sample used to identify the relationship between the explanatory variable of interest and the response, and the nominal sample used prior to estimation.

Usage

get_cod(rfa, include_se = TRUE, bootsims = 1000)

Arguments

rfa

an 'rfa()' fitted object.

include_se

set to TRUE by default. If TRUE, will return standard errors with summary statistics for each of the estimated CODs.

bootsims

set to 1,000 by default. If 'include_se = TRUE', the number of bootstrap iterations to perform in estimating standard errors.

Details

The function accepts an 'rfa' fitted object, and returns a tibble containing the COD for each covariate included in estimation, and its standard error. Standard errors are produced via bootstrapping.

Value

The function returns a data frame containing at minimum a vector of covariate names ('term') and the estimated COD per covariate ('estimate'). If 'include_se = TRUE', additional entries include the standard error, test statistic, p-value, and 95

References

Aronow, Peter M. and Cyrus Samii. 2016. "Does Regression Produce Representative Estimates of Causal Effects?" American Journal of Political Science 60(1): 250-67.


milesdwilliams15/RFA documentation built on Sept. 26, 2023, 4:31 a.m.