Revision 1484

trunk/contrib/statslib/statsLib.h (revision 1484)
86 86

  
87 87

  
88 88
// 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 );
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 );
91 92
dvar_vector plogis( const dvector& x, const prevariable& location, const prevariable& scale );
92
dvector plogis( const dvector& x, const double& location, const double& scale );
93 93
dvar_vector plogis( const dvar_vector& x, const prevariable& location, const prevariable& scale );
94
// template <typename T1, typename T2>
95
// T1 plogis( const T1& x, const T2& location, const T2& scale );
94 96

  
95 97
// Exponential logistic distribution
96 98
dvar_vector eplogis(const dvar_vector& x, const dvariable& alpha, const dvariable& beta, const dvariable& gamma);
97 99
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);
98 102

  
99 103
// Beta distribution
100 104
dvariable dbeta( const dvariable& x, const double& shape1, const double& shape2 );
trunk/contrib/statslib/eplogis.cpp (revision 1484)
23 23
	return (1./(1.-gamma))*pow((1.-gamma)/gamma,gamma)*elem_div(exp(alpha*gamma*(beta-x)),1.+exp(alpha*(beta-x)));
24 24
}
25 25

  
26

  
26
// template <typename t1, typename t2>
27
// t1 eplogis(const t1& x, const t2& alpha, const t2& beta, const t2& gamma)
28
// {
29
// 	//exponential logistic based on Grant Thompson (1994) Paper, CJFAS.
30
// 	return (1./(1.-gamma))*pow((1.-gamma)/gamma,gamma)*elem_div(exp(alpha*gamma*(beta-x)),1.+exp(alpha*(beta-x)));
31
// }
trunk/contrib/statslib/objects.lst (revision 1484)
1
HEADERS=statsLib.h
1
 HEADERS=statsLib.h
2 2
OBJECTS=\
3 3
  alk.obj\
4 4
  baranov.obj\
trunk/contrib/statslib/logistic.cpp (revision 1484)
123 123
* 
124 124
* \return a template vector
125 125
*/
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
} 
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
// } 

Also available in: Unified diff