ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
studentT.cpp
Go to the documentation of this file.
00001 #include "statsLib.h"
00002 
00038 dvariable dstudent_t( const dvar_vector& residual, const dvar_vector& df)
00039 {
00040   RETURN_ARRAYS_INCREMENT();
00041   double pi =  3.141593;
00042   dvar_vector t1 = 0.5*(df+1);
00043   dvar_vector t2 = gammln(t1);
00044   dvar_vector t3 = 0.5*log(df*pi)+gammln(0.5*df);
00045   dvar_vector t4 = elem_prod(t1,log(1+elem_div(square(residual),df)));
00046   dvariable pdf = sum(t3+t4-t2);
00047   RETURN_ARRAYS_DECREMENT();
00048   return( pdf );
00049 }