EU-kalat: Difference between revisions

From Opasnet
Jump to navigation Jump to search
Line 638: Line 638:
#dimnames(samps.j$timep) <- list(Dummy = "time", Iter = 1:N, Chain = 1:4)
#dimnames(samps.j$timep) <- list(Dummy = "time", 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(
    Omega = apply(samps.j$Omega, MARGIN = 1:3, FUN = mean),
  Omega = apply(samps.j$Omega, MARGIN = 1:3, FUN = mean),
    #      lenp = cbind(
  #      lenp = cbind(
    #        mean = apply(samps.j$lenp, MARGIN = 1, FUN = mean),
  #        mean = apply(samps.j$lenp, MARGIN = 1, FUN = mean),
    #        sd = apply(samps.j$lenp, MARGIN = 1, FUN = sd)
  #        sd = apply(samps.j$lenp, MARGIN = 1, FUN = sd)
    #      ),
  #      ),
    mu = apply(samps.j$mu, MARGIN = 1:2, FUN = mean),
  mu = apply(samps.j$mu, MARGIN = 1:2, FUN = mean),
    #      timep = cbind(
  #      timep = cbind(
    #        mean = apply(samps.j$timep, MARGIN = 1, FUN = mean),
  #        mean = apply(samps.j$timep, MARGIN = 1, FUN = mean),
    #        sd = apply(samps.j$timep, MARGIN = 1, FUN = sd)
  #        sd = apply(samps.j$timep, MARGIN = 1, FUN = sd)
    #      )
  #      )
    mu_nd =  apply(samps.j$mu_nd, MARGIN = 1:2, FUN = mean),
  mu_nd =  apply(samps.j$mu_nd, MARGIN = 1:2, FUN = mean),
    tau_nd =  apply(samps.j$tau_nd, MARGIN = 1, FUN = mean)
  tau_nd =  apply(samps.j$tau_nd, MARGIN = 1, FUN = mean)
  )
)
  #    names(dimnames(conc.param$lenp)) <- c("Fish","Metaparam")
#    names(dimnames(conc_param$lenp)) <- c("Fish","Metaparam")
  #    names(dimnames(conc.param$timep)) <- c("Dummy","Metaparam")
#    names(dimnames(conc_param$timep)) <- c("Dummy","Metaparam")


conc.param <- melt(conc.param)
conc_param <- melt(conc_param)
colnames(conc.param)[colnames(conc.param)=="value"] <- "Result"
colnames(conc_param)[colnames(conc_param)=="value"] <- "Result"
colnames(conc.param)[colnames(conc.param)=="L1"] <- "Parameter"
colnames(conc_param)[colnames(conc_param)=="L1"] <- "Parameter"
conc.param$Compound[conc.param$Parameter =="tau_nd"] <- conl_nd # drops out for some reason
conc_param$Compound[conc_param$Parameter =="tau_nd"] <- conl_nd # drops out for some reason
conc_param <- fillna(conc_param,"Fish")
for(i in 1:ncol(conc_param)) {
  if("factor" %in% class(conc_param[[i]])) conc_param[[i]] <- as.character(conc_param[[i]])
}
conc_param <- Ovariable("conc_param",data=conc_param)


objects.store(conc.param)
objects.store(conc_param)
cat("Data frame conc.params stored.\n")
cat("Data frame conc_params stored.\n")


######################3
######################3
Line 681: Line 686:
   facet_wrap( ~ Compound, scales="free_x")+scale_x_log10()
   facet_wrap( ~ Compound, scales="free_x")+scale_x_log10()


  scatterplotMatrix(t(exp(samps.j$pred[2,,,1])), main = paste("Predictions for several compounds for",
scatterplotMatrix(t(exp(samps.j$pred[2,,,1])), main = paste("Predictions for several compounds for",
    names(samps.j$pred[,1,1,1])[2]))
                                                            names(samps.j$pred[,1,1,1])[2]))
  scatterplotMatrix(t(exp(samps.j$pred[,1,,1])), main = paste("Predictions for all fish species for",
scatterplotMatrix(t(exp(samps.j$pred[,1,,1])), main = paste("Predictions for all fish species for",
    names(samps.j$pred[1,,1,1])[1]))
                                                            names(samps.j$pred[1,,1,1])[1]))
  scatterplotMatrix(t(samps.j$Omega[2,,1,,1]), main = "Omega for several compounds in Baltic herring")
scatterplotMatrix(t(samps.j$Omega[2,,1,,1]), main = "Omega for several compounds in Baltic herring")


  scatterplotMatrix(t((samps.j$pred_nd[1,,,1])), main = paste("Predictions for several compounds for",
scatterplotMatrix(t((samps.j$pred_nd[1,,,1])), main = paste("Predictions for several compounds for",
    names(samps.j$pred_nd[,1,1,1])[1]))
                                                            names(samps.j$pred_nd[,1,1,1])[1]))
 
 
  #plot(coda.samples(jags, 'Omega', N))
#plot(coda.samples(jags, 'Omega', N))
  plot(coda.samples(jags, 'mu', N*thin, thin))
plot(coda.samples(jags, 'mu', N*thin, thin))
  #plot(coda.samples(jags, 'lenp', N))
#plot(coda.samples(jags, 'lenp', N))
  #plot(coda.samples(jags, 'timep', N))
#plot(coda.samples(jags, 'timep', N))
  plot(coda.samples(jags, 'pred', N*thin, thin))
plot(coda.samples(jags, 'pred', N*thin, thin))
  plot(coda.samples(jags, 'mu_nd', N*thin, thin))
plot(coda.samples(jags, 'mu_nd', N*thin, thin))
  tst <- (coda.samples(jags, 'pred', N))
tst <- (coda.samples(jags, 'pred', N))
</rcode>
</rcode>


<rcode name="conc_poll" label="Initiate conc_poll" embed=1>
#This is code Op_en3104/conc_poll on page [[EU-kalat]]
library(OpasnetUtils)
#objects.latest("Op_en3104", code_name="pollutant_bayes")
conc_poll <- Ovariable(
  "conc_poll",
  dependencies = data.frame(
    Name=c("conc_param"), #,"lengt","time"),
    Ident=c("Op_en3104/pollutant_bayes")#,NA,NA)
  ),
  formula=function(...) {
    require(MASS)
    tmp1 <- conc_param + Ovariable(data=data.frame(Result="0-1")) # Ensures Iter #  lengt + time +
    tmp2 <- unique(tmp1@output[setdiff(
      colnames(tmp1@output)[tmp1@marginal],
      c("Compound","Compound2","Metaparam","Parameter")
    )])
    tmp2$Row <- 1:nrow(tmp2)
    tmp3 <- merge(tmp2,tmp1@output)
    out <- data.frame()
    for(i in 1:nrow(tmp2)) {
      tmp <- tmp3[tmp3$Row == i , ]
      Omega <- solve(tapply( # Is it sure that PCDDF and PCB are not mixed to wrong order?
        tmp$conc_paramResult[tmp$Parameter=="Omega"],
        tmp[tmp$Parameter=="Omega", c("Compound","Compound2")],
        sum # Equal to identity because only 1 row per cell.
      )) # Precision matrix
      con <- names(Omega[,1])
     
      mu <- tmp$conc_paramResult[tmp$Parameter=="mu"][match(con,tmp$Compound[tmp$Parameter=="mu"])] # + # baseline
#        rnorm(1,
#              tmp$conc_paramResult[tmp$Parameter=="lenp" & tmp$Metaparam=="mean"][1],
#              tmp$conc_paramResult[tmp$Parameter=="lenp" & tmp$Metaparam=="sd"][1]
#        ) * (tmp$lengtResult[1]-170) + # lengt
#        rnorm(1,
#              tmp$conc_paramResult[tmp$Parameter=="timep" & tmp$Metaparam=="mean"][1],
#              tmp$conc_paramResult[tmp$Parameter=="timep" & tmp$Metaparam=="sd"][1]
#        )* (tmp$timeResult[1]-2009) # time
     
      rnd <- exp(mvrnorm(1, mu, Omega))
      out <- rbind(out, merge(tmp2[i,], data.frame(Compound=con,Result=rnd)))
    }
    out$Row <- NULL
#    temp <- aggregate(
#      out["Result"],
#      by=out[setdiff(colnames(out), c("Result","Compound"))],
#      FUN=sum
#    )
#    temp$Compound <- "TEQ"
    out <- Ovariable(
      output = out, # rbind(out, temp),
      marginal = colnames(out) != "Result"
    )
    return(out)
  }
)
objects.store(conc_poll)
cat("Ovariable conc_poll stored.\n")
</rcode>


NOTE! This is not a probabilistic approach. Species and area-specific distributions should be created.
NOTE! This is not a probabilistic approach. Species and area-specific distributions should be created.

Revision as of 07:01, 11 March 2021


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

Dioxin concentrations in Baltic herring.

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 this link or by running the codel 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

Preprocess

  • Preprocess model 22.2.2017 [4]
  • Model run 25.1.2017 [5]
  • Model run 22.5.2017 with new ovariables euRaw, euAll, euMain, and euRatio [6]
  • Model run 23.5.2017 with adjusted ovariables euRaw, eu, euRatio [7]
  • Model run 11.10.2017: Small herring and Large herring added as new species [8]
  • Model rerun 15.11.2017 because the previous stored run was lost in update [9]
  • Model run 21.3.2018: Small and large herring replaced by actual fish length [10]
  • Model run 26.3.2018 eu2 moved here [11]

See an updated version of preprocess code for eu on Health effects of Baltic herring and salmon: a benefit-risk assessment#Code for estimating TEQ from chinese PCB7

+ Show code

Bayes model for dioxin concentrations

  • Model run 28.2.2017 [12]
  • Model run 28.2.2017 with corrected survey model [13]
  • Model run 28.2.2017 with Mu estimates [14]
  • Model run 1.3.2017 [15]
  • Model run 23.4.2017 [16] produces list conc.param and ovariable concentration
  • Model run 24.4.2017 [17]
  • Model run 19.5.2017 without ovariable concentration [18] ⇤--#: . The model does not mix well, so the results should not be used for final results. --Jouni (talk) 19:37, 19 May 2017 (UTC) (type: truth; paradigms: science: attack)
----#: . Maybe we should just estimate TEQs until the problem is fixed. --Jouni (talk) 19:37, 19 May 2017 (UTC) (type: truth; paradigms: science: comment)
  • Model run 22.5.2017 with TEQdx and TEQpcb as the only Compounds [19]
  • Model run 23.5.2017 debugged [20] [21] [22]
  • Model run 24.5.2017 TEQdx, TECpcb -> PCDDF, PCB [23]
  • Model run 11.10.2017 with small and large herring [24] (removed in update)
  • Model run 12.3.2018: bugs fixed with data used in Bayes. In addition, redundant fish species removed and Omega assumed to be the same for herring and salmon. [25]
  • Model run 22.3.2018 [26] Model does not mix well. Thinning gives little help?
  • Model run 25.3.2018 with conc.param as ovariable [27]

+ Show code

Initiate conc_pcddf for PFAS disease burden study

Bayesian approach for PCDDF, PCB, OT, PFAS.

  • Model run 2021-03-08 [28]
  • Model run 2021-03-08 [29] with the fish needed in PFAS assessment

+ Show code

+ Show code

NOTE! This is not a probabilistic approach. Species and area-specific distributions should be created.

+ Show code

Initiate conc_pcddf for Goherr

  • Model run 19.5.2017 [30]
  • Model run 23.5.2017 with bugs fixed [31]
  • Model run 12.10.2017: TEQ calculation added [32]
  • Model rerun 15.11.2017 because the previous stored run was lost in update [33]
  • 12.3.2018 adjusted to match the same Omega for all fish species [34]
  • 26.3.2018 includes length and time as parameters, lengt ovariable initiated here [35]

+ Show code

⇤--#: . These codes should be coherent with POPs in Baltic herring. --Jouni (talk) 12:14, 7 June 2017 (UTC) (type: truth; paradigms: science: attack)

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]