Learn R Programming

ivmodel (version 1.9.1)

getCovMeanDiffs: Get Covariate Mean Differences

Description

getCovMeanDiffs returns the covariate mean differences between two groups.

Usage

getCovMeanDiffs(X, indicator)

Value

Covariate mean differences between two groups.

Arguments

X

Covariate matrix (with units as rows and covariates as columns).

indicator

Binary indicator vector (must contain 1 or 0 for each unit). For example, could be a binary treatment or instrument.

Author

Zach Branson and Luke Keele

References

Branson, Z. and Keele, L. (2020). Evaluating a Key Instrumental Variable Assumption Using Randomization Tests. American Journal of Epidemiology. To appear.

Examples

Run this code
	#load the data
	data(icu.data)
	#the covariate matrix is
	X = as.matrix(subset(icu.data, select = -c(open_bin, icu_bed)))
	#covariate mean differences across the treatment
	getCovMeanDiffs(X = X, indicator = icu.data$icu_bed)
	#covariate mean differences across the instrument
	getCovMeanDiffs(X = X, indicator = icu.data$open_bin)

Run the code above in your browser using DataLab