[ADMB Users] Random effects model with integration in the likelihood
dave fournier
davef at otter-rsch.com
Sun Nov 11 11:20:02 PST 2012
On 12-11-11 08:06 AM, Jeff Laake wrote:
These files contain all the chnages one would need. the changes to the
htp file should be done
by tpl2rem I created a new file which should be put in df1b2-separable
wiht the romb and trapz stuff.
Once these changes are include into admb the romberg stuff should work.
> Thanks for the thought and work on this. Do I use adhmodel.h that you
> modified for the admb project or do I make that change locally to my
> machine. What is s.htp? It has been a long time since I programmed
> with c and I'm still quite new with admb. I'm still in process of
> reading the manuals to understand more thoroughly. The re component of
> admb is really useful and I want to use it to expand the role of
> fitting models with random effects in distance sampling and
> capture-recapture data. I believe both could widen the influence and
> role of admb in ecological research.
>
> regards --jeff
>
>
> On Sat, Nov 10, 2012 at 9:21 AM, dave fournier <davef at otter-rsch.com
> <mailto:davef at otter-rsch.com>> wrote:
>
>
>
>
> -------- Original Message --------
> Subject: Re: [ADMB Users] Random effects model with integration
> in the likelihood
> Date: Sat, 10 Nov 2012 09:17:59 -0800
> From: dave fournier <davef at otter-rsch.com>
> <mailto:davef at otter-rsch.com>
> To: users at admb-project.org <mailto:users at admb-project.org>
>
>
>
> When I want to try and understand something like this I try and let
> the compiler do the work. So I run tpl2rem on your tpl (after
> getting rid of the sigma thing for now).
> An immediate problem is
>
> df1b2variable sigma=exp(beta+eps);
> mu=adromb(&model_parameters::fct,0,width,8);
> f -= -0.5*square(u);
>
> Need to change that to
> > mu=adromb(&df1b2_parameters::fct,0,width,8);
> That is a problem with the sed scripts in tpl2rem
>
> Now compile again and you get
> undefined reference to df1b2_pre_parameters::adromb(df1b2variable
> (df1b2_parameters::*)(df1b2variable const&), int, data_number&, int)
>
> So give it what it want. Put this in s.htp
>
> class df1b2_parameters;
>
> class df1b2_pre_parameters : public model_parameters
> {
> public:
> df1b2_pre_parameters(int sz,int argc, char * argv[]) :
> model_parameters(sz,argc,argv){;}
> re_objective_function_value f;
> void begin_df1b2_funnel(void);
> void setup_quadprior_calcs(void);
> void end_df1b2_funnel(void);
> void ll_j(const int j, const funnel_init_df1b2variable& beta,const
> funnel_init_df1b2variable& sigeps,const funnel_init_df1b2variable& u);
> df1b2variable df1b2_pre_parameters::adromb(df1b2variable
> (df1b2_parameters::*)(const df1b2variable&), int, data_number&, int);
> };
>
> Now it compiles and returns a link error for this function. So now we
> understand the hierarchy.
> So where is the difficulty? What we would like to do is to put this
> function in a base class, in this
> case function_minimizer. that is where the dvariable form lives. It
> almost works, but
> the problem is that function_minimizer does not know about
> df1b2variables so you can't return one
> because at that time it wont know what the size on the stack is.
>
> Anyway that is the idea. To fix this we can pass the df1b2variable as a
> reference to the function
> instead of returning it and make the function void. So in admodel.h I added
>
> #if defined(USE_LAPLACE)
> class df1b2variable;
> class init_df1b2vector;
> class df1b2vector;
> class df1b2_parameters;
> typedef df1b2variable (df1b2_parameters::*DFPMF) (const df1b2variable&);
> #endif
>
>
> class function_minimizer
> {
> // stuff ...
>
> #if defined(USE_LAPLACE)
> void adromb(DFPMF,double a,double b,const df1b2variable& _v,int ns=9);
> #endif
>
>
> This is all the information the compiler needs.
>
> We can put the code for the actual function in a place where it knows
> about df1b2variables.
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20121111/09561939/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: adromb_changes.zip
Type: application/zip
Size: 15977 bytes
Desc: not available
URL: <http://lists.admb-project.org/pipermail/users/attachments/20121111/09561939/attachment.zip>
More information about the Users
mailing list