Skip to contents

The method simulate multivariate Hawkes processes. The object hspec-class contains the parameter values such as mu, alpha, beta. The mark (jump) structure may or may not be included. It returns an object of class hreal which contains inter_arrival, arrival, type, mark, N, Nc, lambda, lambda_component, rambda, rambda_component.

Usage

hsim(
  object,
  size = 100,
  lambda_component0 = NULL,
  N0 = NULL,
  Nc0 = NULL,
  verbose = FALSE,
  ...
)

# S4 method for class 'hspec'
hsim(
  object,
  size = 100,
  lambda_component0 = NULL,
  N0 = NULL,
  Nc0 = NULL,
  verbose = FALSE,
  ...
)

Arguments

object

hspec-class. S4 object that specifies the parameter values.

size

Number of observations.

lambda_component0

Initial values for the lambda component \(\lambda_{ij}\). Can be a numeric value or a matrix. Must have the same number of rows and columns as alpha or beta in object.

N0

Starting values of N with default value 0.

Nc0

Starting values of Nc with default value 0.

verbose

Logical. If TRUE, print progress messages during the simulation. Default is FALSE.

...

Further arguments passed to or from other methods.

Value

hreal S3-object, summary of the Hawkes process realization.

Examples


# example 1

mu <- 1; alpha <- 1; beta <- 2
h <- new("hspec", mu=mu, alpha=alpha, beta=beta)
hsim(h, size=100)
#> -------------------------------------------------------
#> Simulation result of exponential (marked) Hawkes model.
#> An object of class "hspec" of 1-dimensional Hawkes process
#> 
#> Slot mu: 
#>      [,1]
#> [1,]    1
#> 
#> Slot alpha: 
#>      [,1]
#> [1,]    1
#> 
#> Slot beta: 
#>      [,1]
#> [1,]    2
#> 
#> Realized path :
#>       arrival N1 mark lambda1 lambda11
#>  [1,] 0.00000  0    0   1.500  0.50000
#>  [2,] 0.04361  1    1   1.458  0.45824
#>  [3,] 1.42215  2    1   1.093  0.09256
#>  [4,] 1.96504  3    1   1.369  0.36889
#>  [5,] 3.18763  4    1   1.119  0.11870
#>  [6,] 3.25617  5    1   1.975  0.97539
#>  [7,] 4.00690  6    1   1.440  0.44012
#>  [8,] 4.11924  7    1   2.150  1.15033
#>  [9,] 4.13472  8    1   3.085  2.08480
#> [10,] 4.49366  9    1   2.505  1.50472
#> [11,] 4.76137 10    1   2.466  1.46632
#> [12,] 4.87785 11    1   2.954  1.95377
#> [13,] 4.90706 12    1   3.786  2.78617
#> [14,] 5.22155 13    1   3.019  2.01853
#> [15,] 5.25446 14    1   3.826  2.82625
#> [16,] 5.82846 15    1   2.214  1.21396
#> [17,] 5.84546 16    1   3.140  2.13996
#> [18,] 5.94467 17    1   3.575  2.57481
#> [19,] 6.03999 18    1   3.954  2.95434
#> [20,] 6.23474 19    1   3.679  2.67865
#> ... with 80 more rows 
#> -------------------------------------------------------


# example 2
mu <- matrix(c(0.1, 0.1), nrow=2)
alpha <- matrix(c(0.2, 0.1, 0.1, 0.2), nrow=2, byrow=TRUE)
beta <- matrix(c(0.9, 0.9, 0.9, 0.9), nrow=2, byrow=TRUE)
h <- new("hspec", mu=mu, alpha=alpha, beta=beta)
res <- hsim(h, size=100)
print(res)
#> -------------------------------------------------------
#> Simulation result of exponential (marked) Hawkes model.
#> An object of class "hspec" of 2-dimensional Hawkes process
#> 
#> Slot mu: 
#>      [,1]
#> [1,]  0.1
#> [2,]  0.1
#> 
#> Slot alpha: 
#>      [,1] [,2]
#> [1,]  0.2  0.1
#> [2,]  0.1  0.2
#> 
#> Slot beta: 
#>      [,1] [,2]
#> [1,]  0.9  0.9
#> [2,]  0.9  0.9
#> 
#> Realized path :
#>       arrival N1 N2 mark lambda1 lambda2  lambda11  lambda12  lambda21
#>  [1,]   0.000  0  0    0  0.1500  0.1500 3.333e-02 1.667e-02 1.667e-02
#>  [2,]   2.800  0  1    1  0.1040  0.1040 2.682e-03 1.341e-03 1.341e-03
#>  [3,]   4.872  0  2    1  0.1161  0.1316 4.156e-04 1.571e-02 2.078e-04
#>  [4,]   8.116  0  3    1  0.1063  0.1125 2.242e-05 6.240e-03 1.121e-05
#>  [5,]  11.637  1  3    1  0.1045  0.1089 9.431e-07 4.470e-03 4.715e-07
#>  [6,]  13.573  1  4    1  0.1358  0.1191 3.501e-02 7.826e-04 1.751e-02
#>  [7,]  14.563  1  5    1  0.1557  0.1899 1.436e-02 4.134e-02 7.181e-03
#>  [8,]  14.632  2  5    1  0.2464  0.3725 1.350e-02 1.329e-01 6.751e-03
#>  [9,]  24.985  2  6    1  0.1000  0.1000 1.918e-05 1.193e-05 9.589e-06
#> [10,]  26.830  2  7    1  0.1190  0.1380 3.642e-06 1.899e-02 1.821e-06
#> [11,]  26.955  2  8    1  0.2064  0.3127 3.255e-06 1.064e-01 1.628e-06
#> [12,]  30.109  2  9    1  0.1121  0.1241 1.904e-07 1.207e-02 9.521e-08
#> [13,]  37.449  3  9    1  0.1002  0.1003 2.575e-10 1.516e-04 1.288e-10
#> [14,]  40.774  3 10    1  0.1100  0.1050 1.003e-02 7.605e-06 5.017e-03
#> [15,]  42.009  3 11    1  0.1362  0.1675 3.301e-03 3.290e-02 1.651e-03
#> [16,]  42.762  3 12    1  0.1692  0.2359 1.677e-03 6.752e-02 8.386e-04
#> [17,]  42.789  3 13    1  0.2651  0.4278 1.637e-03 1.635e-01 8.184e-04
#> [18,]  43.519  3 14    1  0.2373  0.3734 8.480e-04 1.365e-01 4.240e-04
#> [19,]  50.020  3 15    1  0.1007  0.1014 2.441e-06 6.807e-04 1.220e-06
#> [20,]  54.162  3 16    1  0.1024  0.1048 5.870e-08 2.421e-03 2.935e-08
#>        lambda22
#>  [1,] 3.333e-02
#>  [2,] 2.682e-03
#>  [3,] 3.141e-02
#>  [4,] 1.248e-02
#>  [5,] 8.940e-03
#>  [6,] 1.565e-03
#>  [7,] 8.268e-02
#>  [8,] 2.657e-01
#>  [9,] 2.387e-05
#> [10,] 3.799e-02
#> [11,] 2.127e-01
#> [12,] 2.414e-02
#> [13,] 3.031e-04
#> [14,] 1.521e-05
#> [15,] 6.580e-02
#> [16,] 1.350e-01
#> [17,] 3.270e-01
#> [18,] 2.730e-01
#> [19,] 1.361e-03
#> [20,] 4.843e-03
#> ... with 80 more rows 
#> -------------------------------------------------------