[ADMB Users] conditional statement using parameter to be estimated
bigA
jaguar.smart at gmail.com
Fri May 23 14:39:29 PDT 2014
Hum... is yrKey(n) an integer and cp something else? I think the
problem has something to do with that.
I am not sure the best way to solve your problem, but it appears that
the < operator doesn't work with the data types you are using.
Best luck!
Aaron
On Fri, May 23, 2014 at 2:29 PM, Tiffany Vidal <tiffany.vidal at gmail.com> wrote:
> 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
>
> _______________________________________________
> Users mailing list
> Users at admb-project.org
> http://lists.admb-project.org/mailman/listinfo/users
>
More information about the Users
mailing list