Learn R Programming

rddtools (version 1.6.0)

covarTest_mean: Testing for balanced covariates: equality of means with t-test

Description

Tests equality of means by a t-test for each covariate, between the two full groups or around the discontinuity threshold

Usage

covarTest_mean(
  object,
  bw = NULL,
  paired = FALSE,
  var.equal = FALSE,
  p.adjust = c("none", "holm", "BH", "BY", "hochberg", "hommel", "bonferroni")
)

# S3 method for rdd_data covarTest_mean( object, bw = NULL, paired = FALSE, var.equal = FALSE, p.adjust = c("none", "holm", "BH", "BY", "hochberg", "hommel", "bonferroni") )

# S3 method for rdd_reg covarTest_mean( object, bw = NULL, paired = FALSE, var.equal = FALSE, p.adjust = c("none", "holm", "BH", "BY", "hochberg", "hommel", "bonferroni") )

Arguments

object

object of class rdd_data

bw

a bandwidth

paired

Argument of the t.test function: logical indicating whether you want paired t-tests.

var.equal

Argument of the t.test function: logical variable indicating whether to treat the two variances as being equal

p.adjust

Whether to adjust the p-values for multiple testing. Uses the p.adjust function

Value

A data frame with, for each covariate, the mean on each size, the difference, t-stat and ts p-value.

See Also

covarTest_dis for the Kolmogorov-Smirnov test of equality of distribution

Examples

Run this code
# NOT RUN {
data(house)

## Add randomly generated covariates
set.seed(123)
n_Lee <- nrow(house)
Z <- data.frame(z1 = rnorm(n_Lee, sd=2), 
                z2 = rnorm(n_Lee, mean = ifelse(house<0, 5, 8)), 
                z3 = sample(letters, size = n_Lee, replace = TRUE))
house_rdd_Z <- rdd_data(y = house$y, x = house$x, covar = Z, cutpoint = 0)

## test for equality of means around cutoff:
covarTest_mean(house_rdd_Z, bw=0.3)

## Can also use function covarTest_dis() for Kolmogorov-Smirnov test:
covarTest_dis(house_rdd_Z, bw=0.3)

## covarTest_mean works also on regression outputs (bw will be taken from the model)
reg_nonpara <- rdd_reg_np(rdd_object=house_rdd_Z)
covarTest_mean(reg_nonpara)
# }

Run the code above in your browser using DataLab