Difference between revisions of "POPs in Baltic herring"
From Testiwiki
(corrections to the model) |
(→Answer: updated for congener loop, needs still work) |
||
Line 9: | Line 9: | ||
POP concentrations in Baltic sea fish have been measured from samples collected in EU-kalat project. | POP concentrations in Baltic sea fish have been measured from samples collected in EU-kalat project. | ||
− | |||
− | |||
<rcode graphics=1> | <rcode graphics=1> | ||
Line 18: | Line 16: | ||
dat <- opbase.data("Op_en3104", subset = "POPs") | dat <- opbase.data("Op_en3104", subset = "POPs") | ||
− | |||
dat <- dat[dat$Fish_species == "Baltic herring" , ] | dat <- dat[dat$Fish_species == "Baltic herring" , ] | ||
+ | congeners = levels(dat$POP) | ||
+ | Y = length(congeners) | ||
− | # | + | for (j in 1 : 3 ) { #only three rounds for testing |
+ | compdat <- dat[dat$POP == congeners[j] , ] | ||
+ | mo <- textConnection("model{ | ||
+ | for( i in 1 : N ) { | ||
+ | Compound[i] ~ dnorm(muOfLogCompound, tau2[i]) | ||
+ | tau2[i] <- tau1*sqrt(n[i]) | ||
+ | } | ||
+ | tau1 ~ dunif(0.001, 1000) | ||
+ | muOfLogCompound ~ dnorm(0, 0.001) | ||
+ | } | ||
+ | ") | ||
− | + | LogCompound <- log(compdat$result+1) #+1 because of negative log values | |
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
− | |||
dataList = list( | dataList = list( | ||
− | + | Compound = LogCompound, | |
− | + | N = length(LogCompound), | |
− | + | n = compdat$N_individuals | |
− | |||
) | ) | ||
Line 52: | Line 44: | ||
update(jags, 1000) | update(jags, 1000) | ||
− | out <- coda.samples(jags, c(' | + | out <- coda.samples(jags, c('tau1', 'muOfLogCompound'), 500) # Stores a posterior sample |
plot(out) | plot(out) | ||
+ | filename <- paste("out", j, sep="") | ||
+ | assign(filename, out) | ||
+ | |||
+ | } | ||
ggplot(dat, aes(x = Result, colour = Catch_location))+geom_density()+scale_x_log10() | ggplot(dat, aes(x = Result, colour = Catch_location))+geom_density()+scale_x_log10() |
Revision as of 10:01, 8 March 2016
This page is a variable.
The page identifier is Op_en2583 |
---|
Moderator:Nobody (see all) Click here to sign up. |
Give your opinion to the peer rating of the content of this page. |
Upload data
|
Contents
Question
What are the concentrations of persistent organic pollutants (POPs) in Baltic sea fish.
Answer
POP concentrations in Baltic sea fish have been measured from samples collected in EU-kalat project.
Rationale
See also
References