Description Usage Arguments Details Value Author(s) See Also Examples
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 Universal residuals
for goodness-of-fit assessment of the event types.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 | typeRes(data, cens, par, U = runif(length(data[,1])),
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)
})
|
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 η. |
U |
A numeric vector. Contains auxillary uniform random varables on the unit interval. |
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 |
Calculate the MRHawkes point process Universal residuals
mll |
minus log-likelihood |
V |
Universal residuals of observed event types |
Tom Stindl <t.stindl@unsw.edu.au> Feng Chen <feng.chen@unsw.edu.au>
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 <- typeRes(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$V,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$V, main = "ACF Plot")
ks.test(tmp$V,"punif")
Box.test(tmp$V,lag=tail(a$lag,1))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.