[ADMB Users] spline
Luis Ridao
luridao at gmail.com
Mon Mar 14 04:32:06 PDT 2011
ADMB-help,
Following suggestions proposed to my initial request I have modified the code:
DATA_SECTION
....
init_vector LO(1,nNodes)// SPLINES
init_vector HI(1,nNodes)
init_ivector PH(1,nNodes)
init_vector parm(1,2)
PARAMETER_SECTION
.....
init_bounded_number_vector log_sel1(1,nNodes,LO,HI,PH)
// SPLINES
init_bounded_number_vector log_sel2(1,nNodes,LO,HI,PH)
// SPLINES
init_bounded_number_vector log_sel3(1,nNodes,LO,HI,PH)
// SPLINES
vector predSel1(1,nages) // SPLINES
vector predSel2(1,nages) // SPLINES
vector predSel3(1,nages) // SPLINES
PROCEDURE_SECTION
......
for (i=1;i<=nyrs;i++)
{
if (i<=16)
{
vcubic_spline_function qs(nodes,log_sel1,parm(1),parm(2)); // SPLINES
predSel1.sub(1,9)=qs(ages.sub(1,9));
predSel1(10)=0;
predSel1(11)=0;
predSel1(12)=0;
}
else
{
if (i<=35)
{
vcubic_spline_function qs(nodes,log_sel2,parm(1),parm(2)); // SPLINES
predSel2.sub(1,9)=qs(ages.sub(1,9));
predSel2(10)=0;
predSel2(11)=0;
predSel2(12)=0;
......
......
And the .dat file looks like:
....
.....
# selection Nodes
6
# node info
-15 -15 -15 -15 -15 -15 # lower bound
15 15 15 15 15 15 # upper bound
2 2 2 2 2 2 # phase
# derivative at first and last nodes
0 0
I have run the model with different knots and it works when they are
set to 4, 5, 6, 8 or 9
BUT not for 7 ("Hessian does not appear to be positive definite")
I'm happy with 6 knots (the AIC is lowest for this value)
but I was just wondering why this issue keeps coming up.
The code is attached,
best,
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sai09_spline_mod.dat
Type: application/x-ns-proxy-autoconfig
Size: 20467 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110314/33aee25a/attachment.dat>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: sai09_spline_mod.tpl
Type: application/octet-stream
Size: 14719 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110314/33aee25a/attachment.obj>
More information about the Users
mailing list