TMB Documentation
v1.9.11

Separable extension of two densitites. More...
#include <density.hpp>
Separable extension of two densitites.
Take two densities f and g, and construct the density of their separable extension, defined as the multivariate Gaussian distribution with covariance matrix equal to the kronecker product between the covariance matrices of the two distributions. Note that f acts on the outermost array dimension and g acts on the fastest running array dimension.
More precisely: evaluate density h(x)=S/(2*pi)^.5*exp(.5*x'*S*x) where S=kronecker(Q,R)=Q%x%R assuming we have access to densities f(x)=Q/(2*pi)^.5*exp(.5*x'*Q*x) g(x)=R/(2*pi)^.5*exp(.5*x'*R*x) (Note: R corresponds to fastest running array dimension in Q%x%R ...) Let nq=nrow(Q) and nr=nrow(R), using rules of the kronecker product we have that * Quadratic form = .5*x'*S*x = .5*x'*(Q%x%I)*(I%x%R)*x * Normalizing constant = S/(2*pi)^.5 = (Q/sqrt(2*pi))%x%(R/sqrt(2*pi))^.5 = (Q/sqrt(2*pi))^(nr*.5) (R/sqrt(2*pi))^(nq*.5) = ... something that can be expressed through the normalizing constants f(0) and g(0) ... f(0)^nr * g(0)^nq * sqrt(2*pi)^(nq*nr)
Example:
Definition at line 1106 of file density.hpp.