seacode / gmacs

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

Extend growth model #203

Open jimianelli opened 6 years ago

jimianelli commented 6 years ago

Extend growth model in GMACS (As per Andre Punt) to allow the annual expected growth increments to be parameters, and for the parameter that determines the variance in the growth increment to be estimated.

smartell commented 6 years ago

You mean a nonparametric growth transition matrix?

On Thu, Oct 4, 2018 at 7:34 AM Jim Ianelli notifications@github.com wrote:

Extend growth model in GMACS (As per Andre Punt) to allow the annual expected growth increments to be parameters, and for the parameter that determines the variance in the growth increment to be estimated.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/seacode/gmacs/issues/203, or mute the thread https://github.com/notifications/unsubscribe-auth/ABLiSIkGrIsfeJOMexzXkZu-KshViXahks5uhiqGgaJpZM4XIXtJ .

wStockhausen commented 6 years ago

Presumably like Tanner, with parametric distribution but potentially time-varying parameters.

On Thu, Oct 4, 2018 at 9:24 AM Steve Martell notifications@github.com wrote:

You mean a nonparametric growth transition matrix?

On Thu, Oct 4, 2018 at 7:34 AM Jim Ianelli notifications@github.com wrote:

Extend growth model in GMACS (As per Andre Punt) to allow the annual expected growth increments to be parameters, and for the parameter that determines the variance in the growth increment to be estimated.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/seacode/gmacs/issues/203, or mute the thread < https://github.com/notifications/unsubscribe-auth/ABLiSIkGrIsfeJOMexzXkZu-KshViXahks5uhiqGgaJpZM4XIXtJ

.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/seacode/gmacs/issues/203#issuecomment-427082628, or mute the thread https://github.com/notifications/unsubscribe-auth/AFgB9LfQ15OyY_-mc1b0Fmtx2MgBylacks5uhjY_gaJpZM4XIXtJ .

--


  • Dr. William T. Stockhausen *
  • Resource Ecology and Fisheries Management *
  • Alaska Fisheries Science Center *
  • National Marine Fisheries Service *
  • National Oceanic and Atmospheric Administration *
  • 7600 Sand Point Way N.E. *
  • Seattle, Washington 98115-6349 *
  • email: William.Stockhausen@noaa.gov *
  • voice: 206-526-4241 fax: 206-526-6723 *
  • web : http://www.afsc.noaa.gov *

    All models are wrong, some are useful.--G.E.P. Box Beware of geeks bearing equations. --W. Buffett


    Disclaimer: The opinions expressed above are personal and do not necessarily reflect official NOAA policy.

quantifish commented 6 years ago

Something like this?:

matrix get_growth_increment(int n, real tau, vector midpoint, vector gpars) { real invpi; real mininc; vector[2] gitmp; real gi; real pred_sd; real sd_total; matrix[2,n] growth_increment; real pen; real k; real Gconst; real gshape; real gcv; real gmin;

k = gpars[1]; Gconst = gpars[2]; gshape = gpars[3]; gcv = gpars[4]; gmin = gpars[5];

pen = 0.0; mininc = 1e-6; invpi = 1.0 / 3.14159265;

for (l in 1:n) { gi = - midpoint[l] + pow((pow(midpoint[l], gshape) exp(-k tau)) + Gconst (1.0 - exp(-k tau)), 1.0 / gshape); gitmp = posfun(gi, mininc, pen); gi = gitmp[1]; pred_sd = (gi gcv - gmin tau) (invpi atan(1e6 (gi gcv - gmin tau)) + 0.5) + gmin tau; sd_total = sqrt(square(pred_sd) / tau); growth_increment[1,l] = gi + midpoint[l]; growth_increment[2,l] = sd_total; } return growth_increment; }

matrix get_growth_matrix(int n, real tau, vector midpoint, vector gpars) { matrix[2,n] increment; // growth increment real gi; real sdi; real asum; real dsum; matrix[n,n] G;

increment = get_growth_increment(n, tau, midpoint, gpars); for (l in 1:n) { gi = increment[1,l]; sdi = increment[2,l]; asum = 0.0; for (ll in 1:(n-1)) { dsum = normal_cdf(midpoint[ll] + 1.0, gi, sdi); G[l,ll] = dsum - asum; asum = dsum; } G[l,n] = 1.0 - asum; } return G'; }