| ZTrun {nnspat} | R Documentation |
Z-test for Cuzick and Edwards T_{run} statistic
Description
An object of class "htest" performing a z-test for Cuzick and Edwards T_{run} test statistic
which is based on the number of consecutive cases from the cases in the data under RL or CSR independence.
Under RL of n_1 cases and n_0 controls to the given locations in the study region,
T_{run} approximately has N(E[T_{run}],Var[T_{run}]) distribution for large n.
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 logical argument var.sim (default=FALSE) is for using the simulation estimated variance or the exact
variance for the variance of T_{run} in its standardization.
If var.sim=TRUE, the simulation estimated variance is used for Var[T_{run}] (see varTrun.sim),
otherwise the exact variance (see varTrun) is used.
Moreover, when var.sim=TRUE, the argument Nvar.sim represents the number of resamplings
(without replacement) in the RL scheme, with default being 1000.
The function varTrun might take a very long time when data size is large (even larger than 50);
in this case, it is recommended to use var.sim=TRUE in this function.
See also (Cuzick and Edwards (1990)) and the references therein.
Usage
ZTrun(
dat,
cc.lab,
alternative = c("two.sided", "less", "greater"),
conf.level = 0.95,
case.lab = NULL,
var.sim = FALSE,
Nvar.sim = 1000,
...
)
Arguments
dat |
The data set in one or higher dimensions, each row corresponds to a data point. |
cc.lab |
Case-control labels, 1 for case, 0 for control |
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 |
var.sim |
A logical argument (default is |
Nvar.sim |
The number of simulations, i.e., the number of resamplings under the RL scheme to estimate the
variance of |
... |
are for further arguments, such as |
Value
A list with the elements
statistic |
The |
p.value |
The |
conf.int |
Confidence interval for the Cuzick and Edwards |
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, |
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
Examples
n<-20 #or try sample(1:20,1) #try also 40, 50, 60
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))
ZTrun(Y,cls)
ZTrun(Y,cls,method="max")
ZTrun(Y,cls,var.sim=TRUE)
ZTrun(Y,cls+1,case.lab = 2,alt="l") #try also ZTrun(Y,cls,conf=.9,alt="g")
#cls as a factor
na<-floor(n/2); nb<-n-na
fcls<-rep(c("a","b"),c(na,nb))
ZTrun(Y,fcls,case.lab="a")