Difference between revisions of "EU-kalat"

From Testiwiki
Jump to: navigation, search
(Calculations: Bayes model moved from Benefit-risk assessment of Baltic herring and salmon intake)
(Bayes model for dioxin concentrations: first draft of new model)
Line 165: Line 165:
 
names(LOQ) <- conl
 
names(LOQ) <- conl
 
cong <- data.matrix(fishsamples[3:ncol(fishsamples)])
 
cong <- data.matrix(fishsamples[3:ncol(fishsamples)])
cong[cong == 0] <- 0.01 # NA # Needed for dinterval
+
cong[cong == 0] <- 0.001 # NA # Needed for dinterval
  
 
mod <- textConnection("
 
mod <- textConnection("
 
   model{
 
   model{
 
     for(i in 1:S) { # s = fish sample
 
     for(i in 1:S) { # s = fish sample
      for(j in 1:C) { # C = congener
+
#      for(j in 1:C) { # C = congener
 
         #        below.LOQ[i,j] ~ dinterval(-cong[i,j], -LOQ[j])
 
         #        below.LOQ[i,j] ~ dinterval(-cong[i,j], -LOQ[j])
         cong[i,j] ~ dlnorm(mu[fis[i],j], tau[fis[i],j])
+
         cong[i,1:C] ~ dmnorm(mu[fis[i],], Omega[fis[i],,])
      }
+
#      }
 
     }
 
     }
 
     for(i in 1:F) { # F = fish species
 
     for(i in 1:F) { # F = fish species
       for(j in 1:C) { # C = congener
+
       mu[i,1:C] ~ dmnorm(mu0[1:C], S2[1:C,1:C])
        mu[i,j] ~ dunif(-3,3) # Why does this not work with dnorm(0, 0.001)?
+
      Omega[i,1:C,1:C] ~ dwish(S3[1:C,1:C],S)
        tau[i,j] <- pow(sigma[i,j], -2)
+
      ans.pred[i,1:C] ~ dmnorm(mu[i,], Omega[i,,]) # Model prediction
        sigma[i,j] ~ dunif(0, 10)
 
        pcd.pred[i,j] ~ dlnorm(mu[i,j], tau[i,j]) # Model prediction
 
      }
 
 
     }
 
     }
 
   }
 
   }
 
")
 
")
  
 +
C <- length(conl)
 
jags <- jags.model(
 
jags <- jags.model(
 
   mod,
 
   mod,
 
   data = list(
 
   data = list(
 
     S = nrow(fishsamples),
 
     S = nrow(fishsamples),
     C = length(conl),
+
     C = C,
 
     F = length(fisl),
 
     F = length(fisl),
     cong = cong,
+
     cong = log(cong),
 
     #    LOQ = LOQ,
 
     #    LOQ = LOQ,
 
     #    below.LOQ = is.na(cong)*1,
 
     #    below.LOQ = is.na(cong)*1,
     fis = match(fishsamples$Fish, fisl)
+
     fis = match(fishsamples$Fish, fisl),
 +
    mu0 = rep(2,C),
 +
    S2 = diag(C)/100000,
 +
    S3 = diag(C)/10000
 +
  ),
 +
  n.chains = 4,
 +
  n.adapt = 100
 +
)
 +
if(FALSE) {
 +
mod <- textConnection("
 +
  model{
 +
                      for(i in 1:S) {
 +
                      survs[i,1:4] ~ dmnorm(mus[], Omegas[,])
 +
                      }
 +
                      for(j in 1:H) {
 +
                      survh[j,1:4] ~ dmnorm(muh[], Omegah[,])
 +
                      }
 +
                      mus[1:4] ~ dmnorm(mu0[1:4], S2[1:4,1:4])
 +
                      Omegas[1:4,1:4] ~ dwish(S3[1:4,1:4],S)
 +
                      anss.pred ~ dmnorm(mus[], Omegas[,])
 +
                      muh[1:4] ~ dmnorm(mu0[1:4], S2[1:4,1:4])
 +
                      Omegah[1:4,1:4] ~ dwish(S3[1:4,1:4],H)
 +
                      ansh.pred ~ dmnorm(muh[], Omegah[,])
 +
                      }
 +
                      ")
 +
 
 +
jags <- jags.model(
 +
  mod,
 +
  data = list(
 +
    survs = surv[surv$Eatsalm,c(8:11)],
 +
    S = sum(surv$Eatsalm),
 +
    survh = surv[surv$Eatherr,c(13:16)],
 +
    H = sum(surv$Eatherr),
 +
    mu0 = rep(2,4),
 +
    S2 = diag(4)/100000,
 +
    S3 = diag(4)/10000
 
   ),
 
   ),
 
   n.chains = 4,
 
   n.chains = 4,
 
   n.adapt = 100
 
   n.adapt = 100
 
)
 
)
 +
}
 +
 +
update(jags, 100)
 +
 +
samps.j <- jags.samples(
 +
  jags,
 +
  c('mu', 'Omega', 'ans.pred'),
 +
  1000
 +
)
 +
js <- array(
 +
  c(
 +
    samps.j$mu[,,,1],
 +
    samps.j$Omega[,,1,,1],
 +
    samps.j$Omega[,,2,,1],
 +
    samps.j$Omega[,,3,,1],
 +
    samps.j$Omega[,,4,,1],
 +
    samps.j$Omega[,,5,,1],
 +
    samps.j$Omega[,,6,,1],
 +
    samps.j$Omega[,,7,,1],
 +
    samps.j$Omega[,,8,,1],
 +
    samps.j$Omega[,,9,,1],
 +
    samps.j$Omega[,,10,,1],
 +
    samps.j$Omega[,,11,,1],
 +
    samps.j$Omega[,,12,,1],
 +
    samps.j$Omega[,,13,,1],
 +
    samps.j$Omega[,,14,,1],
 +
    samps.j$ans.pred[,,,1]
 +
  ),
 +
  dim = c(14,14,1000,16),
 +
  dimnames = list(
 +
    Compound = 1:14,
 +
    Fish = 1:14,
 +
    Iter = 1:1000,
 +
    Parameter = c("mu", paste("Omega", 1:14, sep=""), "ans.pred")
 +
  )
 +
)
 +
 +
# Mu for all congeners of fish1
 +
scatterplotMatrix(t(js[,1,,1]))
 +
# All parameters for TCDD of fish1
 +
scatterplotMatrix(js[1,1,,])
 +
# Mu for all fishes for TCDD
 +
scatterplotMatrix(t(js[1,,,1]))
 +
 +
jsd <- melt(js)
 +
ggplot(jsd, aes(x=value, colour=Question))+geom_density()+facet_grid(Parameter ~ Fish)
 +
#ggplot(as.data.frame(js), aes(x = anss.pred, y = Sampled))+geom_point()+stat_ellipse()
 +
 +
coda.j <- coda.samples(
 +
  jags,
 +
  c('mus', 'Omegas', 'anss.pred'),
 +
  1000
 +
)
 +
 +
plot(coda.j)
 +
 +
######## fish.param contains expected values of the distribution parameters from the model
 +
 +
fish.param <- list(
 +
  mu = apply(js[,,1,], MARGIN = c(1,3), FUN = mean),
 +
  Omega = lapply(
 +
    1:2,
 +
    FUN = function(x) {
 +
      solve(apply(js[,,2:5,], MARGIN = c(1,3,4), FUN = mean)[,,x])
 +
    } # solve matrix: precision->covariace
 +
  )
 +
)
 +
 +
jsp <- Ovariable(
 +
  "jsp",
 +
  dependencies = data.frame(Name = "fish.param"),
 +
  formula = function(...) {
 +
    jsp <- lapply(
 +
      1:2,
 +
      FUN = function(x) {
 +
        mvrnorm(openv$N, fish.param$mu[,x], fish.param$Omega[[x]])
 +
      }
 +
    )
 +
   
 +
    jsp <- rbind(
 +
      cbind(
 +
        Fish = "Salmon",
 +
        Iter = 1:nrow(jsp[[1]]),
 +
        as.data.frame(jsp[[1]])
 +
      ),
 +
      cbind(
 +
        Fish = "Herring",
 +
        Iter = 1:nrow(jsp[[2]]),
 +
        as.data.frame(jsp[[2]])
 +
      )
 +
    )
 +
    jsp <- melt(jsp, id.vars = c("Iter", "Fish"), variable.name = "Question", value.name = "Result")
 +
    jsp <- Ovariable(output=jsp, marginal = colnames(jsp) %in% c("Iter", "Fish", "Question"))
 +
    return(jsp)
 +
  }
 +
)
 +
 +
# Combine modelled survey answers with estimated amounts and frequencies by:
 +
# Rounding the modelled result and merging that with value in ovariable assump
 +
 +
often <- Ovariable(
 +
  "often",
 +
  dependencies = data.frame(Name=c("jsp","assump")),
 +
  formula = function(...) {
 +
    out <- jsp[jsp$Question == "1" , !colnames(jsp@output) %in% c("Question")]
 +
    out$Value <- round(result(out))
 +
    out <- merge(
 +
      assump@output[assump$Variable == "freq",],
 +
      out@output
 +
    )
 +
    colnames(out)[colnames(out) == "assumpResult"] <- "Result"
 +
    return(out[!colnames(out) %in% c("Value", "Variable")])
 +
  }
 +
)
 +
 +
#######################################
  
 
update(jags, 100)
 
update(jags, 100)
Line 231: Line 380:
 
)
 
)
  
objects.store(pcd.pred, mu.pred)
+
#objects.store(pcd.pred, mu.pred)
cat("Arrays pcd.pred, mu.pred stored.\n")
+
#cat("Arrays pcd.pred, mu.pred stored.\n")
 
</rcode>
 
</rcode>
  

Revision as of 13:15, 21 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]

+ 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]