Suppose A = A[1], A[2], ..., A[k] is a factor, and one wants to fix
certain levels (such as A[1] = 0, for identifiability), while letting
other values be stochastic.
How can one do that in BUGS?
I've tried the following:
###############################
A[1] <- 0
for( i in 2 : k ) {
A[k] ~ dnorm( 0.0,1.0E-6)
}
###############################
This compiles fine, but if I put A=c(0,0,0,...,0) in initial values, I
get a non-stochastic mode error, while if I leave it A out of the
initial values, the program hangs when I attempt to generate initial
values.
I've been getting around the problem by making A[1] stochastic, with
tiny variance, as
###############################
A[1] ~ dnorm( 0.0, 1.0E6 )
for( i in 2 : k ) {
A[k] ~ dnorm( 0.0,1.0E-6)
}
###############################
This is not elegant, but it works, though at the cost of unnecessary
sampling. Is a better solution available?
Bill Link
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
|