Difference between revisions of "POPs in Baltic herring"

From Testiwiki
Jump to: navigation, search
m (Answer)
(corrections to the model)
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.
 +
 +
[http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=3f19VvkjoNHloJCn Model run 11.2.2016]
  
 
<rcode graphics=1>
 
<rcode graphics=1>
Line 22: Line 24:
  
 
mo <- textConnection("model{
 
mo <- textConnection("model{
                    for( i in 1 : N ) {
+
                    for( i in 1 : N ) {
                     TCDD[i] ~ dlnorm(muOfLogTCDD, 1/sigmaOfLogTCDD^2 )
+
                     TCDD[i] ~ dlnorm(muOfLogTCDD, tau)#1/sigmaOfLogTCDD^2 )
                    }                   
+
                    }                   
                    sigmaOfLogTCDD ~ dunif( 0.001*sdOfLogTCDD , 1000*sdOfLogTCDD )
+
                      tau ~ dunif(0.001, 1000)
                     muOfLogTCDD ~ dnorm(meanOfLogTCDD , (0.001*(1/sdOfLogTCDD^2)))
+
                      #sigmaOfLogTCDD ~ dunif( 0.001, 1000 ) #*sdOfLogTCDD , 1000*sdOfLogTCDD )
                     muOfTCDD <- (exp(muOfLogTCDD +sigmaOfLogTCDD^2/2))
+
                     muOfLogTCDD ~ dnorm(0, 0.001) # dnorm(meanOfLogTCDD , (0.001*(1/sdOfLogTCDD^2)))
                     modeOfTCDD <- (exp(muOfLogTCDD-sigmaOfLogTCDD^2))
+
                     #muOfTCDD <- (exp(muOfLogTCDD +sigmaOfLogTCDD^2/2))
                     sigmaOfTCDD <- (sqrt(exp(2*muOfLogTCDD+sigmaOfLogTCDD^2)*(exp(sigmaOfLogTCDD^2)-1)))
+
                     #modeOfTCDD <- (exp(muOfLogTCDD-sigmaOfLogTCDD^2))
 +
                     #sigmaOfTCDD <- (sqrt(exp(2*muOfLogTCDD+sigmaOfLogTCDD^2)*(exp(sigmaOfLogTCDD^2)-1)))
 
                     }
 
                     }
 
                     ")
 
                     ")
N <- nrow(dat)
+
#N <- nrow(dat)
LogTCDD <- log(dat$result+1) #+1 because of negative log values
+
#LogTCDD <- log(dat$result+1) #+1 because of negative log values
TCDD <- 10^(LogTCDD-1)
+
#TCDD <- 10^(LogTCDD-1)
 +
  TCDD <- dat$Result + 0.0001
 +
  N <- length(TCDD)
  
 
dataList = list(
 
dataList = list(
    TCDD = TCDD,
+
  TCDD = dat$Result + 0.0001,
    N = length(TCDD),
+
  N = length(TCDD)
    meanOfLogTCDD = mean(LogTCDD),
+
meanOfLogTCDD = mean(LogTCDD),
    sdOfLogTCDD = sd(LogTCDD)
+
sdOfLogTCDD = sd(LogTCDD)
 
)
 
)
  
jags <- jags.model(mo, data = dataList, n.chains = 4, n.adapt = 100)
+
jags <- jags.model(mo, data = dataList, n.chains = 4, n.adapt = 1000)
 
close(mo)
 
close(mo)
update(jags, 100)
+
update(jags, 1000)
  
out <- coda.samples(jags, c('sigmaOfTCDD', 'muOfTCDD'), nrow(dat)) # Stores a posterior sample
+
out <- coda.samples(jags, c('tau', 'muOfLogTCDD'), nrow(dat)) # Stores a posterior sample
 
plot(out)
 
plot(out)
  

Revision as of 13:36, 11 February 2016



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.

Model run 11.2.2016

+ Show code

Rationale

See also

References