Learn R Programming

nnspat (version 0.1.2)

SkewTk: Skewness of Cuzick and Edwards \(T_k\) Test statistic

Description

This function estimates the skewness of Cuzick and Edwards \(T_k\) test statistic under the RL hypothesis. Skewness of a random variable \(T\) is defined as \(E(T-\mu)^3/(E(T-\mu)^2)^{1.5}\) where \(\mu=E T\).

Skewness is used for Tango's correction to Cuzick and Edwards kNN test statistic, \(T_k\). Tango's correction is a chi-square approximation, and its degrees of freedom is estimated using the skewness estimate (see page 121 of tango:2007;textualnnspat).

The argument, \(n_1\), is the number of cases (denoted as n1 as an argument) and k is the number of NNs considered in \(T_k\) test statistic. The argument of the function is the \(A_{ij}\) matrix, a, which is the output of the function aij.mat. However, inside the function we symmetrize the matrix a as b <- (a+a^t)/2, to facilitate the formulation.

The number of cases are denoted as \(n_1\) and number of controls as \(n_0\) in this function to match the case-control class labeling, which is just the reverse of the labeling in cuzick:1990;textualnnspat.

Usage

SkewTk(n1, k, a)

Value

The skewness of Cuzick and Edwards \(T_k\) test statistic for disease clustering

Arguments

n1

Number of cases

k

Integer specifying the number of NNs (of subject \(i\))

a

\(A_{ij}\) matrix which is the output of the function aij.mat.

Author

Elvan Ceyhan

References

See Also

ceTk, EV.Tk, and varTk

Examples

Run this code
n<-20  #or try sample(1:20,1)
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(0:1,n,replace = TRUE)
n1<-sum(cls==1)

k<-sample(1:5,1) # try also 3, 5, sample(1:5,1)
k
a<-aij.mat(Y,k)

SkewTk(n1,k,a)

Run the code above in your browser using DataLab