<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40"><head><meta http-equiv=Content-Type content="text/html; charset=us-ascii"><meta name=Generator content="Microsoft Word 14 (filtered medium)"><style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Tahoma;
panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
mso-margin-top-alt:auto;
margin-right:0in;
mso-margin-bottom-alt:auto;
margin-left:0in;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
span.EmailStyle18
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]--></head><body lang=EN-US link=blue vlink=purple><div class=WordSection1><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>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. <o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Then at the top of the PARAMETER_SECTION<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> if(readparfile>=1)<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-seri
f";color
sp; {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> cout<<" read parm file"<<endl;<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> ad_comm::change_pinfile_name("<your filename>.par");<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>Then in the PRELIMINARY_CALCS_SECTION<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> i
f(readpa
n></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> {<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> Code here sets the parameter values equal to the input from the data file<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'> }<o:p></o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'>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.<o:p></o:p></span></p><p class=MsoNo
rmal><sp
t;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1F497D'><o:p> </o:p></span></p><div><div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0in 0in 0in'><p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'> users-bounces@admb-project.org [mailto:users-bounces@admb-project.org] <b>On Behalf Of </b>James R. Bence<br><b>Sent:</b> Sunday, August 07, 2011 11:07 AM<br><b>To:</b> users@admb-project.org<br><b>Subject:</b> Re: [ADMB Users] PIN file<o:p></o:p></span></p></div></div><p class=MsoNormal><o:p> </o:p></p><p class=MsoNormal>Saang-Yoon<br><br>Adding a bit to what Dave said,<br><br>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 param
eter and
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.<br><br>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:<br><br>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.<br>2. Build your program to create an executable and run it with the following argument -maxfn 0
This fo
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). <br>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.<br><br>Note that most of this is described in the video "starting values" we recently released accessible from a link on the admb-project site.<br><br>Cheers,<br><br>Jim<br><br>At 10:18 PM 8/6/2011, Saang-Yoon wrote:<br><br><o:p></o:p></p><p class=MsoNormal>Hi.<br>I recently learn the usage of PIN file for initialization of parameter<br>values.<br>When putting initial values for a *vector* using a PIN file, should I<br>assign all values to *each elements* in the vector? Before using a<br>PIN file, I used to put only one value even to a vec
tor dime
ECTION in a TPL file, and it worked well. However<br>when I assign only one value to a vector in a PIN file, I run into the<br>following error message:<br> error reading parameters from file xxx.pin<br><br>I suspect whether the error was due to the assignment of only one<br>value to a vector. I would appreciate your response. Thank you.<br>Saang-Yoon<br>_______________________________________________<br>Users mailing list<br><a href="mailto:Users@admb-project.org">Users@admb-project.org</a><br><a href="http://lists.admb-project.org/mailman/listinfo/users">http://lists.admb-project.org/mailman/listinfo/users</a> <o:p></o:p></p><p>Jim Bence<br>Dept. of Fisheries and Wildlife <br>Michigan State University<br><a href="http://www.msu.edu/user/bence/">http://www.msu.edu/user/bence/</a><o:p></o:p></p></div></body></html>