Print

Print


Hi,

I suggest to add the right loop the of the node "for(t in 2:(n-1)){"  
at the end of the line  alpha[t]<-exp(eta[t]).

try to
Quoting Bob O'Hara <[log in to unmask]>:

> On 01/08/16 11:41, Lecomte Jean-Baptiste wrote:
>> Hi,
>>
>> I think you have to give an initial value for every stochastic  
>> nodes. For example, you have to give initial values for epsilon,  
>> delta, gamma ....
>>
> No you don't: any stochastic node that doesn't have an initial value  
> given will have one generated from its prior.
>
> I can't even compile the code (multiple definitions of eta, because  
> it's indexed by t but in loops for both i and t), but I think the  
> problem is mu[1]. It isn't defined in the model, but still has to be  
> created by BUGS (because the indexing of mu starts at 2). In the  
> inits it is given a value, but BUGS doesn't know what the node is,  
> so can't give it a value. The solution is to either re-write the  
> model or replace the first .1 by NA (so BUGS doesn't try to give  
> mu[1] a value).
>
> Bob
>
>> Jean-Baptiste
>>
>> 2016-07-28 10:57 GMT+02:00 Abongo <[log in to unmask]  
>> <mailto:[log in to unmask]>>:
>>
>>    Hello, List!
>>    This message came up when I tried to load initial values. This
>>    seems to be an uncommon error since my search of Internet did not
>>    get any hits.  Any comments and suggests would be very much
>>    appreciated. Thank you!
>>
>>    model{
>>    c<-10000
>>    for(t in 2:(n-1)){
>>    zero[t]<-0
>>    zero[t]~dpois(mean.zero[t])
>>    mean.zero[t]<- -l[t]+c
>>     
>> l[t]<-0.5*(log(lambda.error)-log(2*22/7)-3*log(epsilon[t]))-0.5*lambda.error*pow((epsilon[t]-mu[t])/mu[t],2)/epsilon[t]
>>    }
>>    for(t in 2:(n-1)){
>>    y[t]~dpois(lambda[t])
>>    lambda[t]<-alpha[t]+lambda_1*y[t-1]+epsilon[t]
>>    alpha[t]<-exp(eta[t])
>>
>>    for(i in 1:s){
>>     
>> eta[t]<-alpha_1+beta*t+(gamma[i]*sin(omega[i]*t)+delta[i]*cos(omega[i]*t))
>>    omega[i]<-i*3.14/26
>>    }
>>    }
>>    for(t in 2:(n-1)){mu[t]~dnorm(0.0,0.001) epsilon[t]~dgamma(0.01,0.01)}
>>    for(i in 1:s){gamma[i]~dnorm(0.0,0.0001) delta[i]~dnorm(0.0,0.0001)}
>>    lambda.error~dgamma(0.01,0.01)
>>    dispersion.p<-1/lambda.error
>>    lambda_1~dgamma(0.01,0.001)
>>    alpha_1~dnorm(0.0,0.001)
>>    beta~dnorm(0.0,0.0001)
>>    }
>>    list(y=c(1,0,5,2,1,2,0,4,0,0,0,3,1,1,0,0,2,2,0,2,6,3,2,1,2),s=10,n=25)
>>     
>> list(mu=c(.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1,.1),lambda.error=1,lambda_1=1,alpha_1=1,beta=1)
>>
>>    -------------------------------------------------------------------
>>    This list is for discussion of modelling issues and the BUGS software.
>>    For help with crashes and error messages, first mail
>>    [log in to unmask] <mailto:[log in to unmask]>
>>    To mail the BUGS list, mail to [log in to unmask]
>>    <mailto:[log in to unmask]>
>>    Before mailing, please check the archive at
>>    www.jiscmail.ac.uk/lists/bugs.html
>>    <http://www.jiscmail.ac.uk/lists/bugs.html>
>>    Please do not mail attachments to the list.
>>    To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
>>    <mailto:[log in to unmask]>
>>    If this fails, mail [log in to unmask]
>>    <mailto:[log in to unmask]>, NOT the whole list
>>
>>
>>
>>
>> -- 
>>
>> Dr. Jean-Baptiste Lecomte
>>
>> Postdoctoral Fellow, Groundfish Stock Assessment
>>
>> Pacific Biological Station
>>
>> Fisheries and Oceans Canada
>>
>> 3190 Hammond Bay Road
>>
>> Nanaimo, BC  V9T 6N7
>>
>> PH: 250-756-7134
>>
>> -------------------------------------------------------------------  
>> This list is for discussion of modelling issues and the BUGS  
>> software. For help with crashes and error messages, first mail  
>> [log in to unmask] <mailto:[log in to unmask]> To mail the  
>> BUGS list, mail to [log in to unmask] <mailto:[log in to unmask]>  
>> Before mailing, please check the archive at  
>> www.jiscmail.ac.uk/lists/bugs.html  
>> <http://www.jiscmail.ac.uk/lists/bugs.html> Please do not mail  
>> attachments to the list. To leave the BUGS list, send LEAVE BUGS to  
>> [log in to unmask] <mailto:[log in to unmask]> If this  
>> fails, mail [log in to unmask]  
>> <mailto:[log in to unmask]>, NOT the whole list
>
>
> -- 
>
> Bob O'Hara
>
> Biodiversity and Climate Research Centre
> Senckenberganlage 25
> D-60325 Frankfurt am Main,
> Germany
>
> Tel: +49 69 7542 1863
> Mobile: +49 1515 888 5440
> WWW:   http://www.bik-f.de/root/index.php?page_id=219
> Blog: http://blogs.nature.com/boboh
> Journal of Negative Results - EEB: www.jnr-eeb.org
>
>
> -------------------------------------------------------------------
> This list is for discussion of modelling issues and the BUGS software.
> For help with crashes and error messages, first mail [log in to unmask]
> To mail the BUGS list, mail to [log in to unmask]
> Before mailing, please check the archive at  
> www.jiscmail.ac.uk/lists/bugs.html
> Please do not mail attachments to the list.
> To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
> If this fails, mail [log in to unmask], NOT the whole list

-------------------------------------------------------------------
This list is for discussion of modelling issues and the BUGS software.
For help with crashes and error messages, first mail [log in to unmask]
To mail the BUGS list, mail to [log in to unmask]
Before mailing, please check the archive at www.jiscmail.ac.uk/lists/bugs.html
Please do not mail attachments to the list.
To leave the BUGS list, send LEAVE BUGS to [log in to unmask]
If this fails, mail [log in to unmask], NOT the whole list