rnonRL | R Documentation |
An object of class "SpatPatterns"
.
Given the set of n
points, dat
, in a region, this function assigns some of them as cases,
and the rest as controls in a non-RL type=type
fashion.
Type I nonRL pattern assigns n_1=
round(n*prop,0)
of the data points 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=c(prop+((1-prop)*rho)/(1:k))
where rho
is a
parameter adjusting the NN dependence of infection probabilities.
Type II nonRL pattern assigns n_1=
round(n*ult.prop,0)
of them as cases,
and the rest as controls with first selecting k_0=
round(n*init.prop,0)
as cases initially, then selecting
a contagious case and then assigning the label case to the remaining points with infection probabilities
inversely proportional to their position in the k
NNs.
Type III nonRL pattern 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.
Type IV nonRL pattern assigns n_1=
round(n*ult.prop,0)
of them as cases,
and the rest as controls with first selecting k_0=
round(n*init.prop,0)
as cases initially and assigning the
label case to the remaining points with infection probabilities equal to the scaled bivariate normal density values
at those points.
The number of cases in Types I and III 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)
.
The initial and ultimate number of cases in Types II and IV will be k_0
and n_1
on the average if the argument
poisson=TRUE
(i.e., k_0=
rpois(1,round(n*init.prop,0)
) and n_1=
rpois(1,round(n*ult.prop,0))
), otherwise
they will be exactly equal to n_1=
round(n*ult.prop,0)
and k_0=
round(n*init.prop,0)
.
At each type, we stop when we first exceed n_1
cases. That is, the procedure ends when number of cases n_c
exceed n_1
, and n_c-n_1
of the cases (other than the initial case(s)) 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.
See \insertCiteceyhan:SiM-seg-ind2014;textualnnspat and the functions rnonRLI
,
rnonRLII
, rnonRLIII
, and rnonRLIV
for more detail on each type of
non-RL pattern.
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.
The parameters of the non-RL patterns are specified in the argument par.vec
, and the logical arguments rand.init
and poisson pass on to the types where required. rand.init
is not used in type I but used in all other types,
poisson is used in all types, and init.from.cases is used in type I non-RL only.
rnonRL(
dat,
par.vec,
type,
rand.init = TRUE,
poisson = FALSE,
init.from.cases = TRUE
)
dat |
A set of points the non-RL procedure is applied to obtain cases and controls randomly in the
|
par.vec |
The parameter vector. It is |
type |
The type of the non-RL pattern. Takes on values |
rand.init |
A logical argument (default is |
poisson |
A logical argument (default is |
init.from.cases |
A logical argument (default is |
A list
with the elements
pat.type |
|
type |
The type of the point pattern |
parameters |
|
lab |
The labels of the points as 1 for cases and 0 for controls after the nonRL procedure is
applied to the data set, |
init.cases |
The initial cases in the data set, |
cont.cases |
The contagious cases in the data set, |
gen.points , ref.points |
Both are |
desc.pat |
Description of the point pattern |
mtitle |
The |
num.points |
The |
xlimit , ylimit |
The possible ranges of the |
Elvan Ceyhan
rnonRLI
, rnonRLII
, rnonRLIII
, and rnonRLIV
#data generation
n<-40; #try also n<-20; n<-100;
dat<-cbind(runif(n,0,1),runif(n,0,1))
#Type I non-RL pattern
#c(prop,k,rho) for type I
prop<-.5; knn<-3; rho<- .3
prv<-c(prop,knn,rho)
Xdat<-rnonRL(dat,type="I",prv) #labeled data
# or try Xdat<-rnonRL(dat,type="I",prv) for type I non-RL
Xdat
table(Xdat$lab)
summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)
#Type II non-RL pattern
#c(k,rho,pow,init.prop,ult.prop) for type II
rho<-.8; pow<-2; knn<-5; ip<-.3; up<-.5
prv<-c(knn,rho,pow,ip,up)
Xdat<-rnonRL(dat,type="II",prv) #labeled data
# or try Xdat<-rnonRL(dat,type="I",prv) for type I non-RL
Xdat
table(Xdat$lab)
summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)
#Type III non-RL pattern
#c(prop,rho,pow) for type III
prop<- .5; rho<-.8; pow<-2
prv<-c(prop,rho,pow)
Xdat<-rnonRL(dat,type="III",prv) #labeled data
# or try Xdat<-rnonRL(dat,type="I",prv) for type I non-RL
Xdat
table(Xdat$lab)
summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)
#Type IV non-RL pattern
#c(init.prop,ult.prop,s1,s2,rho) for type IV
ult<-.5; int<- .1; s1<-s2<-.4; rho<- .1
prv<-c(int,ult,s1,s2,rho)
Xdat<-rnonRL(dat,type="IV",prv) #labeled data
# or try Xdat<-rnonRL(dat,type="I",prv) for type I non-RL
Xdat
table(Xdat$lab)
summary(Xdat)
plot(Xdat,asp=1)
plot(Xdat)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.