[ADMB Users] spline smoother on selectivity (even shorter version)
Poos, Jan Jaap
janjaap.Poos at wur.nl
Wed Mar 2 07:59:58 PST 2011
Hi Steve Martell,
Although indeed the problem may be in the code, this part should work. There is no if else statement here. The second if statement is nested within the first else statement. This part is only evaluated if i >36.
Kind regards, Jan Jaap
-----Original Message-----
From: users-bounces at admb-project.org [mailto:users-bounces at admb-project.org] On Behalf Of Steve Martell
Sent: Wednesday, March 02, 2011 4:52 PM
To: Luis Ridao
Cc: users at admb-project.org
Subject: Re: [ADMB Users] spline smoother on selectivity (even shorter version)
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
_______________________________________________
Users mailing list
Users at admb-project.org
http://lists.admb-project.org/mailman/listinfo/users
More information about the Users
mailing list