Dear "List",
I have data on the number of observations in a 4x2x6 table with four strata
(nihss score), two treatments and six categories.
I am using data on the total number of observations in each category to
estimate the probability of being in each strata from which I generate
new 'trials' of the number of obervations in each strata with new sample
sizes.
I estimate the probability of being in each cell of the 4x2x6 table and
sample new 'trials' conditional on the sampled number of observations in
each strata.
Hopefully the following code will illuminate my description.
I don't think there is anything wrong with my logic but, when I compile the
program, WinBUGS tells me that the "order of multinomial mrs.new[1,1,1]
must be a constant". Does this mean that I cannot have sampled values as
my sample size in the multinomial distribution?
model{
# This part sets up the model for the data.
# A multinomial model is fitted to the data for each treatment to generate
the probabilities of a patient being classified with particular mRS and
NIHSS scores.
# To 'specify' the model it is necessary to 'check' the model, load the raw
data and provide a # new sample size for future trials.
# There are four strata corresponding to the four levels of the covariate
NIHSS.
# There are two treatments, Active: 1 and Placebo: 0.
# There are six ordered categories.
nihss[1:4] ~ dmulti(pnihss[1:4], nnihss)
pnihss[1:4] ~ ddirch(priornihss[])
for (j in 1:2){
for (s in 1:4){
mrs[j, s, 1:6] ~ dmulti(pmrs[j, s, ], n[j, s])
pmrs[j, s, 1:6] ~ ddirch(priormrs[j, s, ])
}
}
for( j in 1:2){
nihss.new[j, 1:4] ~ dmulti(pnihss[1:4], NN[
j ])
}
for (j in 1:2){
for (s in 1:4){
mrs.new[j, s, 1:6] ~ dmulti(pmrs[j, s, ], nihss.new[j, s])
}
}
}
# Data
list(nihss=c(620, 499, 381, 198),
nnihss=1698,
priornihss=c(1,1,1,1),
mrs=structure(.Data=c(66,108,42,37,36,22,
20,41,40,39,60,52,
7,21,12,21,54,74,
0,0,5,11,25,56,
83,94,47,31,31,23,
35,42,32,43,34,61,
10,11,13,35,61,62,
3,6,5,12,17,58), .Dim=c(2,
4, 6)),
priormrs=structure(.Data=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,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1), .Dim=c(2, 4, 6)),
n=structure(.Data=c(311, 252,
189, 97,
309, 247,
192, 101), .Dim=c(2,4)))
# New sample sizes
list(NN=c(50, 50)
list(NN=c(100, 100)
list(NN=c(150, 150)
list(NN=c(200, 200))
list(NN=c(4200, 4200)
# Initial values
-------------------------------------------------------------------
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
|