Learn R Programming

rddtools (version 1.6.0)

covarTest_dis: Testing for balanced covariates: equality of distribution

Description

Tests equality of distribution with a Kolmogorov-Smirnov for each covariates, between the two full groups or around the discontinuity threshold

Usage

covarTest_dis(
  object,
  bw,
  exact = NULL,
  p.adjust = c("none", "holm", "BH", "BY", "hochberg", "hommel", "bonferroni")
)

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

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

Arguments

object

object of class rdd_data

bw

a bandwidth

exact

Argument of the ks.test function: NULL or a logical indicating whether an exact p-value should be computed.

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 K-S statistic and its p-value.

See Also

covarTest_mean for the t-test of equality of means

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)

## Kolmogorov-Smirnov test of equality in distribution:
covarTest_dis(house_rdd_Z, bw=0.3)

## Can also use function covarTest_dis() for a t-test for equality of means around cutoff:
covarTest_mean(house_rdd_Z, bw=0.3)
## covarTest_dis works also on regression outputs (bw will be taken from the model)
reg_nonpara <- rdd_reg_np(rdd_object=house_rdd_Z)
covarTest_dis(reg_nonpara)
# }

Run the code above in your browser using DataLab