-
Notifications
You must be signed in to change notification settings - Fork 4
Open
Labels
Description
The following code reads that it should rescale to a maximum of one. But it rescales the terminal value to one, and if dome-shape, then will return values greater than one.
/**
* @brief Nonparametric selectivity function
* @details Estimate one parameter per age/size class, and rescale to maximum of one.
*
* @param x Independent variable (number of classes)
* @param selparms Vector of selectivity parameters (initial values).
* @return Selectivity values.
*/
template<class T>
const T nonparametric(const T &x, const T &selparms)
{
int x2 = x.indexmax();
dvar_vector selex(1,x2);
for (int i=1; i<=x2; i++)
selex(i) = (1.0)/(1.0+mfexp(selparms(i)));
dvariable temp = selex(x2);
selex /= temp;
return selex;
}