[ADMB Users] Random effects model with integration in the likelihood
davef at otter-rsch.com
Sat Nov 10 09:17:59 PST 2012
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
f -= -0.5*square(u);
Need to change that to
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_pre_parameters : public model_parameters
df1b2_pre_parameters(int sz,int argc, char * argv) :
void ll_j(const int j, const funnel_init_df1b2variable& beta,const
funnel_init_df1b2variable& sigeps,const funnel_init_df1b2variable& u);
(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
typedef df1b2variable (df1b2_parameters::*DFPMF) (const df1b2variable&);
// stuff ...
void adromb(DFPMF,double a,double b,const df1b2variable& _v,int ns=9);
This is all the information the compiler needs.
We can put the code for the actual function in a place where it knows
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 3433 bytes
Desc: not available
More information about the Users