varTkinv.sim {nnspat}R Documentation

Simulated Variance of Cuzick and Edwards T_k^{inv} Test statistic

Description

This function estimates the variance of Cuzick and Edwards T_k^{inv} test statistic by Monte Carlo simulations under the RL hypothesis.

The exact variance of T_k^{inv} is currently not available and (Cuzick and Edwards (1990)) say that "The permutational variance of T_k^{inv} becomes unwieldy for k > 1 and is more easily simulated", hence we estimate the variance of T_k^{inv} by RL of cases and controls to the given point data.

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 argument Nsim represents the number of resamplings (without replacement) in the RL scheme, with default being 1000.

See (Cuzick and Edwards (1990)).

See the function ceTkinv for the details of the T_k^{inv} test.

Usage

varTkinv.sim(dat, k, cc.lab, Nsim = 1000, case.lab = NULL)

Arguments

dat

The data set in one or higher dimensions, each row corresponds to a data point,

k

Integer specifying the number of the closest controls to subject i.

cc.lab

Case-control labels, 1 for case, 0 for control

Nsim

The number of simulations, i.e., the number of resamplings under the RL scheme to estimate the variance of T_k^{inv}

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.

Value

The simulation estimated variance of Cuzick and Edwards T_k^{inv} test statistic for disease clustering

Author(s)

Elvan Ceyhan

References

Cuzick J, Edwards R (1990). “Spatial clustering for inhomogeneous populations (with discussion).” Journal of the Royal Statistical Society, Series B, 52, 73-104.

See Also

ceTkinv and EV.Tkinv

Examples

set.seed(123)
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<-2

Nmc<-1000
varTkinv.sim(Y,k,cls,Nsim=Nmc)

set.seed(1)
varTrun.sim(Y,cls,Nsim=Nmc)
set.seed(1)
varTkinv.sim(Y,k=1,cls,Nsim=Nmc)

#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
varTkinv.sim(Y,k,fcls,Nsim=Nmc,case.lab="a")


[Package nnspat version 0.1.2 Index]