Ogata: Multivariate Ogata thinning algorithm

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/Simulation.R

Description

Simulation of multivariate (marked) point processes using the Ogata thinning algorithm.

Usage

1
Ogata(n = 1, lambda, h, A = Inf, seed = NULL, tLim = Inf, ...)

Arguments

n

an integer. The total number of points to be simulated. Default value is 1.

lambda

a function with arguments t, T, h, predict with t a numeric, T a list of history points preceeding t and h a list of filter functions. The argument predict is a logical specifying if the history must preceed t strictly (predict = TRUE) or not. The function must return a vector of intensities, one for each coordinate, and

h

a list of lists of filter function evaluations.

A

a numeric bounding the support of the filter functions. Default Inf means no bound.

seed

an integer. Default NULL.

tLim

an numeric. Upper time limit. Default is no limit.

...

other arguments passed to lambda.

Details

This implementation of the Ogata thinning algorithm generates n points based on a vector valued function lambda that returns the intensity given the history of points. For an example of a lambda-function see hawkesRate.

The algorithm requires the specification of filter functions h (a lists of lists of function evaluations) and a bound, A, on how much history is needed. The list h is a list of lists with h[[m]][[k]] a vector containing the effect of the k'th process on the m'th process.

Value

A data.frame with the two columns time and markType and n rows.

Author(s)

Niels Richard Hansen, Niels.R.Hansen@math.ku.dk

See Also

hawkesRate

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
29
30
31
32
33
34
35
36
37
h <- list( 
  list(function(t)
        - 0.1 * exp(- (2*(t-1))^2), 
       function(t)
         exp(- (2*(t-2))^2)
  ),
  list(function(t)
        exp(- (2*(t-1))^2),
       NULL    
  )
)

## Evaluations of the filter functions.

M <- length(h)
Delta <- 0.001
A <- 5
h1 <- vector("list", M)

for (m in seq_len(M)) {
  h1[[m]] <- vector("list", M)
  for (k in seq_len(M)) {
    if (!is.null(h[[m]][[k]])) {
      h1[[m]][[k]] <- h[[m]][[k]](seq(0, A, Delta))
    }
  }
}

## Simulation using the 'hawkesRate' intensity function.

T <- Ogata(100, 
           lambda = hawkesRate, 
           h = h1,
           A = A,
           Delta = Delta,
           beta0 = c(0.1, 0.1)
)

ppstat documentation built on May 2, 2019, 5:26 p.m.