TestIndNH: Parametric bootstrap test of independence between point...

Description Usage Arguments Details Value References See Also Examples

View source: R/TestIndNH.R

Description

This function calculates a parametric bootstrap test (PaB) to study the independence between two or three homogeneous or nonhomogeneous point processes in time. The statistic is based on the close point sets of the points in the first process. Currently, it is implemented for Poisson processes and for Neyman-Scott cluster processes.

Usage

1
2
3
TestIndNH(posx, posy, posz=NULL,  alpha = 0.05, nsim = 100, PA = FALSE, cores = 1, 
	type = "Poisson", lambdaMarg = NULL,   lambdaParent = NULL, lambdaNumP = NULL, 
	dist = "normal", sigmaC = 1, minC = -1, maxC = 1,fixed.seed=NULL)

Arguments

posx

Numeric vector. Position of the occurrence points in the first process.

posy

Numeric vector. Position of the occurrence points in the second process.

posz

Numeric vector. Position of the occurrence points in the third process. By default is null, and only two processes are tested.

alpha

Optional. Significance level used to obtain a decision (reject-no reject) based on the test p-value.

nsim

Optional. Positive integer. Number of simulations to calculate the test.

PA

Optional. Logical flag. If it is TRUE, the close point relation is broadened by including the previous and the following points to the overlapping intervals.

cores

Optional. Number of cores of the computer to be used in the calculations.

type

Optional. Label "Poisson" or "PoissonCluster". Type of point processes to be generated in the parametric bootstrap. Up to now, only two types are available: Poisson processes ("Poisson") and Neyman-Scott cluster processes ("PoissonCluster").

lambdaMarg

Matrix of positive values and dimension T \times N_P with N_P=1 or 2. Only used if type="Poisson". Each column is the intensity vector to generate the processes N_y and N_z.

lambdaParent

Numeric vector. Only used if type="PoissonCluster". Intensity vector of the process used to generate the centers of the clusters of the Neyman-Scott process.

lambdaNumP

Numeric vector with 1 or 2 values. Only used if type="PoissonCluster". Mean values of the number of sons of the processes to be generated. If its length is equal to 1 and there are three processes, the same value is used to generate N_y and N_z.

dist

Optional. Label "normal" or "uniform". Only used if type="PoissonCluster". Distribution used to generate the point distances to the centre in each cluster.

sigmaC

Optional. Numeric vector with 1 or 2 values. Only used if type="PoissonCluster" and dist='normal'. Standard deviation of the normal distribution. If its length is equal to 1, the same value is used in both processes.

minC

Optional. Numeric vector with 1 or 2 values. Only used if type="PoissonCluster" and dist='uniform'. Lower bounds of the Uniform distribution. If its length is equal to 1 and there are three processes, the same value is used to generate N_y and N_z.

maxC

Optional. Numeric vector with 1 or 2 values. Only used if type="PoissonCluster" and dist='uniform'. Upper bounds of the Uniform distribution. If its length is equal to 1 and there are three processes, the same value is used to generate N_y and N_z.

fixed.seed

Optional. 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.

Details

The underlying idea of the test is to compare, for each point in the first process, the behavior of its set of close points in the vector of observed processes (N_x, N_y, N_z), and in new vectors of independent processes with the observed marginal distribution. The new independent vectors are obtained using a parametric bootstrap approach, see Abaurrea et al. (2015): the process N_x is fixed and second and third processes are generated using a parametric model with intensities λ_y and λ_z. Currently, it is implemented for Poisson processes and for Neyman-Scott cluster processes. If the observed behavior is significantly different, independence is rejected.

The test statistic is the one used in TestIndLS, but the p-value is obtained using a Monte Carlo approach if the intensities λ_y(t) and λ_z(t) are known, or a parametric bootstrap if they have been estimated. The test TestIndLS can only be applied to homogeneous processes, but it does not require any assumption about the distribution of the marginal processes.

It is noteworthy that when the test is applied, it is being assumed that the processes follow a parametric model with the given intensities. If necessary, validation of that assumption should be previously carried out.

The lenght of the observed period is determined by the length of the intensity vector λ, that is lambdaParent (if type="PoissonCluster") or the first element of the dimension of lambdaMarg (if type="PoissonC". It can be applied to homogeneous processes, using an intensity vector (lambda) with equal values.

Value

A list with elements:

pv

P-value of the independence test.

reject

Binary variable indicating if the test is rejected (1) or not (0) at an alpha significance level.

est

Sample of the KS statistics. The first value corresponds to the observed processes and the others to the generated processes.

References

Abaurrea, J. Asin, J. and Cebrian, A.C. (2015). A Bootstrap Test of Independence Between Three Temporal Nonhomogeneous Poisson Processes and its Application to Heat Wave Modeling. Environmental and Ecological Statistics.

See Also

TestIndLS,CondTest, DutilleulPlot, DistSim, DistObs, uniongentri

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#Test applied to 3  independent NHPP
set.seed(123)
lambdax<-runif(150, 0.01,0.1)
set.seed(124)
lambday<-runif(150, 0.02,0.1)
set.seed(125)
lambdaz<-runif(150, 0.015,0.1)
posx<-simNHPc(lambdax, fixed.seed=123)$posNH
posy<-simNHPc(lambday, fixed.seed=124)$posNH
posz<-simNHPc(lambdaz, fixed.seed=125)$posNH

aux<-TestIndNH(posx, posy, posz, nsim=50, type='Poisson', 
	lambdaMarg=cbind(lambday,lambdaz), fixed.seed=321)
aux$pv


#Test applied to 3 dependent NS cluster processes with 2 cores
#set.seed(123)
#lambdaParent<-runif(500,0,0.1)
#DepPro<-DepNHNeyScot(lambdaParent=lambdaParent, d=3, lambdaNumP = 3, 
#	 dist = "normal", sigmaC = 1, fixed.seed=123,cores=2)
#posx<-DepPro$PP1
#posy<-DepPro$PP2
#posz<-DepPro$PP3
#aux<-TestIndNH(posx, posy, posz, cores=1, type='PoissonCluster',
#	lambdaParent = lambdaParent, lambdaNumP = 3, 
#	dist = "normal", sigmaC = 1, fixed.seed=123, nsim=200)
#aux$pv

IndTestPP documentation built on Aug. 29, 2020, 1:06 a.m.