sim.pred1 | R Documentation |
Simulate a fitted RHawkes process model from the censoring time cens
to a future time point cens.tilde
, conditional on the observed
event times until the censoring time.
sim.pred1(tms, par, re.dist = rweibull, par.redist = list(shape = par[1], scale = par[2]), of.dis="exp", par.ofdis = list(rate=par[3]), branching.ratio = par[4], cens=tail(tms,1)+mean(diff(tms))/2, 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)) })
tms |
A numeric vector, with values sorted in ascending order. Event times to fit the RHawkes point process model. |
par |
A numeric vector, giving the parameters of the model with the immigration parameters μ(.), offspring parameters h(.) and lastly the branching ratio η(.). |
re.dist |
A (vectorized) function. The function to simulate from the immigrant waiting times distribution. |
par.redist |
A (named) list, giving the parameters of the immigrant waiting time distribution. |
of.dis |
A character string, for the name of the offspring birth time distribution. |
par.ofdis |
A (named) list, giving the parameters of the offspring birth time distribution. |
branching.ratio |
A scalar in [0,1), the branching ratio parameter. |
cens |
A scalar. The censoring time. |
cens.tilde |
A scalar. The future time to run the simulation to. |
mu.fn |
A (vectorized) function. The immigration hazard function. |
A numeric vector that contains the simulated event times from censoring time
cens
up until cens.tilde
Feng Chen <feng.chen@unsw.edu.au> Tom Stindl <t.stindl@unsw.edu.au>
sim.pred
.
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.pred1(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)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.