Simulates a Hawkes process on [0, hor] by its branching construction
(Hawkes and Oakes 1974): background events from the baseline (by
thinning for the "cycle" baseline), and from each event a Poisson
number, mean eta, of offspring at lags drawn from the kernel, and so on
over the generations. With win the process is in space and time:
background events fall uniformly in the rectangle, the baseline is then
per unit area, and each offspring lands at a normal offset (standard
deviation sigma) from its parent; offspring outside the window or past
hor are not recorded and have no offspring of their own.
Usage
hwksim(
par,
hor,
kernel = "exp",
base = "const",
per = 365.25,
win = NULL,
sigma = NULL,
seed = NULL,
nmax = 1e+05
)Arguments
- par
A fit from
hwkfit()orsthwk(), or parameters asparofhwkfit()(a space-time fit giveswinandsigmatoo).- hor
The end of the window: one positive number.
- kernel, base, per
As for
hwkfit(); one kernel and one baseline (not read with a fit).- win
NULL, or the rectanglec(xmin, xmax, ymin, ymax)of a space-time process.- sigma
The spread of offspring in space with
win: one positive number.- seed
NULLto draw the seed from R's generator, or one whole number from 0.- nmax
The most events simulated: one whole number from 1 (more is an error).
Value
A data frame in time order: t, with x and y in space, and
gen, the generation (0 for a background event).
References
Hawkes, A. G. and Oakes, D. (1974). A cluster process representation of a self-exciting process. Journal of Applied Probability, 11(3), 493-503. doi:10.2307/3212693
Examples
hwksim(c(a0 = log(0.2), eta = 0.6, beta = 1), 50, seed = 2)
#> t gen
#> 1 3.779322 0
#> 2 5.409217 0
#> 3 5.830663 1
#> 4 19.823215 0
#> 5 41.169353 0
#> 6 43.814177 0
#> 7 47.958169 0
hwksim(c(a0 = log(0.01), eta = 0.5, beta = 1), 50,
win = c(0, 10, 0, 10), sigma = 0.5, seed = 2)
#> t x y gen
#> 1 0.7558644 2.7817962 9.44022175 0
#> 2 5.0250919 4.1078544 5.63426436 0
#> 3 5.6439173 7.9226136 8.71437679 0
#> 4 5.8455903 4.3860809 2.51810339 0
#> 5 6.2600360 2.5425145 3.53493812 0
#> 6 6.2795482 3.8141362 3.00022453 1
#> 7 6.6432253 5.2072984 6.15998044 0
#> 8 6.7455495 3.2657857 2.31626277 2
#> 9 6.8278771 2.4776334 3.29482576 1
#> 10 6.9425536 5.5879856 6.95949979 1
#> 11 6.9822829 6.0630669 6.86957430 2
#> 12 7.1181333 5.2380366 6.99909144 2
#> 13 7.3132013 2.1007573 3.96759684 2
#> 14 7.5838953 6.0267515 6.38383203 3
#> 15 7.6171488 0.2010294 7.68373046 0
#> 16 7.8070600 2.3098969 3.22328722 2
#> 17 7.9725648 4.3991280 8.65889161 0
#> 18 8.4336242 2.4998831 1.23978171 0
#> 19 8.7651830 3.0451196 1.92151322 0
#> 20 9.5973703 3.0282385 2.08734045 1
#> 21 9.9788630 2.7943792 1.72271002 2
#> 22 10.2815589 2.3280140 2.00603858 1
#> 23 10.5906681 9.8982000 6.65449348 0
#> 24 13.2249343 4.8022337 6.35120197 0
#> 25 13.7762147 9.3813953 9.86344192 0
#> 26 16.4964749 7.4380201 3.08627689 0
#> 27 19.4665738 3.6378755 1.11373616 0
#> 28 21.4640228 0.1711280 9.44328030 0
#> 29 21.7501895 1.7312635 2.79493744 0
#> 30 23.3361286 5.8550391 2.04369776 0
#> 31 23.3930484 3.6732670 2.49637951 0
#> 32 23.3997964 3.0788325 2.26006603 1
#> 33 24.8991851 6.2916273 4.93009234 0
#> 34 25.7717035 6.0225505 0.87353454 0
#> 35 26.2174343 5.3501118 0.04506395 1
#> 36 27.1796741 2.8546811 7.53480398 0
#> 37 27.2687672 3.1381133 7.94929237 1
#> 38 27.5287415 5.4643075 2.53895429 0
#> 39 27.8868844 3.5697834 7.94786103 2
#> 40 28.0487951 0.7400589 9.82128435 0
#> 41 28.1332378 0.8370355 9.73453659 1
#> 42 28.1346901 3.2400848 7.69178375 2
#> 43 28.4063694 3.3726705 6.98303480 2
#> 44 28.4593287 2.4103222 7.10749793 1
#> 45 28.5613906 4.8372020 5.57398610 0
#> 46 29.2513541 5.3811953 4.92634279 0
#> 47 29.3118715 2.1577357 6.90245744 2
#> 48 29.7729072 8.9359034 6.66480829 0
#> 49 29.8214111 0.4276242 0.46665971 0
#> 50 30.0611117 7.8460784 3.66011738 0
#> 51 30.2281297 9.2622706 6.80716938 1
#> 52 30.8340483 0.5566726 0.24743524 1
#> 53 30.8766715 0.8165569 0.40163501 2
#> 54 31.2352188 5.7934013 8.17072591 0
#> 55 31.2354094 9.7051802 6.81376968 0
#> 56 31.3940936 1.2732222 0.60715997 3
#> 57 31.4649534 5.6895603 8.03720520 1
#> 58 31.5320979 1.7367810 3.56895007 0
#> 59 31.8004552 3.7444842 3.14122021 0
#> 60 32.1840270 3.6770851 3.23390385 1
#> 61 32.2146054 3.4482675 2.74369493 2
#> 62 32.9851182 9.8808796 7.55774944 0
#> 63 34.7650142 7.9132115 1.54451736 0
#> 64 36.1191620 0.3849985 2.14207087 0
#> 65 37.2177942 3.9058574 8.06508471 0
#> 66 37.3812730 7.2581543 8.14312801 0
#> 67 37.9381993 8.0282612 7.85203250 1
#> 68 40.5743322 8.4680500 9.83591484 0
#> 69 41.6675908 0.7652759 0.62137742 0
#> 70 42.9158813 5.7905562 6.62290269 0
#> 71 44.0135007 2.8361013 3.24418025 0
#> 72 44.7267301 5.8962074 4.27983436 0
#> 73 45.1094756 8.9836127 8.42937211 0
#> 74 45.5569744 9.3018814 4.29741470 0
#> 75 46.1837316 3.1484411 3.34648292 0
#> 76 46.2307686 4.0845319 3.52856534 1
#> 77 46.3697213 5.7224492 8.52444086 0
#> 78 46.4604868 6.1189641 8.06749945 1
#> 79 46.7984921 5.5727714 8.62358994 1
#> 80 46.9345880 8.8856033 8.02889160 0
#> 81 47.4210017 3.5381063 4.88175888 0
#> 82 47.8285310 5.3805381 8.57126602 2
#> 83 48.2430301 4.2879965 5.08231324 0
#> 84 48.3392036 5.5440290 3.58823525 1
#> 85 48.6693339 3.5373848 5.51006011 0
#> 86 49.3792075 2.4273647 6.14111389 0
#> 87 49.3883882 6.0146442 3.40040331 2