# rinpoisson: Simulation of inhomogeneous Poisson Processes In rpgm: Fast Simulation of Normal/Exponential Random Variables and Stochastic Differential Equations / Poisson Processes

## Description

The function `rinpoisson` is a R-level function which simulates the jumping times of an inhomogeneous Poisson process, returning each path as a vector of a list.

## Usage

 `1` ```rinpoisson(n, lambda, T = 1, drop = TRUE) ```

## Arguments

 `n` integer, number of paths. `lambda` double, function of the intensity of the inhomogeneous Poisson processes over the time. `T` double, end time of the simulations. `drop` logical, if `n = 1` and `drop = TRUE`, returns the single path as a vector instead of a list.

## Value

`rinpoisson` returns a list of n paths of an inhomogeneous Poisson process of intensity function `lambda`. Each element of the list is the vector of the jumping times.

## Note

The function `lambda` must be vectorial in the sense that, if given an argument x, it returns a vector of the same size.

## Author(s)

Nicolas Baradel - PGM Solutions

## References

https://en.wikipedia.org/wiki/Poisson_point_process#Inhomogeneous_Poisson_point_process

## Examples

 ```1 2 3 4 5 6 7``` ```lambda <- function(t) return(400*(1+sin(-pi/2+2*pi*t))) P <- rinpoisson(5, lambda, T=4) plot(density(P[], bw = 0.05)) lines((0:400)/100, lambda((0:400)/100)/integrate(lambda, 0, 4)\$value, col="red") length(P[]) integrate(lambda, 0, 4) ```

### Example output ``` 1633
1600 with absolute error < 1.2e-06
```

rpgm documentation built on March 18, 2018, 2:24 p.m.