Revision 1509 trunk/contrib/statslib/statsLib.h

statsLib.h (revision 1509)
6 6
#include <df1b2fun.h>
7 7
#include <adrndeff.h> 
8 8

  
9

  
10

  
9 11
dvar_matrix ageLengthKey( const dvar_vector& mu, const dvar_vector& sig, const dvector& x );
10 12
dmatrix ageLengthKey( const dvector& mu, const dvector& sig, const dvector& x );
11 13
dvar_matrix ALK(dvar_vector mu, dvar_vector sig, dvector x);
......
86 88

  
87 89

  
88 90
// Plogis distribution
89
dvariable   plogis( const prevariable& x, const double& location, const double& scale );
90
dvariable   plogis( const prevariable& x, const prevariable& location, const prevariable& scale );
91
dvector     plogis( const dvector& x, const double& location, const double& scale );
92
dvar_vector plogis( const dvector& x, const prevariable& location, const prevariable& scale );
93
dvar_vector plogis( const dvar_vector& x, const prevariable& location, const prevariable& scale );
91
// #include <plogis.cpp>
92
template <typename T1, typename T2>
93
T1 plogis(T1 *x, T2 *location, T2 *scale)
94
{
95
  T1 y = 1./(1.+mfexp((*location - *x) / *scale));
96
  return (y);
97
}  
98

  
99
template <typename T1, typename T2>
100
T1 plogis(T1 x, T2 location, T2 scale)
101
{
102
  T1 y = 1./(1.+mfexp((location - x) / scale));
103
  return (y);
104
} 
105

  
106
template <typename T1, typename T2, typename T3>
107
T1 plogis(T2 x, T3 location, T3 scale)
108
{
109
  T1 y = 1./(1.+mfexp((location - x) / scale));
110
  //cout<<typeid(y)<<endl;
111
  return (y);
112
} 
113

  
114
// template class plogis<dvariable>;
115
// template class plogis<dvector>;
116
// template class plogis<dvar_vector>;
117
// template<typename T>
118
// class AccumulationTraits;
119
// template<>
120
// class AccumulationTraits<dvector> {
121
//   public:
122
//   typedef dvar_vector AccT;
123
// };
124
// template<>
125
// class AccumulationTraits<dvar_vector> {
126
//   public:
127
//   typedef dvector AccT;
128
// };
129

  
94 130
// template <typename T1, typename T2>
95
// T1 plogis( const T1& x, const T2& locatiogn, const T2& scale );
131
// typename AccumulationTraits<T1>::AccT plogis(  T1& x,  T2& location,  T2& scale )
132
// {
133
//   if( scale<=0 ) 
134
//   {
135
//     cerr<<"Standard deviation is less than or equal to zero in "
136
//     "plogis( const dvar_vector& x, const dvariable& location, "
137
//             "const dvariable& scale )\n";
138
//     return 0;
139
//   }
140
//   typedef typename AccumulationTraits<T1>::AccT AccT;
141
//   AccT logistic = 1./(1.+mfexp((location-x)/scale));
142
//   return (logistic);
143
// }  
96 144

  
145
// dvariable   plogis( const prevariable& x, const double& location, const double& scale );
146
// dvariable   plogis( const prevariable& x, const prevariable& location, const prevariable& scale );
147
// dvector     plogis( const dvector& x, const double& location, const double& scale );
148
// dvar_vector plogis( const dvector& x, const prevariable& location, const prevariable& scale );
149
// dvar_vector plogis( const dvar_vector& x, const prevariable& location, const prevariable& scale );
150

  
97 151
// Exponential logistic distribution
98 152
dvar_vector eplogis(const dvar_vector& x, const dvariable& alpha, const dvariable& beta, const dvariable& gamma);
99 153
dvector eplogis(const dvector& x, const double& alpha, const double& beta, const double& gamma);
100
// template <typename t1, typename t2>
101
// t1 eplogis(const t1& x, const t2& alpha, const t2& beta, const t2& gamma);
102 154

  
103 155
// Beta distribution
104 156
dvariable dbeta( const dvariable& x, const double& shape1, const double& shape2 );
......
189 241
* @date 12/14/2011
190 242
*/
191 243

  
244

  
245

  
192 246
#endif
247

  
248

  
249

  
... This diff was truncated because it exceeds the maximum size that can be displayed.

Also available in: Unified diff