Xsq.ceTk: Chi-square Approximation to Cuzick and Edwards T_k Test...

Xsq.ceTkR 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 kNNs of the cases in the data.

This approximation is suggested by \insertCitetango: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}{√{Var T_k}} \approx \frac{χ^2_ν-ν}{√{2 ν}} where χ^2_ν is a chi-square random variable with ν df, and ν=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 (\insertCitetango:2007;textualnnspat) 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 i).

case.lab

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.

nonzero.mat

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.

asy.var

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.

Value

A list with the elements

statistic

The chi-squared test statistic for Tango's chi-square approximation to Cuzick & Edwards' T_k test for disease clustering.

p.value

The p-value for the hypothesis test

df

Degrees of freedom for the chi-squared test, which is 8/skewness where skewness is the output of SkewTk function.

estimate

Estimates, i.e., the observed T_k value.

est.name,est.name2

Names of the estimates, they are almost identical for this function.

null.value

Hypothesized null value for Cuzick & Edwards' T_k, which is ET_k.

method

Description of the hypothesis test

data.name

Name of the data set, dat

Author(s)

Elvan Ceyhan

References

\insertAllCited

See Also

ceTk, ZceTk and SkewTk

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)


nnspat documentation built on Aug. 30, 2022, 9:06 a.m.