ADMB Documentation  -a65f1c97
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
statslib/logistic.cpp
Go to the documentation of this file.
1  #include "statsLib.h"
2 
30 dvariable plogis( const prevariable& x, const double& location, const double& scale )
31 {
32  if( scale<=0 )
33  {
34  cerr<<"Standard deviation is less than or equal to zero in "
35  "plogis( const dvariable& x, const double& location, const double& scale )\n";
36  return 0;
37  }
38  return 1./(1.+mfexp((location-x)/scale));
39 }
40 
49 dvariable plogis( const prevariable& x, const prevariable& location, const prevariable& scale )
50 {
51  if( scale<=0 )
52  {
53  cerr<<"Standard deviation is less than or equal to zero in "
54  "plogis( const dvariable& x, const dvariable& location, const dvariable& scale )\n";
55  return 0;
56  }
57  return 1./(1.+mfexp((location-x)/scale));
58 }
59 
68 dvar_vector plogis( const dvector& x, const prevariable& location, const prevariable& scale )
69 {
70  if( scale<=0 )
71  {
72  cerr<<"Standard deviation is less than or equal to zero in "
73  "plogis( const dvector& x, const dvariable& location, const dvariable& scale )\n";
74  return 0;
75  }
76  return 1./(1.+mfexp((location-x)/scale));
77 }
78 
87 dvector plogis( const dvector& x, const double& location, const double& scale )
88 {
89  if( scale<=0 )
90  {
91  cerr<<"Standard deviation is less than or equal to zero in "
92  "plogis( const dvector& x, const double& location, const double& scale )\n";
93  return 0;
94  }
95  return 1./(1.+mfexp((location-x)/scale));
96 }
97 
106 dvar_vector plogis( const dvar_vector& x, const prevariable& location, const prevariable& scale )
107 {
108  if( scale<=0 )
109  {
110  cerr<<"Standard deviation is less than or equal to zero in "
111  "plogis( const dvar_vector& x, const dvariable& location, const dvariable& scale )\n";
112  return 0;
113  }
114  return 1./(1.+mfexp((location-x)/scale));
115 }
116 
126 // template <typename T1, typename T2>
127 // T1 plogis( const T1& x, const T2& location, const T2& scale )
128 // {
129 // if( scale<=0 )
130 // {
131 // cerr<<"Standard deviation is less than or equal to zero in "
132 // "plogis( const dvar_vector& x, const dvariable& location, const dvariable& scale )\n";
133 // return 0;
134 // }
135 // return 1./(1.+mfexp((location-x)/scale));
136 // }
Base class for dvariable.
Definition: fvar.hpp:1315
#define x
Vector of double precision numbers.
Definition: dvector.h:50
ADMB variable vector.
Definition: fvar.hpp:2172
d3_array mfexp(const d3_array &m)
Author: David Fournier Copyright (c) 2008-2012 Regents of the University of California.
Definition: d3arr7.cpp:10
Library of statistic functions.
Fundamental data type for reverse mode automatic differentiation.
Definition: fvar.hpp:1518
dvariable plogis(const prevariable &x, const double &location, const double &scale)