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

Description Usage Arguments 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 most recent immigrant probabilities at the censoring.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
mllMRH1(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.

Value

mll

minus log-likelihood

p

most recent immigrant probabilities at the censoring time

n

number of events

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
  data <- cbind(sort(runif(1000,0,1000)), 
                sample(1:2, size = 1000, replace = TRUE))
  tmp <- mllMRH1(data = data, cens = 1001, 
                 par = c(3,1.2,1/3,0.2,1,1,0.5,0.2,0.2,0.3))
  ## last immigrant probabilities
  lip <- tmp$p
  ## sample last immigrant at censoring time for component one and 
  ## component two respectively
  c(sample(0:1000, 1, replace = TRUE, prob = rowSums(lip)), 
  sample(0:1000, 1, replace = TRUE, prob = colSums(lip)))
  

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