For a genetic mixed stock analysis:
pall is a ragged array with one row per locus, each with 2*nalleles
[l] values. The first nalleles[l] values are allele frequencies for the
first stock; the next set for the second stock.
Given that S[i] is a dynamic value identifying stock, either 1 or
2, how do I use that to read the appropriate set of allele frequencies in
the line g[r,l] ~ dcat( pall[ ... ] ) ?
There are similar questions in the archives, but not a clear answer. Would
someone set me straight? I'm missing something basic.
for (i in 1:n) {
# Stock assignment to individuals
S[i] ~ dcat(P[1:2])
}
for (r in 1:2*n) {
for (l in 1:nloci) {
# genotypes over pairs of lines, thus ind[r] identifies individual
# ind=c(1,1,2,2,3,3, ...,n,n)
start[r,l] <- (S[ind[r]]-1)*nalleles[l]+1
end[r,l] <- S[ind[r]]*nalleles[l]
# start and end are appropriate integers, dynamically
chosen by S[i], but ...
g[r,l] ~ dcat( pall[ l, start[r,l]:end[r,l] ] ) # why
doesn't this work?
# "variable not defined" ??????
}
}
Thanks, Charles
-------------------------------------------------------------------
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
|