varTkinv.sim | R Documentation |
T_k^{inv}
Test statisticThis 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 (\insertCitecuzick:1990;textualnnspat) 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 (\insertCitecuzick:1990;textualnnspat).
See the function ceTkinv
for the details of the T_k^{inv}
test.
varTkinv.sim(dat, k, cc.lab, Nsim = 1000, case.lab = NULL)
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 |
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 |
case.lab |
The label used for cases in the |
The simulation estimated variance of Cuzick and Edwards T_k^{inv}
test statistic for disease clustering
Elvan Ceyhan
ceTkinv
and EV.Tkinv
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")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.