Difference between revisions of "Goherr: Fish consumption study"

From Testiwiki
Jump to: navigation, search
(Bayes: bayes model split and moved from Benefit-risk assessment of Baltic herring and salmon intake and updated to include non-fish consumers)
(Bayes model: version where p has more dimensions)
Line 220: Line 220:
  
 
* Model run 3.3.2017. All variables assumed independent. [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=lwlSwXazIDHDyJJg]
 
* Model run 3.3.2017. All variables assumed independent. [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=lwlSwXazIDHDyJJg]
 +
* Model run 3.3.2017. p has more dimensions. [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=ZmbNUuZeb7UOf8NP]
  
 
<rcode name="bayes" label="Initiate Bayes model (for developers only)" graphics=1>
 
<rcode name="bayes" label="Initiate Bayes model (for developers only)" graphics=1>
Line 280: Line 281:
 
       "Gender"
 
       "Gender"
 
     )]
 
     )]
coln <-    c(
+
quesl <-    c(
 
   "How often",
 
   "How often",
 
   "How much",
 
   "How much",
Line 289: Line 290:
 
   "Gender"
 
   "Gender"
 
)
 
)
colnames(ans.sal) <- coln
+
colnames(ans.sal) <- quesl
colnames(ans.her) <- coln
+
colnames(ans.her) <- quesl
 
ans <- rbind(ans.sal, ans.her)
 
ans <- rbind(ans.sal, ans.her)
  
 
head(ans)
 
head(ans)
qlen <-  c(7,7,7,5) # Previously was calculated from data: unlist(lapply(
+
qlen <-  c(7,7,7,5) # Number of options in each question
#  surv,
+
 
#  FUN = function(x) {length(levels(x))}))[-c(1:3, ncol(surv))]
 
#questionl <- colnames(surv)
 
 
questionl <- colnames(ans.sal)
 
questionl <- colnames(ans.sal)
 
questionl.her <- colnames(ans.her)
 
questionl.her <- colnames(ans.her)
Line 308: Line 307:
 
mod <- textConnection("
 
mod <- textConnection("
 
   model{
 
   model{
 +
# Data1: Full questionnaire
 
     for(f in 1:2) { # Salmon or herring
 
     for(f in 1:2) { # Salmon or herring
 
       for(i in 1:U) { # Full questionnaire
 
       for(i in 1:U) { # Full questionnaire
         consume[i,f] ~ dbern(p[f])
+
         consume[i,f] ~ dbern(p[f,ageU[i],countryU[i],genderU[i]])
 
       }
 
       }
      p[f] ~ dbeta(1,1)
 
 
     }
 
     }
 +
# Data2: Those responses that reported either Baltic herring or salmon
 
     for(q in 1:Q) { # Q = # of fish-specific questions
 
     for(q in 1:Q) { # Q = # of fish-specific questions
 
       for(i in 1:S) { # S = # respondents who eat Baltic salmon or herring
 
       for(i in 1:S) { # S = # respondents who eat Baltic salmon or herring
 
         ans[i,q] ~ dbin(p2[fis[i],age[i],country[i],gender[i],q], qlen[q])
 
         ans[i,q] ~ dbin(p2[fis[i],age[i],country[i],gender[i],q], qlen[q])
 
       }
 
       }
      for(i in 1:A) { # Age groups
+
    }
        for(j in 1:C) { # Countries
+
# Priors (multidimensional)
          for(k in 1:G) { #Genders
+
    for(i in 1:A) { # Age groups
            for(f in 1:2) { # Fish species
+
      for(j in 1:C) { # Countries
               p2[f,i,j,k,q] ~ dunif(0,1)  
+
        for(k in 1:G) { #Genders
 +
          for(f in 1:2) { # Fish species
 +
            p[f,i,j,k] ~ dbeta(1,1)
 +
            for(q in 1:Q) { # Q = # of fish-specific questions
 +
               p2[f,i,j,k,q] ~ dbeta(1,1)  
 
               ans.pred[f,i,j,k,q] ~ dbin(p2[f,i,j,k,q], qlen[q])
 
               ans.pred[f,i,j,k,q] ~ dbin(p2[f,i,j,k,q], qlen[q])
 
             }
 
             }
Line 344: Line 348:
 
     country = match(ans$Country, countryl),
 
     country = match(ans$Country, countryl),
 
     gender = match(ans$Gender, genderl),
 
     gender = match(ans$Gender, genderl),
 +
    ageU = match(survey$Ages, agel),
 +
    countryU = match(survey$Country, countryl),
 +
    genderU = match(survey$Gender, genderl),
 
     fis = c(rep(1, nrow(ans.sal)), rep(2, nrow(ans.her))),
 
     fis = c(rep(1, nrow(ans.sal)), rep(2, nrow(ans.her))),
#    Ys = grep("Yes", survey[["Baltic salmon"]]),
 
#    Yh = grep("Yes", survey[["Eat Baltic herring"]]),
 
 
     A = length(agel),
 
     A = length(agel),
 
     C = length(countryl),
 
     C = length(countryl),
Line 361: Line 366:
 
ans.pred <- array(
 
ans.pred <- array(
 
   samps$ans.pred,  
 
   samps$ans.pred,  
   dim = c(length(fisl), length(agel), length(countryl), length(genderl), length(coln), 1000, 4),  
+
   dim = c(length(fisl), length(agel), length(countryl), length(genderl), length(quesl), 1000, 4),  
 
   dimnames = list(
 
   dimnames = list(
 
     Fish = fisl,
 
     Fish = fisl,
Line 367: Line 372:
 
     Country = countryl,
 
     Country = countryl,
 
     Gender = genderl,
 
     Gender = genderl,
     Question = coln,
+
     Question = quesl,
 
     Iter = 1:1000,
 
     Iter = 1:1000,
 
     Seed = c("S1","S2","S3","S4")
 
     Seed = c("S1","S2","S3","S4")
Line 375: Line 380:
 
p.pred <- array(
 
p.pred <- array(
 
   samps$p,  
 
   samps$p,  
   dim = c(length(fisl), 1000, 4),  
+
   dim = c(length(fisl), length(agel), length(countryl), length(genderl), 1000, 4),  
 
   dimnames = list(
 
   dimnames = list(
 
     Fish = fisl,
 
     Fish = fisl,
 +
    Age = agel,
 +
    Country = countryl,
 +
    Gender = genderl,
 
     Iter = 1:1000,
 
     Iter = 1:1000,
 
     Seed = c("S1","S2","S3","S4")
 
     Seed = c("S1","S2","S3","S4")
 
   )
 
   )
 
)
 
)
 +
  
 
p2.pred <- array(
 
p2.pred <- array(
 
   samps$p2,  
 
   samps$p2,  
   dim = c(length(fisl), length(agel), length(countryl), length(genderl), length(coln), 1000, 4),  
+
   dim = c(length(fisl), length(agel), length(countryl), length(genderl), length(quesl), 1000, 4),  
 
   dimnames = list(
 
   dimnames = list(
 
     Fish = fisl,
 
     Fish = fisl,
Line 391: Line 400:
 
     Country = countryl,
 
     Country = countryl,
 
     Gender = genderl,
 
     Gender = genderl,
     Question = coln,
+
     Question = quesl,
 
     Iter = 1:1000,
 
     Iter = 1:1000,
 
     Seed = c("S1","S2","S3","S4")
 
     Seed = c("S1","S2","S3","S4")
Line 409: Line 418:
 
scatterplotMatrix(t(p2.pred[1,1,3,1,,,1]))
 
scatterplotMatrix(t(p2.pred[1,1,3,1,,,1]))
  
scatterplotMatrix(t(p.pred[,,1]))
+
scatterplotMatrix(t(p.pred[1,1,,1,,1]))
 +
scatterplotMatrix(t(p.pred[,1,3,1,,1]))
 +
scatterplotMatrix(t(p.pred[1,,3,1,,1]))
 +
scatterplotMatrix(t(p.pred[1,1,3,,,1]))
  
 
objects.store(ans.pred, p.pred, p2.pred)
 
objects.store(ans.pred, p.pred, p2.pred)

Revision as of 15:13, 3 March 2017


Question

How Baltic herring and salmon are used as human food in Baltic sea countries? Which determinants affect on people’s eating habits of these fish species?

Answer

Survey data will be analysed during winter 2016-2017 and results will be updated here.

+ Show code

Rationale

Survey of eating habits of Baltic herring and salmon in Denmark, Estonia, Finland and Sweden has been done in September 2016 by Taloustutkimus oy. Content of the questionnaire can be accessed in Google drive. The actual data will be uploaded to Opasnet base on Octobere 2016.

The R-code to analyse the survey data will be provided on this page later on.

Data

Original datafile File:Goherr fish consumption.csv

Preprocessing

This code is used to preprocess the original questionnaire data from the above .csv file and to store the data as a usable variable to Opasnet base.

+ Show code

Bayes model

  • Model run 3.3.2017. All variables assumed independent. [1]
  • Model run 3.3.2017. p has more dimensions. [2]

+ Show code

Calculations

This code calculates how much (g/day) Baltic herring and salmon are eaten based on an Bayesian model build up based on the questionnaire data.

+ Show code

Assumptions

The following assumptions are used:

Assumptions for calculations(-)
ObsVariablevalueExplanationResult
1freq6times per year260 - 364
2freq5times per year104 - 208
3freq4times per year52
4freq3times per year12 - 36
5freq2times per year2 - 5
6freq1times per year0.5 - 0.9
7freq0times per year0
8amdish0grams / serving20 - 50
9amdish1grams / serving70 - 100
10amdish2grams / serving120 - 150
11amdish3grams / serving170 - 200
12amdish4grams / serving220 - 250
13amdish5grams / serving270 - 300
14amdish6grams / serving450 - 500
15ingridientfraction0.1 - 0.3
16amside0grams / serving20 - 50
17amside1grams / serving70 - 100
18amside2grams / serving120 - 150
19amside3grams / serving170 - 200
20amside4grams / serving220 - 250

Questionnaire


Dependencies

The survey data will be used as input in the benefit-risk assessment of Baltic herring and salmon intake, which is part of the WP5 work in Goherr-project.

Formula

See also

Keywords

References


Related files

<mfanonymousfilelist></mfanonymousfilelist>

Goherr: Fish consumption study. Opasnet . [3]. Accessed 17 May 2024.