Computations of log-likelihoods
The full likelihood function for a sampled path $X$ given by:
where
and $\tilde{r}(t,x):=\nabla\log\tilde{\rho}(t,x)$. The terms $\color{royalblue}{\int_0^T G(t, X_t) \dd t}$, and $\log\left(\color{forestgreen}{\tilde{\rho}(0,X_0)}\right)$ may be computed with functions:
GuidedProposals.loglikhd
— Functionloglikhd([::IntegrationRule=::LeftRule], P::GuidProp, X::Trajectory; skip=0)
Compute path contribution to the log-likelihood function, i.e.:
where
and $\tilde{r}(t,x):=\nabla\log\tilde{\rho}(t,x)$.
loglikhd(
[::IntegrationRule=::LeftRule],
PP::AbstractArray{<:GuidProp}, XX::AbstractArray{<:Trajectory};
skip=0
)
Compute path contribution to the log-likelihood function for a sequence of segments.
and
GuidedProposals.loglikhd_obs
— Functionloglikhd_obs(P::GuidProp, x0)
Compute the contribution of end-points to the log-likelihood function, i.e.: $\log\rho(t,x)$.
respectively. In general, deriving the term $\color{maroon}{\rho(0,X_0)}$ explicitly is impossible. Thankfully though, in an MCMC or an importance sampling setting this term always cancels out and so never needs to be computed.
Log-likelihood computation whilst sampling
Function rand!
—when called with a parameter Val(:ll)
—computes the "log-likelihood" at the time of sampling. Internally the following function is called after the Wiener process is sampled.
GuidedProposals.solve_and_ll!
— Functionsolve_and_ll!(X, W, P, y1)
Compute the trajectory under the law P
for a given Wiener noise W
and a starting point y1
. Store the trajectory in XX
. Compute the log-likelihood (path contribution) along the way. Return success_flag
and log-likelihood. success_flag
is set to false only if sampling was prematurely halted due to XX
violating assumptions about state space.
solve_and_ll!
computes only $\color{royalblue}{\int_0^T G(t, X_t) \dd t}$.
- When
rand!
is called on a singleGuidProp
(i.e. a single interval) then only this path contribution is returned. - However, if
rand!
is called on a list ofGuidProp
, then apart from summing over the results fromsolve_and_ll!
an additional end-point contribution is added, i.e.
is returned.