DMTest: perform the Delgado and Manteiga (2001) test

View source: R/dmtest.r

DMTestR Documentation

perform the Delgado and Manteiga (2001) test

Description

perform the Delgado and Manteiga (2001) test of the hypothesis of conditional mean independence (E[Y|X,Z] = E[Y|X]) or conditional independence (Y is independent of Z given X)

Usage

DMTest(
  Y,
  X,
  Z,
  size = 0.05,
  B = 100,
  a = NA,
  ckertype = "gaussian",
  stat = "CvM",
  indep = FALSE
)

Arguments

Y

n-dim. vector containing the observations on the outcome

X

matrix with n rows containing the observations on the scalar or vector X

Z

matrix with n rows containing the observations on the scalar or vector Z

size

scalar between 0 and 1, denoting the nominal size of the test (default: 0.05)

B

integer denoting the number of bootstrap samples to be used (default: 100)

a

vector of bandwidths, of the same dimension as there are columns in X, if unspecified, then the bandwidths are determined by cross-validation from nonparametric regression of Y on X

ckertype

character string denoting the kernel function to be used, as in np package (default: "gaussian")

stat

character string denoting the type of test statistic to be computed: Cramer-von-Mises ("CvM", default) or Kolmogorov-Smirnov ("KS")

indep

logical; FALSE means that conditional mean independence is tested, otherwise conditional independence

Value

a list containing the following elements: 'teststat' value of the test statistic, 'cv' bootstrap critical value, 'rej' a 1-0 indicator for whether the test rejects or not, 'pval' p-value, 'a' the bandwidth(s)

Examples

Y <- rnorm(100)
X <- rnorm(100)
Z <- rnorm(100)
DMTest(Y, X, Z, size=0.05, B=100, a=NA, ckertype="gaussian", stat="CvM")

danielwilhelm/R-ME-test documentation built on June 21, 2022, 6:50 p.m.