[ADMB Users] conditional statement using parameter to be estimated
Ben Bolker
bbolker at gmail.com
Fri May 23 14:35:58 PDT 2014
Someone will probably give you a more precise answer, but I believe
the basic problem here is that ADMB is designed to estimate models with
continuously varying likelihood surfaces (i.e., not including
changepoint models). One sensible way to relax this restriction is to
fit a model with a steep logistic (1+exp(-b*(x-c)))^{-1} curve (i.e.
large b, c is the adjustable parameter) or Hill function.
On 14-05-23 05:29 PM, Tiffany Vidal 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