EM1partial {RHawkes} | R Documentation |
Partial EM algorithm for the RHawkes process, version 1
Description
Calculates the RHawkes model parameters via a partial Expectation-Maximization (EM1) algorithm of Wheatley, Filimonov and Sornette (2016).
Usage
EM1partial(tms, cens, pars, maxiter = 1000, tol = 1e-8,
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),
logg.fn = function(x, p){
dweibull(x, shape = p[1], scale = p[2], log = TRUE) -
pweibull(x, shape = p[1], scale = p[2], lower.tail = FALSE, log.p = TRUE)
- (x / p[2])^p[1]},
Mu.fn = function(x, p){
- pweibull(x, shape = p[1], scale = p[2], lower.tail = FALSE, log.p = TRUE)
})
Arguments
tms |
A numeric vector, with values sorted in ascending order. Event times to fit the RHawkes point process model. |
cens |
A scalar. The censoring time. |
pars |
A numeric vector containing the parameters of the model, in order of the
immigration parameters |
maxiter |
The maximum number of iterations to perform. |
tol |
The algorithm stops when the difference between the previous iteration and
current iteration parameters sum is less than |
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 |
Mu.fn |
A (vectorized) function. Its value at |
logg.fn |
A (vectorized) function. The log of the immigrant distribution function. |
Value
iterations |
The number of iterations until convergence |
diff |
The absolute sum of the difference between the final two parameter estimates |
pars |
The parameter estimates from the EM algorithm |
Author(s)
Feng Chen <feng.chen@unsw.edu.au> Tom Stindl <t.stindl@unsw.edu.au>
Examples
## Not run:
## simulated data
tms <- sort(runif(100,0,100))
## the slower version of the EM algorithms on simulated data with default
## immigrant hazard function
## and offspring density
system.time( est1 <- EM1partial(tms, 101, c(2,1,0.5,1)) )
## End(Not run)