That's 6000 lines of code! Use loops to shorten it and it will be easier to debug. For a start, the 56 lines following
# time variables
could be reduced to
for (zz in 1:56){
mu[i,zz]<-xi[i, zz]+alp[zz]
}
The next 550 lines can all be represented as
for (zz in 57:616){
yy[zz] <- 57+trunc((zz-57)/5)
mu[i,zz]<-xi[i,yy[zz]]*lam[zz] + alp[zz]
}
with some renumbering of your lam[] variable and lam[57] and every fifth value thereafter defined as 1 at an appropriate point
Continue in like vein and I guess you will have less than 100 lines of code, and the problem will be *much* easier to isolate.
Best wishes
Andrew
--
Dr. Andrew Millard [log in to unmask]
Durham University
Senior Lecturer in Archaeology Tel: +44 191 334 1147
Archaeology: http://www.dur.ac.uk/archaeology/
Personal webpage: http://community.dur.ac.uk/a.r.millard/
> -----Original Message-----
> From: (The BUGS software mailing list) [mailto:[log in to unmask]] On
> Behalf Of Nick Jacobson
> Sent: 12 September 2012 04:16
> To: [log in to unmask]
> Subject: [BUGS] Invalid Use of Range Construct
>
> Hi everyone,
>
> I'm trying to run the following model. I have tested a smaller version
> of the same model and did not run into any problems, but with the full
> model, I receive "invalid use of range construct in xi." I've been
> deleting sections of the code, but I can't figure out anything. I've
> also searched the web, but I wasn't able to figure anything out. Has
> anyone run into this before?�Can anyone tell me where the problem is?
> For troubleshooting purposes, I also tried the code in WinBUGS. It
> gave the NIL deference (read) error when compiling. Based on the
> combination of the errors, I believe that it is occurring due to some
> inappropriate transformation in xi, although I cannot find it.�
>
> Thanks!
> Nick
>
>
>
>
>
> --
>
> Nicholas C. Jacobson
> Doctoral Student in Clinical Psychology
> 378 Moore Building
> The Pennsylvania State University
> University Park, PA� 16802-3103
>
> Phone: 814-863-0115
> Email: [log in to unmask]
> Website:�nicholasjacobson.com
>
>
-------------------------------------------------------------------
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
|