Identifies the type of the code and creates an object of the appropriate class.
mb_code(template)
new_mb_code(x, class)
An object inheriting from class mb_code.
x <- mb_code(
"#include <TMB.hpp>
template<class Type>
Type objective_function<Type>::operator() () {
DATA_VECTOR(Count);
PARAMETER(bIntercept);
int n = Count.size();
Type nll = 0.0;
for(int i = 0; i < n; i++){
nll -= dpois(Count(i), bIntercept, true);
}
return nll;
}
"
)
class(x)
#> [1] "tmb_code" "mb_code"