Description Usage Arguments Details Value References See Also Examples
This function estimates the cross Jfunction between two sets, C and D, of (homogenous or nonhomogeneous) point processes in time. It is evaluated in a grid of distances r, and it can be optionally plotted. A test to assess the independence between the sets of processes, based on the cross Jfunction, is also implemented.
It calls the auxiliary functions NHJaux and Jenv, not intended for users.
1 2 3 
lambdaC 
A matrix of positive values. Each column is the intensity vector of one of the point processes in C. If there is only one process in C, it can be a vector or even a numeric value if the process is homogeneous. 
lambdaD 
A matrix of positive values. Each column is the intensity vector of one of the point process in D. If there is only one process in D, it can be a vector or even a numeric value if the process is homogeneous. 
T 
Numeric value. Length of the observed period. It only must be specified
if the number of rows in 
Ptype 
Optional. Label: "hom" or "inhom". The first one indicates that all the point processes in sets C and D are homogeneous. 
posC 
Numeric vector. Occurrence times of the points in all the point processes in C. 
typeC 
Numeric vector with the same length as 
posD 
Numeric vector. Occurrence times of the points in all the point processes in D. 
typeD 
Numeric vector with the same length as 
r 
Optional. Numeric vector. Values where Jfunction must be evaluated. If it is NULL, a default vector is used, see Details. 
L 
Optional. Numeric vector. Values in the observed period used to calculate the Jfunction. If it is NULL, a default vector is used, see Details. 
test 
Optional. Logical flag. If it is TRUE, a test of independence and a 95% envelope for the Jfunction are calculated. 
nTrans 
Optional. Numeric value. Only used if 
rTest 
Optional. Numeric value. Maximum value of r used to calculate the independence test statistc, see Details. 
conf 
Optional. Numeric value in (0,1). Confidence level of the envelope for the Jfunction. 
dplot 
Optional. Label "JDF" or "J". If it is "JDF", plots of J, D and Ffunctions are displayed. If it is "J", only Jfunction is plotted. 
tit 
Optional. A vector with one or three titles to be used in the plots of J, D and Ffunctions. 
mfrow 
Optional. Argument to be passed to 
cores 
Optional. Number of cores of the computer to be used in the calculations. 
fixed.seed 
An integer or NULL. If it is an integer, that is the value used to set the seed in random generation processes. It it is NULL, a random seed is used. 
... 
Further arguments to be passed to the function 
The information about the processes is provided by arguments posC
, the vector of all the occurrence times
in the processes in C, and typeC
, the vector of the code of the point process in set C
where each point in posC
has occurred; the second set D is characterized analogously by
typeD
and posD
.
This function estimates the cross Jfunction between two sets, C and D, of (homogenous or nonhomogeneous) time point processes, see Cebrian et al (2020) for details of the estimation. The Jfunction measures the interpoint dependence between points in any of the processes in D, and points in any of the processes in C, adjusted for time varying intensity in the case of nonhomogenous processes. The cross Jfunction is defined as J_{CD}(r)=(1D_{CD}(r))/(1F_D(r)), if F_D(r)<1 and it is not calculated otherwise. It compares D_{CD}(r), the distribution function of the distances from a point in any of the processes in set C to the nearest point in any of the processes in set D, to F_{D}(r), the distribution function of the distances from a fixed point in the space to the nearest point in any of the processes in set D.
If argument r
is NULL, the following grid is used to evaluate the function
r1<max(20, floor(T/20))
r<seq(1,r1,by=2)
if (length(r)>200) r<seq(1,r1,length.out=200)
If argument L
is NULL, the following grid is used
L < seq(1, T, by = 2) if (length(L) > 5000) L < seq(1, T, by = round((T  1)/199))
Testing independence:
If the processes in C are independent of the processes in D given the marginal structure of the processes, the Jfuntion is equal to 1, since D(r)=F(r). Hence, deviations of J(r) estimations from 1, suggest dependence betweent the two sets of processes. The test statistic is based on the mean of values J(r)1 evaluated in a given grid of r values.
A test based on a LotwickSilverman approach, see Lotwick and Silverman (1982), is implemented. This test provides a nonparametric way to test independence given the marginal intensities of the processes. Using the LotwickSilverman approach, not only the pvalue of the test but also an envelope for the J(r) values is calculated.
In point processes, dependence often appears between close observations, and with high r values it is more
difficult that the Jfunction is able to discriminate between dependent and independent processes.
By this reason, the argument rTest
allows us to fix a maximum value of r
so that only J(r) estimations for r<rTest will be used to
calculate the test statistic. The value rTest
is drawn in the plot of the Jfunction
as a vertical grey line.
A list with elements:
r 
Vector of values r where the Jfunction is estimated. 
NHJr 
Estimated values of J_{CD}(r). 
NHDr 
Estimated values of D_{CD}(r). 
NHFr 
Estimated values of F_{D}(r). 
JenvL 
Lower bounds of the envelope of J_{CD}(r). 
JenvU 
Upper bounds of the envelope for J_{CD}(r). 
JStatOb 
Observed value of the statistic. 
JStatTr 
Sample of the values of the test statistic obtained by random translations. 
pv 
Pvalue of the independence test. 
T 
Length of the observed period of the process. 
L 
Grid of L values to calculate the Ffuntion. 
Cebrian, A.C., Abaurrea, J. and Asin, J. (2020). Testing independence between two point processes in time. Journal of Simulation and Computational Statistics.
Cronie, O. and van Lieshout, M.N.M. (2015). Summary statistics for inhomogeneous marked point processes. Ann Inst Stat Math.
Lotwick, H.W. and Silverman, B.W. (1982). Methods for analysing Spatial processes of several types of points. J.R. Statist. Soc. B, 44(3), pp. 40613
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19  set.seed(120)
lambda1<runif(100, 0.05, 0.1)
set.seed(121)
lambda2<runif(100, 0.01, 0.2)
pos1<simNHPc(lambda=lambda1,fixed.seed=123)$posNH
pos2<simNHPc(lambda=lambda2,fixed.seed=123)$posNH
aux<NHJ(lambdaC=lambda1, lambdaD=lambda2, posC=pos1,nTrans=50,
posD=pos2, rTest=7, dplot='J', cores=1,test=TRUE)
aux$pv
#Sets with two processes
#pos3<simNHPc(lambda=lambda1,fixed.seed=300)$posNH
#pos4<simNHPc(lambda=lambda2,fixed.seed=30)$posNH
#aux<NHJ(lambdaC=cbind(lambda1,lambda2), lambdaD=cbind(lambda1,lambda2),
# posC=c(pos1,pos2), typeC=c(rep(1, length(pos1)), rep(2, length(pos2))),
# posD=c(pos3, pos4), typeD=c(rep(1, length(pos3)), rep(2, length(pos4))),
# dplot='J', test=TRUE)
#aux$pv

Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.