TMB Documentation  v1.9.0
longlinreg.cpp
// Linear regression - 10^6 observations.
#include <TMB.hpp>
template<class Type>
Type objective_function<Type>::operator() ()
{
PARAMETER(logSigma);
Type sigmasq=exp(2*logSigma);
ADREPORT(sigmasq);
Type nll = -sum(dnorm(Y, a+b*x, exp(logSigma), true));
return nll;
}
License: GPL v2