Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug in nonparametric #1

Open
smartell opened this issue Jun 12, 2014 · 0 comments
Open

Bug in nonparametric #1

smartell opened this issue Jun 12, 2014 · 0 comments
Assignees
Labels

Comments

@smartell
Copy link
Contributor

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;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants