All:
What I did to solve the random index problem that I emailed about
before, which at least 20 of you responded to (thank you), is exactly
what Finn Krogstad just typed to me below. That is, set the UPPER BOUND
for the maximum amount of space that you would need and then just use
the parts that you need. This is exactly what I did for my Poisson
example.
Thanks to all and I hope you find this useful.
Eric
***********************************************
Eric T. Bradlow
Associate Professor of Marketing and Statistics
Academic Director, Wharton Small Bus. Development Center
3730 Walnut Street, 761 JMHH
Philadelphia, PA 19104-6340
[log in to unmask]
(215) 898-8255 (Phone)
(215) 898-2534 (Fax)
*************************************************
-----Original Message-----
From: Finn Krogstad [mailto:[log in to unmask]]
Sent: Monday, June 30, 2003 2:07 PM
To: Bradlow, Eric
Subject: RE: having a random variable as an index
Yes and no.
Since bugs needs to allocate the memory in the compile step, n needs to
be fixed at that stage. That however does not mean that YOUR MODEL can
not have a random variable as an index. You just need to make sure that
you specify the upper limit for n in advance, and specify the parts of
the array that are in your model and those that exist just because the
size of the array has to be specified in advance.
You can dig into the email archives for how this is done. Or you can
send another message.
Finn Krogstad
University of Washington
College of Forest Resources, Box 352100
Seattle, WA 98195-2100
Phone: 206.543.1584
email: [log in to unmask]
web: students.washington.edu/fkrogsta
> -----Original Message-----
> From: (The BUGS software mailing list)
> [mailto:[log in to unmask]] On Behalf Of Bradlow, Eric
> Sent: Thursday, June 26, 2003 6:18 PM
> To:
> Subject: having a random variable as an index
>
>
> Hey all:
>
> Does anyone know if the following is possible in BUGS:
>
> for(i in 1:(n+1)){
>
> PUT IN SOME CODE HERE
>
> }
>
> n~dpois(lambda)
>
> That is, can the index of a loop be a random variable?
>
> Any help would be appreciated.
>
> Eric
>
>
>
> ***********************************************************
> Eric T. Bradlow
> Associate Professor of Marketing and Statistics
> Academic Director, Wharton Small Bus. Development Center
> The Wharton School of the University of Pennsylvania
> 3730 Walnut Street, 761 JMHH
> Philadelphia, PA 19104-6340
> [log in to unmask]
> 215-898-8255 (ph)
> 215-898-2534 (fax)
> **************************************************************
>
> -------------------------------------------------------------------
> 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
|