[ADMB Users] spline smoother on selectivity (even shorter version)

Steve Martell s.martell at fisheries.ubc.ca
Wed Mar 2 07:51:46 PST 2011


I suspect this part of the code is causing some of the problems.

for(i=1;i<=nyrs;i++)
  {
  if (i<=36)
  {
  F(i)=mfexp(log_fy(i))*mfexp(predSel1);  
  }
  else
  {
  if (i<=44)
  F(i)=mfexp(log_fy(i))*mfexp(predSel2);  
  else
  {
  F(i)=mfexp(log_fy(i))*mfexp(predSel3);  
  }
  }
  }

If i is less than or equal to 36, then both conditions are true in your if else statements so preSel1 is never actually used.
On 2011-03-01, at 4:57 AM, Luis Ridao wrote:

> ADMB-help,
> 
> Following Dave's suggestion on implementing a spline smoother
> on selectivity (in a separable catch-at-age model) I managed to 
> do something like:
> 
> PARAMETER_SECTION
>   init_vector log_sel1(1,nNodes)        // nNodes = 5 -> (1,2,3,4,5)     nages = 12 -> (1,2,3,4,5,6,7,8,9,10,11,12)
>   sdreport_vector predSel1(1,nages) 
>   
> for (i=1;i<=nyrs;i++)
>   { 
>   if (i<=36)
>   { 
>     vcubic_spline_function qs(nodes,log_sel1);   // SPLINES
>     predSel1=qs(ages);
>      }
>   else
>  .................................    
> for(i=1;i<=nyrs;i++)
>   {
>   if (i<=36)
>   {
>   F(i)=mfexp(log_fy(i))*mfexp(predSel1);  
>   }
>   else
>   .................................
> The program compiles and runs without problems but when the number of "nodes"
> are changed to another amount (e.g. 6) ADMB complains about Hessian:
> 
> "Warning -- Hessian does not appear to be positive definite
> Hessian does not appear to be positive definite"
> 
> The model template and data files  are attached
> 
> Thanks in advance
> 
> 
> 
> <sai09_spline.tpl><sai09_spline.dat>_______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users




More information about the Users mailing list