rnonRLIII {nnspat}R Documentation

Type III Non-Random Labeling of a Given Set of Points

Description

An object of class "SpatPatterns".

Given the set of n points, dat, in a region, this function assigns n_1=round(n*prop,0) of them as cases, and the rest as controls with first selecting a point, Z_i, as a case and assigning the label case to the remaining points with infection probabilities prob=rho (1-d_{ij}/d_{\max})^{pow} where d_{ij} is the distance from Z_j to Z_i for j \ne i, d_{\max} is the maximum of d_{ij} values, rho is a scaling parameter for the infection probabilities and pow is a parameter in the power adjusting the distance dependence. The number of cases will be n_1 on the average if the argument poisson=TRUE (i.e., n_1=rpois(1,round(n*prop,0)) ), otherwise n_1=round(n*prop,0). We stop when we first exceed n_1 cases. rho has to be positive for prob to be a vector of probabilities, and for a given rho, pow must be > - \ln(rho)/\ln(1-d_{ij}/d_{\max}), also when pow is given, rho must be < (1-d_{ij}/d_{\max})^{-pow}. If rand.init=TRUE, initial case is selected randomly among the data points, otherwise first entry is chosen as the case (or case is recorded as the first entry) in the data set, dat.

Algorithmically, first all dat points are treated as non-cases (i.e., controls or healthy subjects). Then the function follows the following steps for labeling of the points:

step 0: n_1 is generated randomly from a Poisson distribution with mean = round(n*prop,0), so that the average number of cases will be round(n*prop,0) if the argument poisson=TRUE, else n_1=round(n*prop,0).

step 1: Initially, one point from dat is selected as a case. The selection of initial case is determined based on the argument rand.init (with default=TRUE) where if rand.init=TRUE then the initial case is selected randomly from the data points, and if rand.init= FALSE, the first entry in the data set, dat, is selected as the case.

step 2: Then it assigns the label case to the remaining points with infection probabilities prob=rho (1-d_{ij}/d_{\max})^{pow}, see the description for the details of the parameters in the prob.

step 3: The procedure ends when number of cases n_c exceeds n_1, and n_c-n_1 of the cases (other than the initial contagious case) are randomly selected and relabeled as controls, i.e., 0s, so that the number of cases is exactly n_1.

In the output cases are labeled as 1 and controls as 0, and initial contagious case is marked with a red cross in the plot of the pattern. Note that the infection probabilities of the points is inversely proportional to their distances to the initial case and increase with increasing rho. This function might take a long time for certain choices of the arguments. For example, if pow is taken to be too large, the infection probabilities would be too small, and case assignment will take a rather long time.

See Ceyhan (2014) for more detail where type III non-RL pattern is the case 3 of non-RL pattern considered in Section 6 with n_1 is fixed as a parameter rather than being generated from a Poisson distribution and k_{den}=1 and pow is represented as k_{pow}.

Although the non-RL pattern is described for the case-control setting, it can be adapted for any two-class setting when it is appropriate to treat one of the classes as cases or one of the classes behave like cases and other class as controls.

Usage

rnonRLIII(dat, prop, rho, pow, rand.init = TRUE, poisson = FALSE)

Arguments

dat

A set of points the non-RL procedure is applied to obtain cases and controls randomly in the type III fashion (see the description).

prop

A real number between 0 and 1 (inclusive) representing the proportion of new cases (on the average) infected by the initial case, i.e., number of newly infected cases (in addition to the first case) is Poisson with mean=round(n*prop) where n is the number of points in dat, if the argument poisson=TRUE, else it is round(n*prop).

rho

A scaling parameter for the probabilities of labeling the points as cases (see the description).

pow

A parameter in the power adjusting the distance dependence in the probabilities of labeling the points as cases (see the description).

rand.init

A logical argument (default is TRUE) to determine the choice of the initial case in the data set, dat. If rand.init=TRUE then the initial case is selected randomly from the data points, and if rand.init= FALSE, the first entry in the data set, dat, is labeled as the initial case.

poisson

A logical argument (default is FALSE) to determine whether the number of cases n_1, will be random or fixed. If poisson=TRUE then the n_1 is from a Poisson distribution, n_1=rpois(1,round(n*prop,0)) otherwise it is fixed, n_1=round(n*prop,0).

Value

A list with the elements

pat.type

="cc" for the case-control patterns for RL or non-RL of the given data points, dat

type

The type of the point pattern

parameters

rho and pow, where rho is the scalign parameter and pow is the parameter in the power adjusting the distance dependence in probabilities of labeling the points as cases.

dat.points

The set of points non-RL procedure is applied to obtain cases and controls randomly in the type III fashion

lab

The labels of the points as 1 for cases and 0 for controls after the type III nonRL procedure is applied to the data set, dat. Cases are denoted as red dots and controls as black circles in the plot.

init.cases

The initial case in the data set, dat. Marked with a red cross in the plot of the points.

cont.cases

The contagious cases in the data set, dat. Denoted as blue points in the plot of the points.

gen.points, ref.points

Both are NULL for this function, as initial set of points, dat, are provided for the non-RL procedure.

desc.pat

Description of the point pattern

mtitle

The "main" title for the plot of the point pattern

num.points

The vector of two numbers, which are the number of cases and controls.

xlimit, ylimit

The possible ranges of the x- and y-coordinates of the generated and the reference points

Author(s)

Elvan Ceyhan

References

Ceyhan E (2014). “Segregation indices for disease clustering.” Statistics in Medicine, 33(10), 1662-1684.

See Also

rnonRLI, rnonRLII, rnonRLIV, and rnonRL

Examples

n<-40;  #try also n<-20; n<-100;
prop<- .5; #try also .25, .75
#data generation
dat<-cbind(runif(n,0,1),runif(n,0,1))

rho<-.8
pow<-2

Xdat<-rnonRLIII(dat,prop,rho,pow,poisson=FALSE) #labeled data, try also poisson=TRUE

Xdat

table(Xdat$lab)

summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)

#normal original data
n<-40;  #try also n<-20; n<-100;
dat<-cbind(rnorm(n,0,1),rnorm(n,0,1))

prop<- .5; #try also .25, .75
rho<-.8
pow<-2

Xdat<-rnonRLIII(dat,prop,rho,pow,poisson=FALSE) #labeled data, try also poisson=TRUE
Xdat

table(Xdat$lab)

summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)


[Package nnspat version 0.1.2 Index]