I'm using RStudio (R version 3.6.1) to run the likelihoodHawkes
function from the hawkes
package on my data, but every time I execute the function, my session encounters a fatal error.
Please note that I'm attempting to reproduce someone's results on a different dataset.
Example data:
symbol time price qty date lim tsign
A 1999-01-04 10:25:55 14.0 50 1999-01-04 1 0
B 1999-01-04 11:27:10 13.8 100 1999-01-04 1 0
C 1999-01-04 10:52:42 34.0 100 1999-01-04 1 0
The code block I'm using is:
library(hawkes)
negloglik_hawkes_m1 <- function(params, history){
lambda0 <- params[1:2]
alpha <- matrix(params[3:6], byrow = TRUE, nrow = 2)
beta <- params[7:8]
return(likelihoodHawkes(lambda0, alpha, beta, history))
}
df <- df[(df$tsign!=0)&(df$lim==2),]
ask_arr <- df[(df$tsign==1),"time"]
ask_arr <- (ask_arr-ask_arr [1]) [-1]
history <- list(ask_arr)
init_par <- c(0.5,0.5,0.2,0.1,0.1,0.2, 1,1)
params_hawkes <- round(optim(init_par,
negloglik_hawkes_m1,
method = "L-BFGS-B",
lower=rep(1e-6,8),
history = history)$par,2)
Any help is appreciated. Thanks in advance.
question from:
https://stackoverflow.com/questions/65871677/fatal-error-every-time-when-using-likelihoodhawkes 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…