mllMRH2: Minus loglikelihood of an (bivariate) MRHawkes model with...

Description Usage Arguments Details Value Author(s) See Also Examples

Description

Calculates the minus loglikelihood of an (bivariate) RHawkes model with given immigration hazard functions μ, common offspring density functions h and bracnhing ratios η for event times and event types data on interval [0,cens]. The same as mllMRH although this version also returns the Rosenblatt residuals for goodness-of-fit assessment of the event times.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
mllMRH2(data, cens, par,
       h1.fn = function(x, p) 1 / p * exp( - x / p),
       h2.fn = function(x, p) 1 / p * exp( - x / p),
       mu1.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))
       },
       mu2.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))
       },
       H1.fn = function(x, p) pexp(x, rate = 1 / p),
       H2.fn = function(x, p) pexp(x, rate = 1 / p),
       Mu1.fn = function(x, p){
         - pweibull(x, shape = p[1], scale = p[2], lower.tail = FALSE, 
                   log.p = TRUE)
       },
       Mu2.fn = function(x, p){
         - pweibull(x, shape = p[1], scale = p[2], lower.tail = FALSE, 
                    log.p = TRUE)
       })

Arguments

data

A two column matrix. The first column contains the event times sorted in ascending order. The second column contains the corresponding event type with the label one or two.

cens

A scalar. The censoring time.

par

A numeric vector. Contains the ten parameters of the model, in order of the immigration parameters μ(.) for the two renewal distributions, the two offspring parameters h(.) and lastly the four branching ratios η.

h1.fn

A (vectorized) function. The offspring density function for type one events.

h2.fn

A (vectorized) function. The offspring density function for type two events.

mu1.fn

A (vectorized) function. The immigration hazard function for events of type one.

mu2.fn

A (vectorized) function. The immigration hazard function for events of type two.

H1.fn

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

H2.fn

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

Mu1.fn

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

Mu2.fn

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

Details

Calculate the MRHawkes point process Rosenblatt residuals

Value

mll

minus log-likelihood

W

Rosenblatt residuals of observed event times

Author(s)

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

See Also

mllMRH

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
  n <- 1000
  data <- cbind(sort(runif(n,0,1000)), 
                sample(1:2, size = n, replace = TRUE))
  tmp <- mllMRH2(data = data, cens = 1001, 
                 par = c(1,1,1,1,1,1,0.5,0.2,0.2,0.3))              
  pp <- ppoints(n)
  par(mfrow=c(1,2))
  plot(quantile(tmp$W,prob=pp),pp,type="l",
       main="Uniform QQ plot",
       xlab="Sample quantiles",ylab="Theoretical quantiles")
  abline(a = 0, b = 1, col = 2)
  a <- acf(tmp$W, main = "ACF Plot")
  ks.test(tmp$W,"punif")
  Box.test(tmp$W,lag=tail(a$lag,1))
  

MRHawkes documentation built on May 2, 2019, 2:51 p.m.