TMB Documentation  v1.9.11
lr_test.cpp
// Illustrate map feature of TMB to perform likelihood ratio tests on a ragged array dataset.
#include <TMB.hpp>
template<class Type>
Type objective_function<Type>::operator() ()
{
DATA_FACTOR(group);
Type res=0;
for(int i=0;i<obs.size();i++){
res -= dnorm(obs[i],mu[group[i]],sd[group[i]],true);
}
return res;
}
License: GPL v2