simulate {PtProcess} | R Documentation |
Provides methods for the generic function simulate
.
## S3 method for class 'mpp': simulate(object, nsim = 1, seed = NULL, max.rate = NA, ...) ## S3 method for class 'linksrm': simulate(object, nsim = 1, seed = NULL, max.rate = NA, ...)
object |
an object with class "mpp" or "linksrm" . |
nsim |
number of events to simulate. |
seed |
seed for the random number generator. |
max.rate |
max rate. |
... |
other arguments. |
The thinning method (Ogata, 1981) is used to simulate a point process with specified ground intensity function. The method involves calculating an upper bound for the intensity function, simulating a value for the time to the next possible event using a rate equal to this upper bound, and then calculating the intensity at this simulated point; hence these “events” are simulated too frequently. The ratio of this rate with the upper bound is compared with a uniform random number to randomly determine whether the simulated time is retained or not (i.e. thinned).
The functions need to calculate an upper bound for the intensity function. The ground intensity functions will usually be discontinuous at event times, but may be monotonically increasing or decreasing at other times. The ground intensity functions have an attribute called rate
with values of "bounded"
, "increasing"
or "decreasing"
. This information is used to determine the required upper bounded.
The function simulate.linksrm
is currently only used in conjunction with linksrm_gif
, or a variation of that function. It expects the gif
function to have an attribute called regions
, which may be an expression, being the number of regions. The method used by the function simulate.linksrm
also assumes that the function is “increasing” (i.e. rate, summed over all regions, apart from discontinuous jumps), hence a positive tectonic input over the whole system.
TT <- c(0, 1000) bvalue <- 1 params <- c(-2.5, 0.01, 0.8, bvalue*log(10)) x <- mpp(data=NULL, gif=srm_gif, mark=list(NULL, rexp_mark), params=params, gmap=expression(params[1:3]), mmap=expression(params[4]), TT=TT) x <- simulate(x, seed=5) y <- hist(x$data$magnitude, xlab="Magnitude", main="") # overlay with an exponential density magn <- seq(0, 3, length.out=100) points(magn, nrow(x$data)*(y$breaks[2]-y$breaks[1])* dexp(magn, rate=1/mean(x$data$magnitude)), col="red", type="l")