Xsq.ceTk {nnspat} | R Documentation |
Chi-square Approximation to Cuzick and Edwards T_k
Test statistic
Description
An object of class "Chisqtest"
performing a chi-square approximation for Cuzick and Edwards T_k
test statistic
based on the number of cases within k
NNs of the cases in the data.
This approximation is suggested by Tango (2007) since T_k
statistic had high
skewness rendering the normal approximation less efficient. The chi-square approximation is as follows:
\frac{T_k- ET_k}{\sqrt{Var T_k}} \approx \frac{\chi^2_\nu-\nu}{\sqrt{2 \nu}}
where \chi^2_\nu
is a chi-square
random variable with \nu
df, and \nu=8/skewnees(T_k)
(see SkewTk
for the skewness).
The argument cc.lab
is case-control label, 1 for case, 0 for control, if the argument case.lab
is NULL
,
then cc.lab
should be provided in this fashion, if case.lab
is provided, the labels are converted to 0's
and 1's accordingly.
The logical argument nonzero.mat
(default=FALSE
) is for using the A
matrix if FALSE
or just the matrix of nonzero
locations in the A
matrix (if TRUE
).
The logical argument asy.var
(default=FALSE
) is for using the asymptotic variance or the exact (i.e., finite
sample) variance for the variance of T_k
in its standardization.
If asy.var=TRUE
, the asymptotic variance is used for Var[T_k]
(see asyvarTk
), otherwise the exact
variance (see varTk
) is used.
See also (Tango (2007)) and the references therein.
Usage
Xsq.ceTk(
dat,
cc.lab,
k,
case.lab = NULL,
nonzero.mat = TRUE,
asy.var = FALSE,
...
)
Arguments
dat |
The data set in one or higher dimensions, each row corresponds to a data point. |
cc.lab |
Case-control labels, 1 for case, 0 for control |
k |
Integer specifying the number of NNs (of subject |
case.lab |
The label used for cases in the |
nonzero.mat |
A logical argument (default is |
asy.var |
A logical argument (default is |
... |
are for further arguments, such as |
Value
A list
with the elements
statistic |
The chi-squared test statistic for Tango's chi-square approximation to Cuzick & Edwards' |
p.value |
The |
df |
Degrees of freedom for the chi-squared test, which is |
estimate |
Estimates, i.e., the observed |
est.name , est.name2 |
Names of the estimates, they are almost identical for this function. |
null.value |
Hypothesized null value for Cuzick & Edwards' |
method |
Description of the hypothesis test |
data.name |
Name of the data set, |
Author(s)
Elvan Ceyhan
References
Tango T (2007). “A class of multiplicity adjusted tests for spatial clustering based on case-control point data.” Biometrics, 63, 119-127.
See Also
Examples
set.seed(123)
n<-20
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(0:1,n,replace = TRUE)
k<-sample(1:5,1) # try also 1, 3, 5,
k
Xsq.ceTk(Y,cls,k)
Xsq.ceTk(Y,cls,k,nonzero.mat=FALSE)
Xsq.ceTk(Y,cls+1,k,case.lab = 2)
Xsq.ceTk(Y,cls,k,method="max")
Xsq.ceTk(Y,cls,k,asy.var=TRUE)