# EM algorithm for maximizing the likelihood of Multivariate Hawkes process [closed]

I am trying to model data with multivariate Hawkes distribution. Take the below example. I am able to compute likelihood but dont know how to maximize it.

library(hawkes)
lambda0 <- c(0.2,0.2)
alpha   <- matrix(c(0.5,0,0,0.5),byrow=TRUE,nrow=2)
beta    <- c(0.7,0.7)
history <- simulateHawkes(lambda0,alpha,beta,3600)
l       <- likelihoodHawkes(lambda0,alpha,beta,history)


How do I maximize this likelihood so that I can find the best lambda, alpha and beta parameters?

I am not able to find any library or function calls for doing this. Can anyone help?

• The title asks for an EM algorithm but EM is not mentioned in the question. The question body as written (as well as the answer) seem to be about how to use R. Commented May 12, 2018 at 10:46

params_hawkes <- optim(c(rep(1,2), rep(0.2,4),rep(2,2)), nloglik_bi_hawkes, history = history)


The optim function can be used for finding the best parameters.

nloglik_bi_hawkes <- function(params, history){
mu <- c(params[1],params[2])
alpha <- matrix(c(params[3],params[4],params[5],params[6]),byrow=TRUE,nrow=2)
beta <- c(params[7], params[8])
return(likelihoodHawkes(mu, alpha, beta, history))
}


Here, the alpha, beta and mu are initialized to random values then updated by minimizing the negative log likelihood.

The final list of parameters is stored in param_hawkes