| ceTkinv | R Documentation |
T_k^{inv} Test statisticThis function computes Cuzick and Edwards T_k^{inv} test statistic based on the sum of number of cases closer to
each case than the k-th nearest control to the case.
T_k^{inv} test statistic is an extension of the run length test allowing a fixed number of controls in the run
sequence.
T_k^{inv} test statistic is defined as T_k^{inv}=\sum_{i=1}^n \delta_i \nu_i^k where \delta_i=1
if z_i is a case, and 0 if z_i is a control and \nu_i^k is the number of cases closer
to the index case than the k nearest control, i.e., number of cases encountered beginning
at z_i until k-th control is encountered.
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.
ceTkinv(dat, k, cc.lab, 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 |
case.lab |
The label used for cases in the |
... |
are for further arguments, such as |
A list with two elements
Tkinv |
Cuzick and Edwards |
run.vec |
The |
Elvan Ceyhan
ceTrun, ceTk, and Tcomb
n<-20
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(0:1,n,replace = TRUE) #or try cls<-rep(0:1,c(10,10))
cls
k<-2 #also try 3,4
ceTkinv(Y,k,cls)
ceTkinv(Y,k,cls+1,case.lab = 2)
ceTkinv(Y,k,cls,method="max")
ceTrun(Y,cls)
ceTkinv(Y,k=1,cls)
#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
ceTkinv(Y,k,fcls,case.lab="a") #try also ceTrun(Y,fcls)
#############
n<-40
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(1:4,n,replace = TRUE) #here ceTkinv(Y,k,cls) #gives error
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.