sim.pred {RHawkes} | R Documentation |
Simulate a fitted RHawkes process model
Description
Simulate a fitted RHawkes process model after the censoring time cens
to a future time point cens.tilde
.
Usage
sim.pred(tms, re.dist = rweibull, par,
par.redist = list(shape = par[1], scale = par[2]),
h.fn = function(x, p) dexp(x, rate = 1 / p), p.ofd = par[3],
branching.ratio = par[4], cens, cens.tilde = cens * 1.5,
mu.fn = function(x, p) {
exp(dweibull(x, shape = p[1], scale = p[2], log = TRUE) -
pweibull(x, shape = p[1], scale = p[2], lower.tail = FALSE, log.p = TRUE))
})
Arguments
tms |
A numeric vector, with values sorted in ascending order. Event times to fit the RHawkes point process model. |
re.dist |
A (vectorized) function. The immigrant renewal distribution function. |
par |
A numeric vector, giving the parameters of the model with the
immigration parameters |
par.redist |
A numeric vector. The parameters of the immigrant renewal distribution. |
h.fn |
A (vectorized) function. The offspring density function. |
p.ofd |
A (named) list. The parameters of the offspring density. |
branching.ratio |
A scalar. The branching ratio parameter. |
cens |
A scalar. The censoring time. |
cens.tilde |
A scalar. The future time that the simulation run until. |
mu.fn |
A (vectorized) function. The immigration hazard function. |
Value
A numeric vector that contains the simulated event times from censoring time
cens
up until cens.tilde
Author(s)
Feng Chen <feng.chen@unsw.edu.au> Tom Stindl <t.stindl@unsw.edu.au>
Examples
N <- 5; i <- 0;
data(quake); tms <- sort(quake$time);
# add some random noise the simultaneous occurring event times
tms[213:214] <- tms[213:214] +
sort(c(runif(1, -1, 1)/(24*60), runif(1, -1, 1)/(24*60)))
# simulate future event time based on MLE fitted RHawkes model
times <- replicate(N,
{cat(i<<-i+1,'\n');
sim.pred(tms = tms, par = c(0.314, 22.2, 1266, 0.512),
cens=35063)
})
plot(NA,NA,xlim=c(0,35063*1.5),ylim=c(0,max(lengths(times))+nrow(quake)),
xlab="time",ylab="Sample path")
lines(c(0,quake$time),0:nrow(quake),type="s")
for(i in 1:N)
lines(c(tail(quake$time,1),times[[i]]),nrow(quake)+0:length(times[[i]]),
type="s",lty=2)