simNHP.fun: Generate the occurrence points of a NHPP

Description Usage Arguments Details Value References See Also Examples

View source: R/simNHP.fun.r

Description

This function generates the occurrence times of the points of a NHPP with a given time-varying intensity λ(t), in a period (0, T). The length of argument lambda determines T, the length of the observation period.

It calls the auxiliary function buscar (not intended for the users), see Details section.

Usage

1
simNHP.fun(lambda, fixed.seed=NULL)

Arguments

lambda

Numeric vector, the time varying intensity λ(t) to generate the NHPP.

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.

Details

The generation of the NHPP points consists in two steps. First, the points of a homogeneous PP of intensity 1 are generated using independent exponentials. Then, the homogeneous occurrence times are transformed into the points of a non homogeneous process with intensity λ(t). This transformation is performed by the auxiliary function buscar (not intended for the user).

Value

A list with elements

posNH

Numeric vector of the occurrences times of the NHPP generated in the observation period (0,T).

lambda

Input argument.

fixed.seed

Input argument.

References

Cebrian, A.C., Abaurrea, J. and Asin, J. (2015). NHPoisson: An R Package for Fitting and Validating Nonhomogeneous Poisson Processes. Journal of Statistical Software, 64(6), 1-24.

Ross, S.M. (2006). Simulation. Academic Press.

See Also

GenEnv.fun, resQQplot.fun

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
#Generation of the occurrence times of a homogeneours PP with  constant intensity 
#0.01 in a period  of time of length 1000

aux<-simNHP.fun(lambda=rep(0.01,1000))
aux$posNH

#if we want reproducible results, we can fixed the seed in the generation process
aux<-simNHP.fun(lambda=rep(0.01,1000),fixed.seed=123)
aux$posNH

#and the result is:
#  [1]  85 143 275 279 284 316 347 362 634 637 738 786 814 852 870 955


#Generation of  the occurrence times of a NHPP with  time-varying intensity t in 
#a period  of time of length 500

t<-runif(500, 0.01,0.1)
aux<-simNHP.fun(lambda=t)
aux$posNH

NHPoisson documentation built on Feb. 19, 2020, 5:07 p.m.