Skip to content

Bug in nonparametric #1

@smartell

Description

@smartell

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;
    }

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions