Last chance! 50% off unlimited learning
Sale ends in
Last chance! 50% off unlimited learning
Sale ends in
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;textualnnspat 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;textualnnspat) and the references therein.
Xsq.ceTk(
dat,
cc.lab,
k,
case.lab = NULL,
nonzero.mat = TRUE,
asy.var = FALSE,
...
)
A list
with the elements
The chi-squared test statistic for Tango's chi-square approximation to Cuzick & Edwards' \(T_k\) test for disease clustering.
The \(p\)-value for the hypothesis test
Degrees of freedom for the chi-squared test, which is \(8/\)skewness where skewness is the output of
SkewTk
function.
Estimates, i.e., the observed \(T_k\) value.
Names of the estimates, they are almost identical for this function.
Hypothesized null value for Cuzick & Edwards' \(T_k\), which is \(ET_k\).
Description of the hypothesis test
Name of the data set, dat
The data set in one or higher dimensions, each row corresponds to a data point.
Case-control labels, 1 for case, 0 for control
Integer specifying the number of NNs (of subject \(i\)).
The label used for cases in the cc.lab
(if cc.lab
is not provided then the labels are converted
such that cases are 1 and controls are 0), default is NULL
.
A logical argument (default is TRUE
) to determine whether the \(A\) matrix or the matrix of
nonzero locations of the \(A\) matrix will be used in the computations.
If TRUE
the nonzero location matrix is used, otherwise the \(A\) matrix itself is used.
A logical argument (default is FALSE
) to determine whether the asymptotic variance or
the exact (i.e., finite sample) variance for the variance of \(T_k\) in its standardization.
If TRUE
, the asymptotic variance is used for \(Var[T_k]\), otherwise the exact variance is used.
are for further arguments, such as method
and p
, passed to the dist
function.
Elvan Ceyhan
ceTk
, ZceTk
and SkewTk
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)
Run the code above in your browser using DataLab