Model {hawkesbow} | R Documentation |
C++ abstract class for Hawkes processes
Description
This is a C++ abstract class for Hawkes processes, which holds methods for the estimation of its parameters.
Details
This serves as a basis for the Hawkes model and its count sequence, with conditional intensity function
\lambda(t) = \eta + \mu \sum_{T_i < t} h^\ast(t - T_i).
As an abstract class, an object of class Model
should never be directly
instanciated, but rather one of its derived class.
The constructor can take no argument, in which case the vector param
is
initialised to sensible values and binsize
defaults to 1.
Alternatively, param
and/or binsize
can be specified.
Fields
param
Vector of parameters of the Hawkes process, of the form
(\eta, \mu, ...)
.binsize
Bin size for the count sequences.
new(DerivedClass,(param),(binsize))
Constructor for derived classes;
param
and/orbinsize
can be safely ignored.mean()
Returns the expected value on
[0,\mathrm{end}]
.dmean()
Returns the Jacobian matrix of the expected value on
[0,\mathrm{end}]
.ddmean()
Returns the Hessian matrix of the expected value on
[0,\mathrm{end}]
.f(xi)
Returns the spectral density function of the time-continuous count sequence.
-
xi
A numeric vector of frequencies.
-
f1(xi,trunc)
Returns the spectral density function of the discrete time count sequence.
-
xi
A numeric vector of frequencies. -
trunc
The number of foldings to take into account for the aliasing.
-
whittle(I,trunc)
Returns the log-spectral likelihood of a discrete time count sequence.
-
I
The periodogram of the count sequence. -
trunc
The number of foldings to take into account for the aliasing.
-
loglik(events,end)
Returns the log-likelihood of a sequence of arrival times.
-
events
The sequence of arrival times. -
end
The endpoint of the observation window[0,\mathrm{end}]
.
-
dloglik(events,end)
Returns the Jacobian matrix of the log-likelihood of a sequence of arrival times.
-
events
The sequence of arrival times. -
end
The endpoint of the observation window[0,\mathrm{end}]
.
-
ddloglik(events,end)
Returns the Hessian matrix of the log-likelihood of a sequence of arrival times.
-
events
The sequence of arrival times. -
end
The endpoint of the observation window[0,\mathrm{end}]
.
-
See Also
Examples
# Simulate 1000 exponential Hawkes processes on \eqn{[0, 100]},
# and average the periodogram of the count sequences with bin size 1
# at each frequency.
I = rep(0, 100)
for (k in 1:1e3) {
x = hawkes(100, fun = 1, repr = .5, family = "exp", rate = 2)
y = discrete(x, binsize = 1)
I = I + Mod(fft(y - mean(y)))^2 / length(y)
}
# Check that the averaged periodogram correctly approximates the spectral
# density function of the count sequence
model = new(Exponential)
model$param = c(1, .5, 2)
model$binsize = 1
z = 2 * pi * 0:99 / 100 # Frequencies of the periodogram
plot(z, I / 1e3, type = "l") # Averaged periodogram
lines(z, model$f1(xi = z, trunc = 10L), col = "red")