Permalink
Fetching contributors…
Cannot retrieve contributors at this time
14 lines (13 sloc) 309 Bytes
#include <TMB.hpp>
template<class Type>
Type objective_function<Type>::operator() ()
{
DATA_VECTOR(Y);
DATA_VECTOR(x);
PARAMETER(a);
PARAMETER(b);
PARAMETER(logSigma);
parallel_accumulator<Type> nll(this);
for(int i=0;i<x.size();i++)nll-=dnorm(Y[i],a+b*x[i],exp(logSigma),true);
return nll;
}