[ADMB Users] "xxglobal.tmp" error with tpl2rem

Anders Nielsen anders at nielsensweb.org
Wed Aug 5 00:31:39 PDT 2009


Hi Ben, 

It is looking for initial values for the random effects also, so add 

# u
0 0 0 0 0 0

or whatever is relevant to your 'mccoypred3.pin' file, and try again. 

Cheers, 

Anders. 


On Wed, 2009-08-05 at 02:03 -0400, Bolker,Benjamin Michael wrote:
> Thanks to all of you for your most excellent help ...
> 
>   Sadly, I need some more.
> 
>   I implemented Dave's GLOBALS_SECTION below and added the missing semicolon.
>   Everything now compiles (with lots of warnings of the form 
> /usr/local/src/admb/include/admodel.h:2256: warning: extra qualification ‘param_init_bounded_matrix_vector::’ on member ‘allocate’ 
> but compiles nonetheless).
> 
>    Now when I run it the result is ... (drum roll) ...
> 
> error reading parameters from file ./mccoypred3.pin
> 
>   I have traced the error through the C++ code to the point where
> it tries to allocate the random effects vector -- here's a code snippet
> 
>   h.allocate(0.0,1.0,1,"h");
>   g.allocate("g");
>   sigma_c.allocate(0.00001,1.0,1,"sigma_c");
>   cout << "before u.allocate\n";   // BMB added
>   u.allocate(1,nblock,"u");
>   cout << "after u.allocate\n";    // BMB added
> 
>   I have also confirmed that this is where it runs into trouble using gdb,
> although I can't seem to step into the "u.allocate" line to see what's going
> on within ...  nblock seems to be read OK (it is used earlier to define the
> bounds of the random effects design matrix Z)
> 
>   mccoypred3.pin looks like this:
> 
> -----------------
> # "mccoypred3.pin" produced by pin_write() from ADMButils; Wed Aug  5 01:13:15 2009
> # c 
>  0.506685 
> 
> # d 
>  4.08488 
> 
> # h 
>  0.008644705 
> 
> # g 
>  3.019749 
> 
> # sigma_c 
>  0.1 
> --------------------
> 
> mccoypred3.dat: 
> 
> # "mccoypred3.dat" produced by dat_write() from ADMButils; Wed Aug  5 01:55:40 2009
> # nobs 
>  10 
> 
> # nblock 
>  6 
> 
> # killed 
>  3 0 1 3 1 0 1 2 2 2 
> 
> # size 
>  8.830333 9.155 7.991667 8.000833 8.140333 8.711167 16.5265 14.1508 18.8445 14.87525 
> 
> # initial 
>  6 6 6 6 6 6 6 6 6 6 
> 
> # Z 
> 1 0 0 0 0 0
> 0 1 0 0 0 0
> 0 0 1 0 0 0
> 0 0 0 1 0 0
> 0 0 0 0 1 0
> 0 0 0 0 0 1
> 1 0 0 0 0 0
> 0 1 0 0 0 0
> 0 0 1 0 0 0
> 0 0 0 1 0 0
> 
>   The parameter section of the tpl file is:
> 
> PARAMETER_SECTION
> 
>   init_number c
>   init_number d
>   init_bounded_number h(0.0,1.0,1) 
>   init_number g
>   init_bounded_number sigma_c(0.00001,1.0,1)
>   random_effects_vector u(1,nblock)
>   vector prob(1,nobs)
>   vector cvec(1,nobs)
>   objective_function_value f
> 
>  
>   I have tried the random_effects_vector line both as it appears above and as
> 
>   random_effects_vector u(1,nblock,1)
> 
> to indicate activation in phase 1  and 
> 
>   random_effects_vector u(1,nblock,2)
> 
> to indicate activation in phase 2 ...
> 
>    More suggestions?    Probably something else boneheaded here.
>   As always, suggestions for diagnosis/further information/pointers to relevant locations
> in TFM will be appreciated.
> 
>   I have attached a mini-version of the dat file plus tpl, pin file -- but don't know
> if the attachments will make it through to the list or not.
> 
>   (I feel like I'm burning all the karma accumulated on the R-help list ...)
> 
>   cheers
>     Ben Bolker
> 
> 
> ________________________________________
> From: users-bounces at admb-project.org [users-bounces at admb-project.org] On Behalf Of dave fournier [otter at otter-rsch.com]
> Sent: Tuesday, August 04, 2009 4:35 PM
> To: users at admb-project.org
> Subject: Re: [ADMB Users] "xxglobal.tmp" error with tpl2rem
> 
> >This line is causing problems in your other model (mccoypred3.tpl);
> 
> >prob = 1/(1/(elem_prod(cvec,elem_prod(pow(size/d,g),exp(-size/d))))
> >+h*initial);
> 
> >specifically, it does not like "pow(size/d,g)" because there does not
> >appear to be a function that takes the arguments:
> >'bolker2.cpp:123: error: no matching function for call to
> >‘pow(data_vector&, df1b2_init_number&)’
> 
> >You might want to re-write this function in log-space to get it to
> >work properly.
> 
> It is difficult to diagnose these missing function problems if you are
> not familiar with the package. A lot of the admb functions were not
> extended (yet?) to the RE package. anyway what is missing is the function
> 
>   df1b2vector pow(const df1b2vector& v,const df1b2variable & x)
> 
> Probably the most elegant work around is to define your own
> and put it in the GLOBALS_SECTION to make it available.
> 
> stick this at the bottom of the tpl file.
> 
> 
> GLOBALS_SECTION
> 
>   #include <admodel.h>
>   #include <df1b2fun.h>
>   #include <adrndeff.h>
> 
>   df1b2vector pow(const df1b2vector& v,const df1b2variable & x)
>   {
>     int mmin=v.indexmin();
>     int mmax=v.indexmax();
>     df1b2vector tmp(mmin,mmax);
>     for (int i=mmin;i<=mmax;i++)
>     {
>       tmp(i)=pow(v(i),x);
>     }
>     return tmp;
>   }
> 
> Also in the version of the program I saw you are missing a ";"
> in the line above.
> 
> --
> David A. Fournier
> P.O. Box 2040,
> Sidney, B.C. V8l 3S3
> Canada
> Phone/FAX 250-655-3364
> http://otter-rsch.com
> _______________________________________________
> 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