| funsZTkinv | R Documentation | 
T_k^{inv} statisticTwo functions: ZTkinv and ZTkinv.sim, each of which is an object of class "htest" performing a
z-test for Cuzick and Edwards T_k^{inv} test statistic. See ceTkinv for a description of 
T_k^{inv} test statistic.
The function ZTkinv performs a Z-test for T_k^{inv} using asymptotic normality with a simulation estimated
variance under RL of cases and controls to the given points.
And the function ZTkinv.sim performs test forT_k^{inv} based on MC simulations under the RL hypothesis.
Asymptotic normality for the T_k^{inv} is not established yet, but this seems likely according to 
\insertCitecuzick:1990;textualnnspat. 
If asymptotic normality holds, it seems a larger sample size would be needed before this becomes
an effective approximation.
Hence the simulation-based test ZTkinv.sim is recommended for use to be safe. 
When ZTkinv is used, this is also highlighted with the warning "asymptotic normality of T_k^{inv} is not yet established, 
so, simulation-based test is recommended".
All arguments are common for both functions, except for ..., Nvar.sim which are used in ZTkinv only,
and Nsim, which is used in ZTkinv.sim only.
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 Nvar.sim represents the number of resamplings (without replacement) in the
RL scheme, with default being 1000 for estimating the variance of T_k^{inv} statistic in ZTkinv.
The argument Nsim represents the number of resamplings (without replacement) in the
RL scheme, with default being 1000 for estimating the T_k^{inv} values in ZTkinv.sim.
Both functions might take a very long time when data size is large or Nsim is large.
See also (\insertCitecuzick:1990;textualnnspat) and the references therein.
ZTkinv(
  dat,
  k,
  cc.lab,
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95,
  case.lab = NULL,
  Nvar.sim = 1000,
  ...
)
ZTkinv.sim(
  dat,
  k,
  cc.lab,
  alternative = c("two.sided", "less", "greater"),
  conf.level = 0.95,
  case.lab = NULL,
  Nsim = 1000
)
| dat | The data set in one or higher dimensions, each row corresponds to a data point, used in both functions. | 
| k | Integer specifying the number of the closest controls to subject  | 
| cc.lab | Case-control labels, 1 for case, 0 for control, used in both functions. | 
| alternative | Type of the alternative hypothesis in the test, one of  | 
| conf.level | Level of the upper and lower confidence limits, default is  | 
| case.lab | The label used for cases in the  | 
| Nvar.sim | The number of simulations, i.e., the number of resamplings under the RL scheme to estimate the 
variance of Tkinv, used in  | 
| ... | are for further arguments, such as  | 
| Nsim | The number of simulations, i.e., the number of resamplings under the RL scheme to estimate the 
 | 
A list with the elements
| statistic | The  | 
| p.value | The  | 
| conf.int | Confidence interval for the Cuzick and Edwards  | 
z-critical values are used in the construction of the confidence interval in ZTkinv, 
while the percentile values are used in the generated sample of T_k^{inv} values in ZTkinv.sim
| estimate | Estimate of the parameter, i.e., the Cuzick and Edwards  | 
| null.value | Hypothesized null value for the Cuzick and Edwards  | 
| alternative | Type of the alternative hypothesis in the test, one of  | 
| method | Description of the hypothesis test | 
| data.name | Name of the data set,  | 
Elvan Ceyhan
ceTkinv and EV.Tkinv
n<-10 #try also 20, 50, 100
set.seed(123)
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(0:1,n,replace = TRUE)  #or try cls<-rep(0:1,c(10,10))
k<-2
ZTkinv(Y,k,cls)
ZTkinv(Y,k,cls+1,case.lab = 2,alt="l")
#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
ZTkinv(Y,k,fcls,case.lab="a")
n<-10 #try also 20, 50, 100
set.seed(123)
Y<-matrix(runif(3*n),ncol=3)
cls<-sample(0:1,n,replace = TRUE)  #or try cls<-rep(0:1,c(10,10))
k<-2 # try also 3,5
ZTkinv.sim(Y,k,cls)
ZTkinv.sim(Y,k,cls,conf=.9,alt="g")
#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
ZTkinv.sim(Y,k,fcls,case.lab="a")
#with k=1
ZTkinv.sim(Y,k=1,cls)
ZTrun(Y,cls)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.