Difference between revisions of "EU-kalat"

From Testiwiki
Jump to: navigation, search
(Bayes model for dioxin concentrations: debugged and now it works)
(Bayes model for dioxin concentrations)
Line 130: Line 130:
 
* Model run 1.3.2017 [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=3Xu19vkWK1lyWVg3]
 
* Model run 1.3.2017 [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=3Xu19vkWK1lyWVg3]
 
* Model run 23.4.2017 [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=8DnCPAKsMxGALkjs] produces list conc.param and ovariable concentration
 
* Model run 23.4.2017 [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=8DnCPAKsMxGALkjs] produces list conc.param and ovariable concentration
 +
* Model run 24.4.2017 [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=ujtyawudKqJ7mmjn]
  
 
<rcode name="bayes" label="Sample Bayes model (for developers only)" graphics=1>
 
<rcode name="bayes" label="Sample Bayes model (for developers only)" graphics=1>
Line 177: Line 178:
 
   model{
 
   model{
 
     for(i in 1:S) { # s = fish sample
 
     for(i in 1:S) { # s = fish sample
    #        below.LOQ[i,j] ~ dinterval(-cong[i,j], -LOQ[j])
+
      #        below.LOQ[i,j] ~ dinterval(-cong[i,j], -LOQ[j])
 
       cong[i,1:C] ~ dmnorm(mu[fis[i],], Omega[fis[i],,])
 
       cong[i,1:C] ~ dmnorm(mu[fis[i],], Omega[fis[i],,])
 
     }
 
     }
 
     for(i in 1:Fi) { # Fi = fish species
 
     for(i in 1:Fi) { # Fi = fish species
       mu[i,1:C] ~ dmnorm(mu0[1:C], Omega0[1:C,1:C])
+
       for(j in 1:C) {
 +
        mu[i,j] ~ dnorm(mu1[j], tau1[j])
 +
      }
 
       Omega[i,1:C,1:C] ~ dwish(Omega0[1:C,1:C],S)
 
       Omega[i,1:C,1:C] ~ dwish(Omega0[1:C,1:C],S)
       ans.pred[i,1:C] ~ dmnorm(mu[i,], Omega[i,,]) # Model prediction
+
       pred[i,1:C] ~ dmnorm(mu[i,], Omega[i,,]) # Model prediction
 
     }
 
     }
 +
    for(i in 1:C) { # C = Compound
 +
      mu1[i] ~ dnorm(0, 0.0001)
 +
      tau1[i] ~ dunif(0,10000)
 +
      pred1[i] ~ dnorm(mu1[i], tau1[i])
 +
    }
 +
    Omega1[1:C,1:C] ~ dwish(Omega0[1:C,1:C],S)
 
   }
 
   }
 
")
 
")
Line 198: Line 207:
 
     #    below.LOQ = is.na(cong)*1,
 
     #    below.LOQ = is.na(cong)*1,
 
     fis = match(fishsamples$Fish, fisl),
 
     fis = match(fishsamples$Fish, fisl),
    mu0 = rep(0,C),
 
 
     Omega0 = diag(C)/100000
 
     Omega0 = diag(C)/100000
 
   ),
 
   ),
Line 209: Line 217:
 
samps.j <- jags.samples(
 
samps.j <- jags.samples(
 
   jags,  
 
   jags,  
   c('mu', 'Omega', 'ans.pred'),  
+
   c('mu', 'Omega', 'pred', 'mu1', 'Omega1', 'tau1', 'pred1'),  
 
   N
 
   N
 
)
 
)
 
dimnames(samps.j$mu) <- list(Fish = fisl, Compound = conl, Iter = 1:N, Chain = 1:4)
 
dimnames(samps.j$mu) <- list(Fish = fisl, Compound = conl, Iter = 1:N, Chain = 1:4)
 +
dimnames(samps.j$mu1) <- list(Compound = conl, Iter = 1:N, Chain = 1:4)
 +
dimnames(samps.j$pred) <- list(Fish = fisl, Compound = conl, Iter = 1:N, Chain = 1:4)
 +
dimnames(samps.j$mu1) <- list(Compound = conl, Iter = 1:N, Chain = 1:4)
 +
dimnames(samps.j$tau1) <- list(Compound = conl, Iter = 1:N, Chain = 1:4)
 +
dimnames(samps.j$pred1) <- list(Compound = conl, Iter = 1:N, Chain = 1:4)
 
dimnames(samps.j$Omega) <- list(Fish = fisl, Compound = conl, Compound2 = conl, Iter=1:N, Chain=1:4)
 
dimnames(samps.j$Omega) <- list(Fish = fisl, Compound = conl, Compound2 = conl, Iter=1:N, Chain=1:4)
dimnames(samps.j$ans.pred) <- list(Fish = fisl, Compound=conl,Iter=1:N, Chain=1:4)
+
dimnames(samps.j$Omega1) <- list(Compound = conl, Compound2 = conl, Iter=1:N, Chain=1:4)
  
 
##### conc.param contains expected values of the distribution parameters from the model
 
##### conc.param contains expected values of the distribution parameters from the model
 
conc.param <- list(
 
conc.param <- list(
   mu = apply(samps.j$mu[,,,1], MARGIN = c(1,2), FUN = mean),
+
   mu = apply(samps.j$mu[,,,1], MARGIN = 1:2, FUN = mean),
   Omega = apply(samps.j$Omega[,,,,1], MARGIN = c(1,2,3), FUN = mean)
+
   Omega = apply(samps.j$Omega[,,,,1], MARGIN = 1:3, FUN = mean),
 +
  pred.mean = apply(samps.j$pred[,,,1], MARGIN = 1:2, FUN = mean),
 +
  pred.sd = apply(samps.j$pred[,,,1], MARGIN = 1:2, FUN = sd),
 +
  mu1 = apply(samps.j$mu1[,,1], MARGIN = 1, FUN = mean),
 +
  tau1 = apply(samps.j$tau1[,,1], MARGIN = 1, FUN = mean),
 +
  pred1.mean = apply(samps.j$pred1[,,1], MARGIN = 1, FUN = mean),
 +
  pred1.sd = apply(samps.j$pred1[,,1], MARGIN = 1, FUN = sd)
 
)
 
)
  
Line 242: Line 261:
 
)
 
)
  
objects.store(concentration, conc.param)
+
objects.store(concentration, conc.param, samps.j)
cat("Ovariable concentration and list conc.params stored.\n")
+
cat("Ovariable concentration and lists conc.params and samps.j stored.\n")
  
 
# Predictions for all congeners of fish1 (Baltic herring)
 
# Predictions for all congeners of fish1 (Baltic herring)
scatterplotMatrix(t(samps.j$ans.pred[1,,,1]))
+
scatterplotMatrix(t(samps.j$pred[1,,,1]))
 +
# Means for all congeners of the generic fish
 +
scatterplotMatrix(t(samps.j$mu1[,,1]))
 +
# Prediction for all congeners of the generic fish
 +
scatterplotMatrix(t(samps.j$pred1[,,1]))
 
# Predictions for all fish species for TCDD
 
# Predictions for all fish species for TCDD
scatterplotMatrix(t(samps.j$ans.pred[,1,,1]))
+
scatterplotMatrix(t(samps.j$pred[,1,,1]))
 +
# Predictions for pike for omegas and PeCDD
 +
scatterplotMatrix(t(samps.j$Omega[6,2,,,1]))
  
 
concentration <- EvalOutput(concentration)
 
concentration <- EvalOutput(concentration)
  
ggplot(melt(exp(samps.j$ans.pred[,,,1])), aes(x=value, colour=Compound))+geom_density()+
+
ggplot(melt(exp(samps.j$pred[,,,1])), aes(x=value, colour=Compound))+geom_density()+
 
   facet_wrap( ~ Fish,scales = "free_y")+scale_x_log10()
 
   facet_wrap( ~ Fish,scales = "free_y")+scale_x_log10()
 
ggplot(eu@output, aes(x = euResult, colour=Congener))+geom_density()+
 
ggplot(eu@output, aes(x = euResult, colour=Congener))+geom_density()+
Line 258: Line 283:
 
#stat_ellipse()
 
#stat_ellipse()
  
#coda.j <- coda.samples(
+
coda.j <- coda.samples(
jags,  
+
  jags,  
c('mu', 'Omega', 'ans.pred'),  
+
  c('mu', 'pred', 'omega1', 'pred1'),  
N
+
  N
#)
+
)
  
#plot(coda.j)
+
plot(coda.j)
 
</rcode>
 
</rcode>
  

Revision as of 20:09, 24 April 2017


EU-kalat is a study, where concentrations of PCDD/Fs, PCBs, PBDEs and heavy metals have been measured from fish

Question

The scope of EU-kalat study was to measure concentrations of persistent organic pollutants (POPs) including dioxin (PCDD/F), PCB and BDE in fish from Baltic sea and Finnish inland lakes and rivers. [1] [2] [3].

Answer

The original sample results can be acquired from Opasnet base. The study showed that levels of PCDD/Fs and PCBs depends especially on the fish species. Highest levels were on salmon and large sized herring. Levels of PCDD/Fs exceeded maximum level of 4 pg TEQ/g fw multiple times. Levels of PCDD/Fs were correlated positively with age of the fish.

Mean congener concentrations as WHO2005-TEQ in Baltic herring can be printed out with the Run code below.

+ Show code

Rationale

Data

Data was collected between 2009-2010. The study contains years, tissue type, fish species, and fat content for each concentration measurement. Number of observations is 285.

There is a new study EU-kalat 3, which will produce results in 2016.

Calculations

+ Show code

Bayes model for dioxin concentrations

  • Model run 28.2.2017 [6]
  • Model run 28.2.2017 with corrected survey model [7]
  • Model run 28.2.2017 with Mu estimates [8]
  • Model run 1.3.2017 [9]
  • Model run 23.4.2017 [10] produces list conc.param and ovariable concentration
  • Model run 24.4.2017 [11]

+ Show code

See also

References

  1. A. Hallikainen, H. Kiviranta, P. Isosaari, T. Vartiainen, R. Parmanne, P.J. Vuorinen: Kotimaisen järvi- ja merikalan dioksiinien, furaanien, dioksiinien kaltaisten PCB-yhdisteiden ja polybromattujen difenyylieettereiden pitoisuudet. Elintarvikeviraston julkaisuja 1/2004. [1]
  2. E-R.Venäläinen, A. Hallikainen, R. Parmanne, P.J. Vuorinen: Kotimaisen järvi- ja merikalan raskasmetallipitoisuudet. Elintarvikeviraston julkaisuja 3/2004. [2]
  3. Anja Hallikainen, Riikka Airaksinen, Panu Rantakokko, Jani Koponen, Jaakko Mannio, Pekka J. Vuorinen, Timo Jääskeläinen, Hannu Kiviranta. Itämeren kalan ja muun kotimaisen kalan ympäristömyrkyt: PCDD/F-, PCB-, PBDE-, PFC- ja OT-yhdisteet. Eviran tutkimuksia 2/2011. ISSN 1797-2981 ISBN 978-952-225-083-4 [3]