

    \filetitle{loglik}{Evaluate minus the log-likelihood function in time or frequency domain}{model/loglik}

	\paragraph{Full syntax}
 
 \begin{verbatim}
 [OBJ,V,F,PE,DELTA,PDELTA] = loglik(M,D,RANGE,...)
 [OBJ,V,F,PE,DELTA,PDELTA,~,PRED,SMOOTH] = loglik(M,D,RANGE,...)
 \end{verbatim}
 \paragraph{Syntax for fast one-off likelihood evaluation}
 
 \begin{verbatim}
 OBJ = loglik(M,D,RANGE,...)
 \end{verbatim}
 \paragraph{Syntax for repeated fast likelihood evaluations}
 
 \begin{verbatim}
 % Initialise
 loglik(M,D,RANGE,...,'persist=',true);
 
 % Fast loglik for different parameter sets
 M... = ...; % Change parameters.
 L = loglik(M); % Evaluate likelihood.
 ...
 M... = ...; % Change parameters.
 L = loglik(M); % Evaluated likelihood
 ...
 % etc.
 \end{verbatim}
 \paragraph{Input arguments}
 
 \begin{itemize}
 \item
   \texttt{M} {[} model {]} - Model object on which the likelihood of the
   input data will be evaluated.
 \item
   \texttt{D} {[} struct \textbar{} cell {]} - Input database or datapack
   from which the measurement variables will be taken.
 \item
   \texttt{RANGE} {[} numeric {]} - Date range.
 \end{itemize}
 \paragraph{Output arguments}
 
 \subparagraph{Test title}
 
 \begin{itemize}
 \item
   \texttt{OBJ} {[} numeric {]} - Value of minus the log-likelihood
   function (or other objective function if specified in options).
 \item
   \texttt{V} {[} numeric {]} - Estimated variance scale factor if the
   \texttt{'relative='} options is true; otherwise \texttt{V} is 1.
 \item
   \texttt{F} {[} numeric {]} - Sequence of forecast MSE matrices for
   measurement variables.
 \item
   \texttt{PE} {[} struct {]} - Database with prediction errors for
   measurement variables; exp of prediction errors for measurement
   variables declared as log-variables.
 \item
   \texttt{DELTA} {[} struct {]} - Estimates of deterministic trend
   parameters specified in through the \texttt{'outoflik='} option.
 \item
   \texttt{PDELTA} {[} numeric {]} - MSE matrix of the estimates of the
   \texttt{'outoflik='} parameters.
 \item
   \texttt{PRED} {[} struct \textbar{} cell {]} - Output database or
   datapack with the Kalman predictor data.
 \item
   \texttt{SMOOTH} {[} struct \textbar{} cell {]} - Output database or
   datapack with the Kalman smoother data.
 \end{itemize}
 \paragraph{Options}
 
 \begin{itemize}
 \item
   \texttt{'persist='} {[} \texttt{true} \textbar{} \emph{\texttt{false}}
   {]} --- Pre-process and store the overhead (data and options) for
   subsequent fast calls.
 \end{itemize}
 See help on \url{model/filter} for other options available.
 
 \paragraph{Description}
 
 The number of output arguments you request when calling \texttt{loglik}
 affects computational efficiency. Running the function with only the
 first output argument, i.e.~the value of the likelihood function (minus
 the log of it, in fact), results in the fastest performance.
 
 Not specifying the last two output arguments, \texttt{PRED} and
 \texttt{SMOOTH}, if you really don't need them will speed up the
 function significantly because the prediction data will not have to be
 stored, and the smoother data will not be calculated at all.
 
 The \texttt{loglik} function returns identical results as the
 \url{model/filter} function, only the output arguments are arranged in
 different ways.
 
 \paragraph{Example}


