a standard approach is as follows (liberties taken with data size).
Finn Krogstad
U. Washington, Forest Engineering
http://students.washington.edu/fkrogsta
model;{
for(i in 1:I){
for(j in 1:J){
for(k in 1:K){
for(l in 1:L){
log.Y[i,j,k,l] ~ dnorm(mu[i,j,k,l],tau)
mu[i,j,k,l]<-log(a0)+a1*log(A[i])+a2*log(S[j])+a3*log(V[k])+a4*log(B[l])
}
}
}
}
tau~dgamma(.001,.001)
a0~dnorm(0,.0001)
a1~dnorm(0,.0001)
a2~dnorm(0,.0001)
a3~dnorm(0,.0001)
a4~dnorm(0,.0001)
}
#data
list(I=2,J=2,K=2,L=2,
A=c(2,3),
S=c(1,7),
V=c(5,9),
B=c(.45,23),
log.Y = structure(.Data = c(
3,45,
23,45,
12,45,
44,321,
8,798,
34,23,
908,45,
234,23
),
.Dim = c(2,2,2,2)))
#inits
list(tau=1,a0=1,a1=1,a2=1,a3=1,a4=1)
On Thu, 18 Jan 2001, Carsten Hvingel wrote:
> Hi again,
>
> Apparently some people have had problems reading my previous e-mail, so
> therefore a re-send in text format:
>
> "If anyone would be so kind as to provide some guidance on how to code a
> general linear model of the type below and particularly on how to organise
> the data, you would make life much easier for a new BUGS-user.
>
> Log(Y[ijkl]=Log(u)+Log(A[i])+Log(S[j])+Log(V[k])+Log(B[l]+e[ijkl]
>
> Y comes as data. A has 4 levels, S has 10 levels, V has 25 levels and B has
> 22 levels and e is the error term. There are some empty cells in the
> matrix".
>
> Carsten Hvingel
>
> Greenland Inst. of Natural Resources
> c/o Norwegian Collage of Fishery Science
> Dept. of Marine and Freshwater Biology
> University of Tromsų
> Breivika, 9037 Tromsų, Norway
> Phone: +47 77646022
> Fax: +47 77646020
> E-mail: [log in to unmask]
>
> -------------------------------------------------------------------
> To mail the BUGS list, mail to [log in to unmask]
> You can search old messages at www.jiscmail.ac.uk/lists/bugs.html
> 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
>
-------------------------------------------------------------------
To mail the BUGS list, mail to [log in to unmask]
You can search old messages at www.jiscmail.ac.uk/lists/bugs.html
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
|