compute Delgado and Manteiga (2001) test statistic for testing the hypothesis H0: E[Y|X,Z] = E[Y|X]
computeDMStat(Y, X, Z, a = NA, ckertype = "gaussian", stat = "CvM")
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 |
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") |
a list containing the following elements: 'teststat' value of the test statistic, 'epsilonhat' the residuals from a nonparametric regression from Y on X, 'Yhat' the predicted values from a nonparametric regression of Y on X, 'a' the bandwidth(s)
Y <- rnorm(100) X <- rnorm(100) Z <- rnorm(100) computeDMStat(Y, X, Z, a=NA, ckertype="gaussian", stat="CvM")#> Multistart 1 of 1 | Multistart 1 of 1 | Multistart 1 of 1 | Multistart 1 of 1 / Multistart 1 of 1 | Multistart 1 of 1 |#> $teststat #> [1] 8.70047e-17 #> #> $epsilonhat #> [1] -0.841542480 -0.171533515 0.720167939 0.464384022 -1.173598398 #> [6] -0.568664924 -1.411129299 1.242402136 0.537229928 1.037889978 #> [11] 0.441428470 0.053240869 -1.889171017 -1.113507670 0.073043129 #> [16] 0.576247021 0.330484133 0.231687162 2.139097473 -0.316254306 #> [21] -1.216367564 0.032932634 0.863347525 2.540678010 1.083617018 #> [26] -0.938301264 -0.613178106 -0.981559092 -0.373396718 -0.787662458 #> [31] -2.384977613 -1.093731501 -0.904986122 0.376200671 2.458935596 #> [36] -0.563396658 -0.434204832 -1.501512900 -0.092692250 -1.934703935 #> [41] 0.774788189 -0.316924064 -1.204729126 -1.140998942 -1.029269754 #> [46] 0.434053744 -2.129036554 -1.201846462 1.103262901 0.083349406 #> [51] 1.064311346 -0.981637053 -0.033859416 1.823732680 -0.873778362 #> [56] 0.606497246 0.708437347 -0.884262143 0.152123090 0.474468482 #> [61] 0.199998827 1.412795878 0.309439564 -0.424551224 0.529199538 #> [66] 1.709172050 -0.197979927 1.218965907 0.916121093 -2.492955659 #> [71] -0.595625948 0.032415064 1.806927934 -0.089508624 0.617799727 #> [76] 0.846937036 -0.870559956 0.390143304 0.469465039 -0.520719055 #> [81] 1.166051930 -0.996152576 0.970641273 -1.042614315 0.644808408 #> [86] -0.297860727 -0.375865794 -0.068094438 -0.942497766 -0.143876512 #> [91] 0.287208936 -0.080928352 -0.008866186 2.126864257 0.040847351 #> [96] -0.564976102 0.540166353 0.256873192 0.643682184 1.251484668 #> #> $Yhat #> [1] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [7] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [13] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [19] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [25] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [31] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [37] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [43] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [49] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [55] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [61] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [67] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [73] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [79] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [85] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [91] -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> [97] -0.08206395 -0.08206395 -0.08206395 -0.08206395 #> #> $a #> [1] 10814227 #>