mllMRH2 {MRHawkes} | R Documentation |
Minus loglikelihood of an (bivariate) MRHawkes model with Rosenblatt residuals
Description
Calculates the minus loglikelihood of an (bivariate) RHawkes model with
given immigration hazard functions \mu
, common offspring density
functions h
and bracnhing ratios \eta
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
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 |
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 |
H2.fn |
A (vectorized) function. Its value at |
Mu1.fn |
A (vectorized) function. Its value at |
Mu2.fn |
A (vectorized) function. Its value at |
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
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))