Prev Next

@(@\newcommand{\R}[1]{ {\rm #1} } \newcommand{\B}[1]{ {\bf #1} } \newcommand{\W}[1]{ \; #1 \; }@)@This is cppad_mixed--20220519 documentation: Here is a link to its current documentation .
User Defined Fixed Likelihood Function

Syntax
mixed_object
a1_double
Virtual Function
fixed_vec
vec
     constant
     Default
Example

Syntax
vec = mixed_object.fix_likelihood(fixed_vec)

mixed_object
We use mixed_object to denote an object of a class that is derived from the cppad_mixed base class.

a1_double
see a1_double .

Virtual Function
The following virtual function may be implemented in the derived class:
     virtual CppAD::vector<a1_double> fix_likelihood(
          const CppAD::vector<a1_double>& 
fixed_vec
     )

fixed_vec
This argument has prototype
     const CppAD::vector<a1_double>& 
fixed_vec
It contains a value for the fixed effects vector.

vec
This result has prototype
     CppAD::vector<
a1_doublevec
It is a negative log-density vector corresponding to the fixed likelihood g(theta) where @[@ g( \theta ) = - \log [ \B{p} ( z | \theta ) \B{p} ( \theta ) ] @]@

constant
Adding or subtracting a constant to vec[0] , that does not depend on the fixed effects @(@ \theta @)@, does not affect the optimal estimates for the fixed or random effects.

Default
The base class definition (default) for fix_likelihood returns an empty vector; i.e., vec.size() == 0 . This corresponds to the case where:
  1. All of the data depends on the random effects; i.e., the data vector z is empty.
  2. There is no prior p(theta) for the fixed effects.


Example
The file fix_likelihood.cpp contains an example and test of defining this virtual function. It returns true, if the test passes, and false otherwise.
Input File: src/fix_likelihood.omh