Title: | Hawkes process simulation and calibration toolkit |
---|---|
Description: | The package allows to simulate Hawkes process both in univariate and multivariate settings. It gives functions to compute different moments of the number of jumps of the process on a given interval, such as mean, variance or autocorrelation of process jumps on time intervals separated by a lag. |
Authors: | Riadh Zaatour <[email protected]> |
Maintainer: | Riadh Zaatour <[email protected]> |
License: | GPL (>= 2) |
Version: | 0.0-4 |
Built: | 2024-11-10 06:40:16 UTC |
Source: | CRAN |
The function returns the theoretical autocorrelation of the number of jumps of a Hawkes process on nonoverlapping time intervals with lag
jumpAutocorrelation(lambda0, alpha, beta, tau,lag)
jumpAutocorrelation(lambda0, alpha, beta, tau,lag)
lambda0 |
Vector of initial intensity, a scalar in the monovariate case. |
alpha |
Matrix of excitation, a scalar in the monovariate case. Excitation values are all positive. |
beta |
Vector of betas, a scalar in the monovariate case. |
tau |
Time interval length. |
lag |
Time lag. |
Notice that in the scalar case, one must have beta>alpha for the process to be stable, and in the multivariate case, the matrix (diag(beta)-alpha) must have eigen values with strictly positive real parts for the process to be stable.
Returns a matrix containing the autocorrelation of the number of jumps of process components.
Jose Da Fonseca and Riadh Zaatour Hawkes Process : Fast Calibration, Application to Trade Clustering and Diffusive Limit. Journal of Futures Markets, Volume 34, Issue 6, pages 497-606, June 2014.
Jose Da Fonseca and Riadh Zaatour Clustering and Mean Reversion in Hawkes Microstructure Models.
#One dimensional Hawkes process lambda0<-0.02 alpha<-0.05 beta<-0.06 tau<-60#one minute lag<-0#adjacent non overlappingintervals h<-jumpAutocorrelation(lambda0,alpha,beta,tau,lag) #Multivariate Hawkes process lambda0<-c(0.02,0.02) alpha<-matrix(c(0.05,0,0,0.05),byrow=TRUE,nrow=2) beta<-c(0.06,0.06) tau<-60#one minute lag<-0#adjacent non overlappingintervals h<-jumpAutocorrelation(lambda0,alpha,beta,tau,lag)
#One dimensional Hawkes process lambda0<-0.02 alpha<-0.05 beta<-0.06 tau<-60#one minute lag<-0#adjacent non overlappingintervals h<-jumpAutocorrelation(lambda0,alpha,beta,tau,lag) #Multivariate Hawkes process lambda0<-c(0.02,0.02) alpha<-matrix(c(0.05,0,0,0.05),byrow=TRUE,nrow=2) beta<-c(0.06,0.06) tau<-60#one minute lag<-0#adjacent non overlappingintervals h<-jumpAutocorrelation(lambda0,alpha,beta,tau,lag)
The function returns the theoretical mean of the number of jumps of a Hawkes process on a time interval of length tau.
jumpMean(lambda0, alpha, beta, tau)
jumpMean(lambda0, alpha, beta, tau)
lambda0 |
Vector of initial intensity, a scalar in the monovariate case. |
alpha |
Matrix of excitation, a scalar in the monovariate case. Excitation values are all positive. |
beta |
Vector of betas, a scalar in the monovariate case. |
tau |
Time interval length. |
Notice that in the scalar case, one must have beta>alpha for the process to be stable, and in the multivariate case, the matrix (diag(beta)-alpha) must have eigen values with strictly positive real parts for the process to be stable.
Returns a vector containing the mean number of jumps of every process component.
Jose Da Fonseca and Riadh Zaatour Hawkes Process : Fast Calibration, Application to Trade Clustering and Diffusive Limit. Journal of Futures Markets, Volume 34, Issue 6, pages 497-606, June 2014.
Jose Da Fonseca and Riadh Zaatour Clustering and Mean Reversion in Hawkes Microstructure Models.
#One dimensional Hawkes process lambda0<-0.02 alpha<-0.05 beta<-0.06 tau<-60#one minute h<-jumpMean(lambda0,alpha,beta,tau) #Multivariate Hawkes process lambda0<-c(0.02,0.02) alpha<-matrix(c(0.05,0,0,0.05),byrow=TRUE,nrow=2) beta<-c(0.06,0.06) tau<-60#one minute h<-jumpMean(lambda0,alpha,beta,tau)
#One dimensional Hawkes process lambda0<-0.02 alpha<-0.05 beta<-0.06 tau<-60#one minute h<-jumpMean(lambda0,alpha,beta,tau) #Multivariate Hawkes process lambda0<-c(0.02,0.02) alpha<-matrix(c(0.05,0,0,0.05),byrow=TRUE,nrow=2) beta<-c(0.06,0.06) tau<-60#one minute h<-jumpMean(lambda0,alpha,beta,tau)
The function returns the theoretical variance matrix of the number of jumps of a Hawkes process on a time interval of length tau.
jumpVariance(lambda0, alpha, beta, tau)
jumpVariance(lambda0, alpha, beta, tau)
lambda0 |
Vector of initial intensity, a scalar in the monovariate case. |
alpha |
Matrix of excitation, a scalar in the monovariate case. Excitation values are all positive. |
beta |
Vector of betas, a scalar in the monovariate case. |
tau |
Time interval length. |
Notice that in the scalar case, one must have beta>alpha for the process to be stable, and in the multivariate case, the matrix (diag(beta)-alpha) must have eigen values with strictly positive real parts for the process to be stable.
Returns a matrix containing the variance of the number of jumps of every process component.
Jose Da Fonseca and Riadh Zaatour Hawkes Process : Fast Calibration, Application to Trade Clustering and Diffusive Limit. Journal of Futures Markets, Volume 34, Issue 6, pages 497-606, June 2014.
Jose Da Fonseca and Riadh Zaatour Clustering and Mean Reversion in Hawkes Microstructure Models.
#One dimensional Hawkes process lambda0<-0.02 alpha<-0.05 beta<-0.06 tau<-60#one minute h<-jumpVariance(lambda0,alpha,beta,tau) #Multivariate Hawkes process lambda0<-c(0.02,0.02) alpha<-matrix(c(0.05,0,0,0.05),byrow=TRUE,nrow=2) beta<-c(0.06,0.06) tau<-60#one minute h<-jumpVariance(lambda0,alpha,beta,tau)
#One dimensional Hawkes process lambda0<-0.02 alpha<-0.05 beta<-0.06 tau<-60#one minute h<-jumpVariance(lambda0,alpha,beta,tau) #Multivariate Hawkes process lambda0<-c(0.02,0.02) alpha<-matrix(c(0.05,0,0,0.05),byrow=TRUE,nrow=2) beta<-c(0.06,0.06) tau<-60#one minute h<-jumpVariance(lambda0,alpha,beta,tau)
Compute the likelihood function of a hawkes process for the given parameter and given the jump times vector (or list of vectors in the multivariate case), and until a time horizon.
likelihoodHawkes(lambda0, alpha, beta, history)
likelihoodHawkes(lambda0, alpha, beta, history)
lambda0 |
Vector of initial intensity, a scalar in the monovariate case. |
alpha |
Matrix of excitation, a scalar in the monovariate case. Excitation values are all positive. |
beta |
Vector of betas, a scalar in the monovariate case. |
history |
Jump times vector (or list of vectors in the multivariate case). |
Returns the opposite of the likelihood.
Y. Ogata. (1981) On Lewis simulation method for point processes. IEEE Transactions on Information Theory, 31
#One dimensional Hawkes process lambda0<-0.2 alpha<-0.5 beta<-0.7 history<-simulateHawkes(lambda0,alpha,beta,3600) l<-likelihoodHawkes(lambda0,alpha,beta,history[[1]]) #Multivariate Hawkes process 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)
#One dimensional Hawkes process lambda0<-0.2 alpha<-0.5 beta<-0.7 history<-simulateHawkes(lambda0,alpha,beta,3600) l<-likelihoodHawkes(lambda0,alpha,beta,history[[1]]) #Multivariate Hawkes process 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)
The function simulates a Hawkes process for the given parameter, and until a time horizon.
simulateHawkes(lambda0, alpha, beta, horizon)
simulateHawkes(lambda0, alpha, beta, horizon)
lambda0 |
Vector of initial intensity, a scalar in the monovariate case. |
alpha |
Matrix of excitation, a scalar in the monovariate case. Excitation values are all positive. |
beta |
Vector of betas, a scalar in the monovariate case. |
horizon |
Time horizon until which the simulation is to be conducted. |
Notice that in the scalar case, one must have beta>alpha for the process to be stable, and in the multivariate case, the matrix (diag(beta)-alpha) must have eigen values with strictly positive real parts for the process to be stable.
Returns a vector of jump times in the monovariate case, and a list of such vectors for every component in the multivariate case.
Y. Ogata. (1981) On Lewis simulation method for point processes. IEEE Transactions on Information Theory, 31
#One dimensional Hawkes process lambda0<-0.2 alpha<-0.5 beta<-0.7 horizon<-3600#one hour h<-simulateHawkes(lambda0,alpha,beta,horizon) #Multivariate Hawkes process 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) horizon<-3600#one hour h<-simulateHawkes(lambda0,alpha,beta,horizon)
#One dimensional Hawkes process lambda0<-0.2 alpha<-0.5 beta<-0.7 horizon<-3600#one hour h<-simulateHawkes(lambda0,alpha,beta,horizon) #Multivariate Hawkes process 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) horizon<-3600#one hour h<-simulateHawkes(lambda0,alpha,beta,horizon)