seacode / gmacs

A generic size-structured stock assessment model
https://seacode.github.io/gmacs
18 stars 14 forks source link

DoubleNormal selectivity #145

Closed quantifish closed 7 years ago

quantifish commented 9 years ago

Here's an ADMB question for ya'll. I've written the double normal selectivity function as

template<class T, class T2>
inline
const T pdubnorm(const T &x, const T2 &sL, const T2 &s50, const T2 &sR)
{
    T selex = pow(2,-pow((x-sL)/sL,2)); // if x <= s50
    T selex = pow(2,-pow((x-sR)/sL,2); // if x > s50
    return selex;
}

Obviously this won't work, but I am wondering if there is some elegant ADMB function for specifying the if statement that I've commented out at the right???

Also, need to get coefficients working.

wStockhausen commented 9 years ago

In SS, it's done with a steep logistic curve, something like:

S(x) = S1(x)(1-L(x) )+ S_2(x)_L(x)

where S_1 and S_2 are the xs50 functions (following your example), and L(x) is a logistic that rises rapidly from 0 to 1 in the neighborhood of s50 (say with a slope of 100).

Buck


On Thu, Aug 6, 2015 at 6:49 PM, Darcy Webber notifications@github.com wrote:

Here's an ADMB question for ya'll. I've written the double normal selectivity function as

template<class T, class T2> inline const T pdubnorm(const T &x, const T2 &sL, const T2 &s50, const T2 &sR) { T selex = pow(2,-pow((x-sL)/sL,2)); // if x <= s50 T selex = pow(2,-pow((x-sR)/sL,2); // if x > s50 return selex; }

Obviously this won't work, but I am wondering if there is some elegant ADMB function for specifying the if statement that I've commented out at the right???

— Reply to this email directly or view it on GitHub https://github.com/seacode/gmacs/issues/145.