Going from std to abj model

From DEBwiki
Jump to: navigation, search
AmP estimation
Concepts

Data and completeness
Parameter estimation
Goodness-of-fit: SMSE / MRE
AmP Literature

Practice - essentials

Starting an estimation for a new species
Setting initial parameter values
Setting weight coefficients
Computing implied properties
Submitting to the collection

Practice - extra modules
Code specification
User-defined files: run, mydata, pars_init, predict
Data: Zero-variate, Univariate, Pseudo-data

Typified models
Estimation options

To implement an abj model from the std my_pet template, you need to modify three files: mydata_my_pet, pars_init_my_pet and predict_my_pet

mydata_my_pet

If known, add

  Lw_j
  a_j 
  Wwj 

pars_init_my_pet

model type

Replace (around l.30)

  metaPar.model = 'std'; 

by

  metaPar.model = 'abj';

Maturity threshold at metamorphosis

Add (around l. 53)

  par.E_Hj  = 1; free.E_Hj = 1; units.E_Hj = 'J'; label.E_Hj  = 'maturity at metamorphosis';

predict_my_pet

Customized filters

If you have more than one f value, you should test if this f and the parameter set will allow the individual to reach puberty.

Replace

  if k * v_Hp >= f_tL ^3% constraint required for reaching puberty with f_tL
    info = 0;
    prdData = {};
    return
  end

by

  pars_tj = [g; k; l_T; v_Hb; v_Hj; v_Hp];
  [t_j, t_p, t_b, l_j, l_p, l_b, l_i, rho_j, rho_B, info] = get_tj(pars_tj, f_tL);
  if info ~= 1 % numerical procedure failed
    fprintf('warning: invalid parameter value combination for get_tj \n')
  end
  s_M = l_j / l_b;
  if k * v_Hp >= f_tL ^3 * s_M^3 % constraint required for reaching puberty with f_tL
    info = 0;
    prdData = {};
    return
  end


Zero-variate Data

Replace (around l. 115)

 pars_tp = [g k l_T v_Hb v_Hp];
 [t_p, t_b ,l_p, l_b, info] = get_tp(pars_tp, f);

by

 pars_tj = [g; k; l_T; v_Hb; v_Hj; v_Hp];
 [t_j, t_p, t_b, l_j, l_p, l_b, l_i, rho_j, rho_B, info] = get_tj(pars_tj, f);
 if info ~= 1 % numerical procedure failed
   fprintf('warning: invalid parameter value combination for get_tj \n')
 end

Add

 TC_aj = tempcorr(temp.aj, T_ref, T_A);

Add

 % metamorphosis
 L_j = L_m * l_j;      % cm, structural length at metam
 Lw_j = L_j/ del_M;    % cm, physical length at metam at f
 Ww_j = L_j^3 * (1 + f * w);  % g, wet weight at metam
 aT_j = t_j / k_M/ TC_aj;   % d, time since birth at metam

Remove

 l_i = f - l_T;        % -, scaled ultimate length at f


Replace

 pars_R = [kap; kap_R; g; k_J; k_M; L_T; v; U_Hb; U_Hp]; 
 RT_i = TC_Ri * reprod_rate(L_i, f, pars_R);% #/d, max reprod rate

by

 pars_R = [kap, kap_R, g, k_J, k_M, L_T, v, U_Hb, U_Hj, U_Hp];
 [R_i, UE0, Lb, Lj, Lp, info]  =  reprod_rate_j(L_i, f, pars_R);
 RT_i = TC_Ri * R_i;% #/d, max reprod rate

Add (around l. 160)

 prdData.aj = aT_j;
 prdData.Lj  = Lw_j;
 prdData.Wwj = Ww_j;

Univariate data

Here is an example of a tL dataset starting at birth (i.e. a_b ≠ 0 but t_b = 0) in constant food and constant temperature. For an abj model, you need:

 f = f_tL; 
 [t_j, t_p, t_b, l_j, l_p, l_b, l_i, rho_j, rho_B, info] = get_tj(pars_tj, f);
 rT_B = TC_tL * rho_B * k_M;  % 1/d, von Bert growth rate   
 rT_j = TC_tL * rho_j * k_M;  % 1/d, exponential growth rate
 aT_b = t_b/ k_M/ TC_tL; aT_j = t_j/ k_M/ TC_tL;   
 t_j = aT_j - aT_b; % time since birth at metamorphosis
 t_bj = tL(tL(:,1) < t_j,1); % select times between birth & metamorphosis   
 Lw_b = l_b * L_m/ del_M; 
 Lw_j = l_j * L_m/ del_M; 
 Lw_i = l_i * L_m/ del_M;
 EL_bj = Lw_b * exp(t_bj * rT_j/3); % exponential growth as V1-morph
 t_ji = tL(tL(:,1) >= t_j,1); % selects times after metamorphosis
 EL_ji = Lw_i - (Lw_i - Lw_j) * exp( - rT_B * (t_ji - t_j)); % cm, expected length at time
 ELw = [EL_bj; EL_ji]; % catenate lengths