derived_ctor

View page source

User Defined Class Derived From cppad_mixed

Syntax

mixed_derived mixed_object (
      n_fixed , n_random ,
      quasi_fixed , bool_sparsity , A_rcv , trace_init ,
      …
)

Prototype

   cppad_mixed(
      size_t               n_fixed       ,
      size_t               n_random      ,
      bool                 quasi_fixed   = false           ,
      bool                 bool_sparsity = false           ,
      const d_sparse_rcv&  A_rcv         = d_sparse_rcv()  ,
      bool                 trace_init    = false
   );

See Also

initialize

mixed_derived

This is the name of the class derived in the following fashion:

class mixed_derived : public cppad_mixed {

mixed_object

This is the derived class object that is constructed by the syntax above.

cppad_mixed

The derived class constructor must call its base class constructor as follows:

      cppad_mixed (
            n_fixed , n_random , quasi_fixed , bool_sparsity , A_rcv
      )

The arguments quasi_fixed , bool_sparsity , A_rcv are optional; see default values in prototype above.

n_fixed

This is the number of fixed effects in the model.

n_random

This is the number of random effects in the model. In the case where there are No Random Effects , n_random = 0 .

quasi_fixed

true

If quasi_fixed is true, a quasi-Newton approximation for the Hessian of the fixed effects objective L(theta) is used during the optimization of the fixed effects. This is more robust when fixed_in is far away from a reasonable value and might lead to the Hessian w.r.t. the random effects not being positive definite. If quasi_fixed is true, some initialization is skipped during initialize . This initialization is needed, and hence computed if the and when the information matrix is computed.

false

If quasi_fixed is false, the Hessian of the fixed effects objective is computed using the approximate Laplace objective H(beta, theta, u) . The extra routines for initializing the second order accurate approximation for the Laplace objective init_laplace_obj_fun , and init_laplace_obj_hes are used to initialize the Hessian of the fixed effects objective.

bool_sparsity

If bool_sparsity is true, where possible boolean sparsity patterns are used for this computation, otherwise set sparsity patterns are used. This should only affect to amount of time and memory used for the computations.

A_rcv

This is a Sparse Matrix representation of the random constraint matrix \(A\). If random_vec . size () is zero, there are no constraint equations and A_rcv . nr () == 0 (this is the case for the default value of this argument). Otherwise, A_rcv . nc () must be equal to n_random and A_rcv . nr () is the number of constraints.

trace_init

If true, trace the initialization of cppad_mixed data structures on standard output. This can be useful for large problems where the initialization takes a significant amount of time. For an example see trace_init .

Other arguments to the derived class constructor (that are not used by the base class constructor). The other arguments need not appear at the end of the derived class constructor (as in the syntax above).

CppAD ErrorHandler

If a CppAD error occurs, its ErrorHandler is used to map it to either a fatal_error or warning .

Example

The file derived_ctor.cpp contains an example and test that uses this derived class. It returns true for success and false for failure.