ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
studentT.cpp
Go to the documentation of this file.
1 #include "statsLib.h"
2 
38 dvariable dstudent_t( const dvar_vector& residual, const dvar_vector& df)
39 {
41  double pi = 3.141593;
42  dvar_vector t1 = 0.5*(df+1);
43  dvar_vector t2 = gammln(t1);
44  dvar_vector t3 = 0.5*log(df*pi)+gammln(0.5*df);
45  dvar_vector t4 = elem_prod(t1,log(1+elem_div(square(residual),df)));
46  dvariable pdf = sum(t3+t4-t2);
48  return( pdf );
49 }
d3_array elem_prod(const d3_array &a, const d3_array &b)
Returns d3_array results with computed elements product of a(i, j, k) * b(i, j, k).
Definition: d3arr2a.cpp:92
double gammln(double xx)
Log gamma function.
Definition: combc.cpp:52
void RETURN_ARRAYS_DECREMENT(void)
Decrements gradient_structure::RETURN_ARRAYS_PTR.
Definition: gradstrc.cpp:507
double sum(const d3_array &darray)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr.cpp:21
d3_array elem_div(const d3_array &a, const d3_array &b)
Returns d3_array results with computed elements division of a(i, j, k) / b(i, j, k).
Definition: d3arr2a.cpp:112
ADMB variable vector.
Definition: fvar.hpp:2172
Library of statistic functions.
dvariable dstudent_t(const dvar_vector &residual, const dvar_vector &df)
Definition: studentT.cpp:38
void RETURN_ARRAYS_INCREMENT(void)
Increments gradient_structure::RETURN_ARRAYS_PTR.
Definition: gradstrc.cpp:474
double square(const double value)
Return square of value; constant object.
Definition: d3arr4.cpp:16
Fundamental data type for reverse mode automatic differentiation.
Definition: fvar.hpp:1518
d3_array log(const d3_array &arr3)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr2a.cpp:13