The spectral log-likelihood of a linear Gaussian state space model is given by
(Harvery, 1989 Section 4.3):$$logLik = -0.5 log(2\pi) - 0.5 \sum_{j=0}^{n-1} log\,g(\lambda[j]) -
\pi \sum_{j=0}^{n-1} I(\lambda[j])/g(\lambda[j])$$
where $\lambda[j]$ is a frequency defined as
$\lambda[j] = 2\pi j/n$;
$I(\lambda[j])$ is the periodogram at frequency $\lambda[j]$
and
$g(\lambda[j])$ is the spectral generating function of the model
at frequency $\lambda[j]$.
The derivation of the spectral likelihood function defined above relies
on the assumption that the process is circular (its covariance matrix
is circulant). If the process is not circular the value of
the likelihood is an approximation.
First and second order derivatives are computed by means of their
analytical expressions.
The first order derivatives of the spectral log-likelihood with respect to
parameter $\theta$ are given by:
$$(d\,logLik)/(d\,\theta) =
0.5 \sum_{j=0}^{n-1} ( (2\pi I(\lambda[j])) / (g(\lambda[j])) - 1 )
(1/g(\lambda[j])) d g(\lambda[j])/d \theta$$
Second order derivatives are given by:
$$(d^2\, logLik)(d\,\theta \theta') =
\sum_{j=0}^{n-1} ( (2\pi I(\lambda[j]))/(g(\lambda[j])) - 1 )
1/(2g(\lambda[j])) (d^2 g(\lambda[j]))/(d \theta d \theta') -$$
$$2 \sum_{j=0}^{n-1} ( (4\pi I(\lambda[j]))(g(\lambda[j])) - 1 )
( \frac{1}{2g(\lambda[j])} )^2
(d g(\lambda[j]))/(d \theta)
(d g(\lambda[j]))/(d \theta')$$
The argument x
is an auxiliar vector that is necessary in some contexts.
For example, the input to function optim
must contain
as first argument the vector of parameters where optimization is performed.
If it is not required or is redundant information contained in model@pars
it can be set to NULL
.
The functions mcloglik.fd
, mcloglik.fd.deriv
and
mcloglik.fd.grad
use the expressions for the spectral log-likelihood
function where the parameter specified in model@cpar
is concentrated
out of the likelihood function.
For further information about the barrier term see
Bounds on parameters and barrier term
in the details section in maxlik.fd.scoring
.
Arguments inf
and barrier
are not used by mloglik.fd.grad
and mcloglik.fd.grad
but they are needed in maxlik.fd.optim
,
where this function is passed as the gradient to be used by optim
including the arguments inf
and barrier
.
Argument xreg
.
It is an optional list of constant terms. It is used by
maxlik.fd.optim
when analytical derivatives are employed and
by maxlik.fd.scoring
. It avoids computing some constant terms each
time the function mloglik.fd.grad
is called.
The list xreg
should contain
an element called dxreg
, the external regressors differeneced by means
of the differencing filter that renders stationarity in the model and
the element fft.xreg
, the Fourier transform of each regressor
in dxreg
.
The list xreg
is not used by mloglik.fd
. It is necessary
to define this argument in the prototype of the function because when this function
is passed to optim
along with
mloglik.fd.grad
, the argument xreg
is passed to mloglik.fd
when it is defined in optim
as an argument to be passed
to mloglik.fd.grad
.
Argument xreg
is not currently implemented in functions with
concentration of a parameter, mloglik.fd
, mcloglik.fd.deriv
and mcloglik.fd.grad
.
Note: modcovgrad
is not available when external regressors are defined
in the input model, model
.