ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
vregress.cpp
Go to the documentation of this file.
00001 /*
00002  * $Id$
00003  *
00004  * Author: David Fournier
00005  * Copyright (c) 2008-2012 Regents of the University of California
00006  */
00011 #include <fvar.hpp>
00012 
00017 dvariable regression(const dvector& obs, const dvar_vector& pred)
00018 {
00019   double nobs=double(size_count(obs));
00020   dvariable vhat=norm2(obs-pred);
00021   vhat/=nobs;
00022   return (.5*nobs*log(vhat));
00023 }