[ADMB Users] PIN file

Richard Methot Richard.Methot at noaa.gov
Mon Aug 8 13:55:21 PDT 2011


Adding a bit more, I do not use a PIN file.  Instead, my set of data files
contains definitions of the parameters and user-input initial values for
these parameters and a value (0/1) for the "readparfile" flag.  

 

Then at the top of the PARAMETER_SECTION

    if(readparfile>=1)

    {

    cout<<" read parm file"<<endl;

    ad_comm::change_pinfile_name("<your filename>.par");

     }

 

Then in the PRELIMINARY_CALCS_SECTION

      if(readparfile==0)

    {

    Code here sets the parameter values equal to the input from the data
file

     }

 

So each model run produces a "par" file.  Then by changing the readparfile
flag, I can easily let subsequent model runs start from either the existing
par file or from the initial values in the data file.

 

 

From: users-bounces at admb-project.org [mailto:users-bounces at admb-project.org]
On Behalf Of James R. Bence
Sent: Sunday, August 07, 2011 11:07 AM
To: users at admb-project.org
Subject: Re: [ADMB Users] PIN file

 

Saang-Yoon

Adding a bit to what Dave said,

admb reads pin files just like it reads dat files, i.e., one number after
another.  It assumes the there will be a number for each parameter and
assumes they will be in the same order as they are in the parameter section.
Just like in a dat file, a line starting with # is a comment.  Note this
structure is identical to the structure of the .PAR file containing the
estimates after you run your program.

If a .PIN file exists, starting values you set there we take precedence over
any specifications you make in the INITIALIZATION_SECTION.  If you have lots
of vectors that you would just as soon set all the values and/or you have a
large model with lots of parameters it can be tedious typing everything in
and tricky to make sure you did.  A couple of tricks to make this easier:

1.  Before you create a .PIN file, go ahead and set any vectors of
parameters to a single value in the INITIALIZATION_SECTION if that is what
you would do in the .PIN file.
2.  Build your program to create an executable and run it with the following
argument    -maxfn 0        This forces your program to quit before it even
passes through your procedure section. Obviously you don't get valid
estimates at this point but you do create a .PAR file with all the
parameters listed with there default starting values (and any you set in the
INITIALIZATION_SECTION). 
3.  Rename the resulting .PAR file as a .PIN.  It has the right structure.
Edit any values to be more to your liking.  Now you are ready to go.

Note that most of this is described in the video "starting values" we
recently released accessible from a link on the admb-project site.

Cheers,

Jim

At 10:18 PM 8/6/2011, Saang-Yoon wrote:



Hi.
I recently learn the usage of PIN file for initialization of parameter
values.
When putting initial values for a *vector* using a PIN file, should I
assign all values to *each elements* in the vector?   Before using a
PIN file, I used to put only one value even to a vector dimension
INITIALIZATION_SECTION in a TPL file, and it worked well.   However
when I assign only one value to a vector in a PIN file, I run into the
following error message:
   error reading parameters from file xxx.pin

I suspect whether the error was due to the assignment of only one
value to a vector.   I would appreciate your response.  Thank you.
Saang-Yoon
_______________________________________________
Users mailing list
Users at admb-project.org
http://lists.admb-project.org/mailman/listinfo/users 

Jim Bence
Dept. of Fisheries and Wildlife 
Michigan State University
http://www.msu.edu/user/bence/

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20110808/2aed3893/attachment.html>


More information about the Users mailing list