ADMB Documentation  11.5.3197
 All Classes Files Functions Variables Typedefs Friends Defines
statslib/logistic.cpp
Go to the documentation of this file.
00001  #include "statsLib.h"
00002 
00030 dvariable plogis( const prevariable& x, const double& location, const double& scale )
00031 {
00032   if( scale<=0 ) 
00033   {
00034     cerr<<"Standard deviation is less than or equal to zero in "
00035     "plogis( const dvariable& x, const double& location, const double& scale )\n";
00036     return 0;
00037   }
00038   return 1./(1.+mfexp((location-x)/scale));
00039 }
00040 
00049 dvariable plogis( const prevariable& x, const prevariable& location, const prevariable& scale )
00050 {
00051   if( scale<=0 ) 
00052   {
00053     cerr<<"Standard deviation is less than or equal to zero in "
00054     "plogis( const dvariable& x, const dvariable& location, const dvariable& scale )\n";
00055     return 0;
00056   }
00057   return 1./(1.+mfexp((location-x)/scale));
00058 }
00059 
00068 dvar_vector plogis( const dvector& x, const prevariable& location, const prevariable& scale )
00069 {
00070   if( scale<=0 ) 
00071   {
00072     cerr<<"Standard deviation is less than or equal to zero in "
00073     "plogis( const dvector& x, const dvariable& location, const dvariable& scale )\n";
00074     return 0;
00075   }
00076   return 1./(1.+mfexp((location-x)/scale));
00077 }
00078 
00087 dvector plogis( const dvector& x, const double& location, const double& scale )
00088 {
00089   if( scale<=0 ) 
00090   {
00091     cerr<<"Standard deviation is less than or equal to zero in "
00092     "plogis( const dvector& x, const double& location, const double& scale )\n";
00093     return 0;
00094   }
00095   return 1./(1.+mfexp((location-x)/scale));
00096 }
00097 
00106 dvar_vector plogis( const dvar_vector& x, const prevariable& location, const prevariable& scale )
00107 {
00108   if( scale<=0 ) 
00109   {
00110     cerr<<"Standard deviation is less than or equal to zero in "
00111     "plogis( const dvar_vector& x, const dvariable& location, const dvariable& scale )\n";
00112     return 0;
00113   }
00114   return 1./(1.+mfexp((location-x)/scale));
00115 }
00116 
00126 // template <typename T1, typename T2>
00127 // T1 plogis( const T1& x, const T2& location, const T2& scale )
00128 // {
00129 //  if( scale<=0 ) 
00130 //  {
00131 //    cerr<<"Standard deviation is less than or equal to zero in "
00132 //    "plogis( const dvar_vector& x, const dvariable& location, const dvariable& scale )\n";
00133 //    return 0;
00134 //  }
00135 //  return 1./(1.+mfexp((location-x)/scale));
00136 // }