pred.den: RHawkes predictive density function

View source: R/pred.den.R

pred.denR Documentation

RHawkes predictive density function

Description

Calculates the predictive density of the next observed event time after the censoring time cens based on observations over the interval [0,cens].

Usage

pred.den(x, tms, cens, par, 
        h.fn = function(x, p) dexp(x, rate = 1 / p), 
        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))}, 
          H.fn = function(x, p) pexp(x, rate = 1 / p), 
          Mu.fn = function(x, p) {
            -pweibull(x, shape = p[1], scale = p[2], lower.tail = FALSE, log.p = TRUE)
          })

Arguments

x

A scalar. The amount of time after the censoring time cens.

tms

A numeric vector, with values sorted in ascending order. The event times to fit the RHawkes point process model.

cens

A scalar. The censoring time.

par

A numeric vector. Contains the parameters of the model, in order of the immigration parameters μ(.), offspring parameters h(.) and lastly the branching ratio η(.).

h.fn

A (vectorized) function. The offspring density function.

mu.fn

A (vectorized) function. The immigration hazard function.

H.fn

A (vectorized) function. Its value at t gives the integral of the offspring density function from 0 to t.

Mu.fn

A (vectorized) function. Its value at t gives the integral of the immigrant hazard function from 0 to t.

Value

The predictive density of the next event evaluated at x.

Author(s)

Feng Chen <feng.chen@unsw.edu.au> Tom Stindl <t.stindl@unsw.edu.au>

Examples

data(quake);
tms <- sort(quake$time);
# add some random noise to the identical event times
tms[213:214] <- tms[213:214] + 
                    sort(c(runif(1, -1, 1)/(24*60), runif(1, -1, 1)/(24*60)))
curve(pred.den(x, tms = tms, cens = 35064, par= c(0.314, 22.2, 1266, 0.512)) 
        ,0 ,2000, col = 2, lty = 2)

RHawkes documentation built on May 5, 2022, 5:06 p.m.