Description Usage Arguments Details Value Examples
Covariate Balance Test
1 2 3 4 5 6 7 8 9 10 11 |
data |
Dataset containing ML input variables X, treatment assignment Z, and aps. |
aps |
Vector of APS values. |
X |
Object containing ML inputs X. |
Z |
Vector of ML recommendation values Z. |
degen |
Vector of values for which APS is degenerate. Defaults to c(0,1). |
apslab |
Column name of APS variable. Defaults to "APS". |
xlab |
Character vector of column names of ML inputs X. Defaults to c("X1"). |
zlab |
Column name of Z variable. Defaults to "Z". |
verbose |
Boolean indicator for whether to print summary output of estimation. Defaults to True. |
If the primary data vectors (aps, X, Z) are not passed, then the fallback is to search for the
_lab
variables in the data
object.
This function estimates a multivariate multiple regression system, varying each of the ML input variables
in X
against the common covariates APS
and Z
, where APS
is non-degenerate.
The covariate balance test reports the
results of each individual regression, as well as the joint hypothesis result for the coefficient on Z
.
This helps to establish whether APS
performs adequately as a control for differences created through
treatment selection. The regression system is estimated on the sample for which APS
is non-degenerate.
List containing fitted multivariate multiple linear model and the results of the joint hypothesis test, including the F statistic and p-value of the Pillai's trace statistic.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | # Iris data
data("iris")
assign_cutoff <- function(X, cutoff){
ret <- as.integer(X > cutoff)
return(ret)
}
model <- lm(Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width, data=iris)
aps <- estimate_aps(iris, model, xc = names(iris)[2:4], infer=FALSE, s=400,
delta=0.8, fcn=assign_cutoff, cutoff = 6)
Z <- assign_cutoff(iris$Sepal.Length, 6)
X <- iris[,2:4]
iris[, APS := aps]
iris[, Z := Z]
# Two ways of sending inputs
out_direct <- covariate_balance_test(aps = aps, X = iris[, 2:4], Z = Z)
out_indirect <- covariate_balance_test(data = iris, apslab = "APS",
xlab = names(iris)[2:4])
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.