\(\newcommand{\B}[1]{ {\bf #1} }\) \(\newcommand{\R}[1]{ {\rm #1} }\) \(\newcommand{\W}[1]{ \; #1 \; }\)
ran_likelihood¶
View page sourceUser Defined Random Likelihood Function¶
Syntax¶
vec = mixed_object . ran_likelihood ( fixed_vec , random_vec )
mixed_object¶
We use mixed_object
to denote an object of a class that is
derived from the cppad_mixed base class.
Virtual Function¶
The following virtual function may be implemented in the derived class:
virtual CppAD::vector<a1_double> ran_likelihood (const CppAD::vector<a1_double>& fixed_vec ,const CppAD::vector<a1_double>& random_vecfixed_vec¶
This argument has prototype
const CppAD::vector<a1_double>&fixed_vec
It contains a value for the fixed effects vector.
random_vec¶
This argument has prototype
const CppAD::vector<a1_double>&random_vec
It contains a value for the random effects vector.
vec¶
This result has prototype
CppAD::vector<a1_double>vec
It is a Negative Log-Density Vector corresponding to the random likelihood f(theta, u) where
The Laplace approximation only makes sense if this function is smooth; i.e,
vec .
size() == 1
constant¶
Adding or subtracting a constant to vec [0] , that does not depend on the fixed effects \(\theta\) or the random effects \(u\), does not affect the optimal estimates for the fixed and random effects.
Default¶
The base class definition (default) for ran_likelihood
returns an empty vector;
i.e., vec . size () == 0 .
This corresponds to the case where none of the data depends on the
random effects; i.e., the data vector
y is empty.
In this case there random effects vector should also be empty.
Example¶
The file ran_likelihood.cpp contains an example of defining this virtual function.