[ADMB Users] conditional statement using parameter to be estimated

Tiffany Vidal tiffany.vidal at gmail.com
Fri May 23 14:29:17 PDT 2014


Hello,

I'm just starting to use ADMB, and am interested in running a something
like a changepoint model. I am running into problems trying to use a
parameter, to be estimated, in a conditional statement. When estimating the
negative log likelihood I have code that looks like this:

 if(useNB==1){
    for(int n=1;n<=nobs;n++){

     *if(yrKey(n)<cp)*{
        mu_hat(n)=f0+*rS1*(siteKey(n))+(f1+rSs(siteKey(n)))*Cyear(n)+rY(yrKey(n));

        }
     else {
          mu_hat(n)=f0+*rS2*(siteKey(n))+(f1+rSs(siteKey(n)))*Cyear(n)+rY(yrKey(n));

      }
      NB_mu(n)=mfexp(mu_hat(n));

               nll +=
-log_negbinomial_density((catch(n)),(NB_mu(n)),(1+((NB_mu(n))/s)));
    }
  }


where cp is my changepoint parameter (intended to estimate a single year in
the series), bounded between 0 and max(year index), with an initial value
of 30 (max year index = 50). The point of this is to allow the random site
parameter to be estimated separately for the period before the changepoint
and after it.

The error that I receive is as follows:
error: no match for 'operator<' in
'((df1b2_parameters*)this)->df1b2_parameters::<anonymous>.df1b2_pre_parameters::<anonymous>.model_parameters::<anonymous>.model_data::yrKey.ivector::operator()(n)
< ((df1b2_parameters*)this)->df1b2_parameters::cp'

Is this possible to do in this program? Thank you in advance for any
thoughts on how to execute this.

Kindly,
Tiffany
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.admb-project.org/pipermail/users/attachments/20140523/ee998f33/attachment.html>


More information about the Users mailing list