<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#FFFFFF">
<div class="moz-cite-prefix">On 12-11-11 08:06 AM, Jeff Laake wrote:<br>
<br>
These files contain all the chnages one would need. the changes
to the htp file should be done<br>
by tpl2rem I created a new file which should be put in
df1b2-separable wiht the romb and trapz stuff.<br>
Once these changes are include into admb the romberg stuff should
work.<br>
<br>
<br>
</div>
<blockquote
cite="mid:CAAyWzSXfgpPL11Oc8j=6sUrp7v0D+s2aSEsPE7m4qV6XNuCRHw@mail.gmail.com"
type="cite">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.
<div>
<br>
</div>
<div>regards --jeff</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Sat, Nov 10, 2012 at 9:21 AM, dave
fournier <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:davef@otter-rsch.com" target="_blank">davef@otter-rsch.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">
<div text="#000000" bgcolor="#FFFFFF"> <br>
<div><br>
<br>
-------- Original Message --------
<table cellpadding="0" cellspacing="0" border="0">
<tbody>
<tr>
<th align="RIGHT" valign="BASELINE"
nowrap="nowrap">Subject: </th>
<td>Re: [ADMB Users] Random effects model with
integration in the likelihood</td>
</tr>
<tr>
<th align="RIGHT" valign="BASELINE"
nowrap="nowrap">Date: </th>
<td>Sat, 10 Nov 2012 09:17:59 -0800</td>
</tr>
<tr>
<th align="RIGHT" valign="BASELINE"
nowrap="nowrap">From: </th>
<td>dave fournier <a moz-do-not-send="true"
href="mailto:davef@otter-rsch.com"
target="_blank"><davef@otter-rsch.com></a></td>
</tr>
<tr>
<th align="RIGHT" valign="BASELINE"
nowrap="nowrap">To: </th>
<td><a moz-do-not-send="true"
href="mailto:users@admb-project.org"
target="_blank">users@admb-project.org</a></td>
</tr>
</tbody>
</table>
<br>
<br>
<pre>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.
</pre>
<br>
<br>
</div>
<br>
</div>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
</body>
</html>