Description Usage Arguments Value References Examples
NPtest_indept performs the test of independence between the response variable and a single covariate when there is potentially heteroscedastic treatment effects present (see Wang, Tolos and Wang (2010)).
1 | NPtest_indept(dat, k = 7)
|
dat |
A data frame with three columns named X, trt, and Y, where X is the covarite, trt is the treatment level, and Y is the response variable. |
k |
An odd integer to specify the number of nearest neighbors to be used in augmentation. Generally recommend to use 3, 5, or 7. |
A list containing the following variables:
Asys_var: the asymptotic variance for the test statistics
Tstat: the test statistic
pvalue: the p-value of the test under H0: independence between X and Y.
Haiyan Wang, Siti Tolos, and Suojin Wang (2010). A Distribution Free Nonparametric Test to Detect Dependence Between a Response Variable and Covariate in Presence of Heteroscedastic Treatment Effects. The Canadian Journal of Statistics. 38(3), 408433. Doi:10.1002/cjs.10068
1 2 3 4 5 | n=64; X=runif(n); trt=gl(2, n/2)
e=rnorm(n, 0, 0.1)
Y=ifelse(trt==1, 4*(X-0.5)^2+e, 2*X+e)
dat=data.frame(X, Y, trt)
NPtest_indept(dat, k=7)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.