Goherr: Fish consumption study: Difference between revisions
(→Initiate ovariables: new improved decision ovariables effinfo and effrecomm as described in BBN) |
|||
Line 888: | Line 888: | ||
sur <- survey1[ | sur <- survey1[ | ||
sample(1:nrow(survey1), openv$N, replace=TRUE, prob=survey1$Weighting) , | sample(1:nrow(survey1), openv$N, replace=TRUE, prob=survey1$Weighting) , | ||
c(157,1,3,158,162: | c(157,1,3,158,162:178,81,82,131,132) # Removed, not needed:16,29,30? | ||
] | ] | ||
sur$Iter <- 1:openv$N | sur$Iter <- 1:openv$N | ||
#colnames(sur) | #colnames(sur) | ||
#[1] "Row" "Country" | #[1] "Row" "Country" "Gender" | ||
#[ | #[4] "Ages" "Baltic.salmon.n" "How.often.BS.n" | ||
#[ | #[7] "How.much.BS.n" "How.often.side.BS.n" "How.much.side.BS.n" | ||
#[ | #[10] "Better.availability.BS.n" "Less.chemicals.BS.n" "Eat.BH.n" | ||
#[13] "How.often.BH.n" "How.much.BH.n" "How.often.side.BH.n" | |||
#[ | #[16] "How.much.side.BH.n" "Better.availability.BH.n" "Less.chemicals.BH.n" | ||
#[19] "Eatfish" "Eatsalm" "Eatherr" | |||
#[22] "Recommended.BS" "Not.recommended.BS" "Recommended.BH" | |||
#[25] "Not.recommended.BH" "Iter" | |||
# | # Make sure that Row is kept separate from Iter because in the sampling version they are different. | ||
# sur | # sur contained columns Eat.fish, How.often.fish, Eat.salmon. Are these needed, as all other questions are melted? No | ||
# Columns 5-7 removed, so colnames list above does not match. | # Columns 5-7 removed, so colnames list above does not match. | ||
colnames(sur)[5 | colnames(sur)[5] <- "Eat.BS" | ||
colnames(sur) <- gsub("\\.n","",colnames(sur)) | |||
sur[22:25] <- sapply(sur[22:25], as.numeric) | |||
sur <- melt( | sur <- melt( | ||
sur, | sur, | ||
id.vars=c(1:4,26), | |||
variable.name="Question", | variable.name="Question", | ||
value.name="Result" | value.name="Result" | ||
) | ) | ||
sur$Fish <- ifelse(grepl("BH",sur$Question),"Herring","Salmon") | |||
sur$Question <- gsub("\\.BS","",sur$Question) | |||
sur$Question <- gsub("\\.BH","",sur$Question) | |||
sur$Result[sur$Question %in% | # The adjustments below probably should go to the preprocess2 code. | ||
sur$Result[sur$Question %in% c( | |||
"Better.availability", | |||
"Less.chemicals", | |||
"Recommended", | |||
"Not.recommended" | |||
) & is.na(sur$Result)] <- 4 # If missing --> no change | |||
sur$Result[is.na(sur$Result)] <- 1 # Replace missing values with 1. That will produce 0 g/d. | sur$Result[is.na(sur$Result)] <- 1 # Replace missing values with 1. That will produce 0 g/d. | ||
Line 952: | Line 962: | ||
), | ), | ||
formula = function(...) { | formula = function(...) { | ||
out <- jsp[jsp$Question == " | out <- jsp[jsp$Question == "How.often" , ] | ||
out$Value <- round(result(out)) | out$Value <- round(result(out)) | ||
out <- merge( | out <- merge( | ||
Line 958: | Line 968: | ||
out@output | out@output | ||
) | ) | ||
out <- out[!colnames(out) %in% c("Value", "Variable", "Result")] | out <- out[!colnames(out) %in% c("Value", "Variable", "Result","Question")] | ||
colnames(out)[colnames(out) == "assumpResult"] <- "Result" | colnames(out)[colnames(out) == "assumpResult"] <- "Result" | ||
return(out) | return(out) | ||
Line 971: | Line 981: | ||
), | ), | ||
formula = function(...) { | formula = function(...) { | ||
out <- jsp[jsp$Question == " | out <- jsp[jsp$Question == "How.much" , ] | ||
out$Value <- round(result(out)) | out$Value <- round(result(out)) | ||
out <- merge( | out <- merge( | ||
Line 977: | Line 987: | ||
out@output | out@output | ||
) | ) | ||
out <- out[!colnames(out) %in% c("Value", "Variable", "Result")] | out <- out[!colnames(out) %in% c("Value", "Variable", "Result","Question")] | ||
colnames(out)[colnames(out) == "assumpResult"] <- "Result" | colnames(out)[colnames(out) == "assumpResult"] <- "Result" | ||
return(out) | return(out) | ||
Line 990: | Line 1,000: | ||
), | ), | ||
formula = function(...) { | formula = function(...) { | ||
out <- jsp[jsp$Question == " | out <- jsp[jsp$Question == "How.often.side" , ] | ||
out$Value <- round(result(out)) | out$Value <- round(result(out)) | ||
out <- merge( | out <- merge( | ||
Line 996: | Line 1,006: | ||
out@output | out@output | ||
) | ) | ||
out <- out[!colnames(out) %in% c("Value", "Variable", "Result")] | out <- out[!colnames(out) %in% c("Value", "Variable", "Result","Question")] | ||
colnames(out)[colnames(out) == "assumpResult"] <- "Result" | colnames(out)[colnames(out) == "assumpResult"] <- "Result" | ||
return(out) | return(out) | ||
Line 1,009: | Line 1,019: | ||
), | ), | ||
formula = function(...) { | formula = function(...) { | ||
out <- jsp[jsp$Question == " | out <- jsp[jsp$Question == "How.much.side" , ] | ||
out$Value <- round(result(out)) | out$Value <- round(result(out)) | ||
out <- merge( | out <- merge( | ||
Line 1,015: | Line 1,025: | ||
out@output | out@output | ||
) | ) | ||
out <- out[!colnames(out) %in% c("Value", "Variable", "Result")] | out <- out[!colnames(out) %in% c("Value", "Variable", "Result","Question")] | ||
colnames(out)[colnames(out) == "assumpResult"] <- "Result" | colnames(out)[colnames(out) == "assumpResult"] <- "Result" | ||
return(out) | return(out) | ||
Line 1,021: | Line 1,031: | ||
) | ) | ||
assump <- Ovariable( | |||
" | "assump", | ||
ddata = "Op_en7749", subset = "Assumptions for calculations" | |||
) | |||
effinfo <- Ovariable( # Effect of information | |||
"effinfo", | |||
dependencies = data.frame( | dependencies = data.frame( | ||
Name=c("jsp","assump"), | Name=c("jsp","assump"), | ||
Line 1,028: | Line 1,043: | ||
), | ), | ||
formula = function(...) { | formula = function(...) { | ||
away <- c("Value","Variable","Result","Question","assumpUnit","assumpSource","jspResult","jspSource") | |||
# Better availability of fish | |||
o1 <- jsp[jsp$Question == "Better.availability" , ] | |||
o1$Value <- round(result(o1)) | |||
o1 <- merge( | |||
assump@output[assump$Variable == "change",], | |||
o1@output | |||
) | |||
colnames(o1)[colnames(o1)=="assumpResult"] <- "Better.availabilityResult" | |||
o1 <- Ovariable(name="Better.availability", output=o1[!colnames(o1) %in% away]) | |||
# Less chemicals | |||
o2 <- jsp[jsp$Question == "Less.chemicals" , ] | |||
o2$Value <- round(result(o2)) | |||
o2 <- merge( | |||
assump@output[assump$Variable == "change",], | assump@output[assump$Variable == "change",], | ||
o2@output | |||
) | ) | ||
colnames(o2)[colnames(o2)=="assumpResult"] <- "Less.chemicalsResult" | |||
o2 <- Ovariable(name="Less.chemicals", output=o2[!colnames(o2) %in% away]) | |||
out <- (o1 + o2)@output | |||
return(Ovariable(output=out, marginal=colnames(out) %in% c("Iter","Fish"))) | |||
} | } | ||
) | ) | ||
effrecomm <- Ovariable( # Effect of recommendations | |||
" | "effrecomm", | ||
dependencies = data.frame( | dependencies = data.frame( | ||
Name=c("jsp","assump"), | Name=c("jsp","assump"), | ||
Line 1,047: | Line 1,076: | ||
), | ), | ||
formula = function(...) { | formula = function(...) { | ||
# Recommend more fish | |||
o1 <- jsp[jsp$Question == "Recommended" , ] | |||
o1$Value <- round(result(o1)) | |||
o1 <- merge( | |||
assump@output[assump$Variable == "change",], | |||
o1@output | |||
) | |||
colnames(o1)[colnames(o1)=="assumpResult"] <- "Result" | |||
o1$Recommendation <- "Eat more" | |||
# Recommend less fish | |||
o2 <- jsp[jsp$Question == "Not.recommended" , ] | |||
o2$Value <- round(result(o2)) | |||
o2 <- merge( | |||
assump@output[assump$Variable == "change",], | assump@output[assump$Variable == "change",], | ||
o2@output | |||
) | ) | ||
out <- | colnames(o2)[colnames(o2)=="assumpResult"] <- "Result" | ||
o2$Recommendation <- "Eat less" | |||
out <- rbind(o1, o2)[!colnames(o1) %in% | |||
c("Value","Variable","Question","assumpUnit","assumpSource","jspResult","jspSource") | |||
] | |||
return(Ovariable(output=out, marginal=colnames(out) %in% c("Iter","Fish","Recommendation"))) | |||
} | } | ||
) | ) | ||
amountRaw <- Ovariable( | |||
" | "amountRaw", | ||
dependencies = data.frame(Name = c( | dependencies = data.frame(Name = c( | ||
"often", | "often", | ||
Line 1,071: | Line 1,111: | ||
"oftenside", | "oftenside", | ||
"muchside", | "muchside", | ||
"assump | "assump" | ||
)), | )), | ||
formula = function(...) { | formula = function(...) { | ||
away <- c( | away <- c( | ||
"assumpUnit", | "assumpUnit", | ||
"jspResult", | "jspResult", | ||
"jspSource", | "jspSource", | ||
Line 1,094: | Line 1,129: | ||
out <- (often * much + oftenside * muchside * assump)/365 # g /d | out <- (often * much + oftenside * muchside * assump)/365 # g /d | ||
out <- out * (1 + | return(out) | ||
} | |||
) | |||
amount <- Ovariable( | |||
"amount", | |||
dependencies = data.frame(Name = c( | |||
"amountRaw", | |||
"effinfo", | |||
"effrecomm" | |||
)), | |||
formula = function(...) { | |||
out <- amountRaw * (1 + effinfo + effrecomm) | |||
result(out)[result(out)<0] <- 0 | result(out)[result(out)<0] <- 0 | ||
return(out) | return(out) | ||
Line 1,100: | Line 1,148: | ||
) | ) | ||
objects.store( | rm(wiki_username) | ||
cat("Ovariables | objects.store(list=ls()) | ||
cat("Ovariables", ls(), "stored.\n") | |||
</rcode> | </rcode> | ||
Revision as of 11:08, 1 March 2018
This page is a study.
The page identifier is Op_en7749 |
---|
Moderator:Arja (see all) |
This page is a stub. You may improve it into a full page. |
Upload data
|
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
Original questionnaire analysis results
- 13.3.2017 ----#: . These should be presented somewhere --Arja (talk) 07:39, 26 April 2017 (UTC) (type: truth; paradigms: science: comment)
Consumption amount estimates
- Model run 21.4.2017 [1] first distribution
- Model run 18.5.2017 with modelled data; with direct survey data
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 can be found from the link below (see Data).
Data
Questionnaire
Original datafile File:Goherr fish consumption.csv.
Show details | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
Assumptions
The following assumptions are used:
Obs | Variable | Value | Unit | Result | Description |
---|---|---|---|---|---|
1 | freq | 1 | times /a | 0 | Never |
2 | freq | 2 | times /a | 0.5 - 0.9 | less than once a year |
3 | freq | 3 | times /a | 2 - 5 | A few times a year |
4 | freq | 4 | times /a | 12 - 36 | 1 - 3 times per month |
5 | freq | 5 | times /a | 52 | once a week |
6 | freq | 6 | times /a | 104 - 208 | 2 - 4 times per week |
7 | freq | 7 | times /a | 260 - 364 | 5 or more times per week |
8 | amdish | 1 | g /serving | 20 - 70 | 1/6 plate or below (50 grams) |
9 | amdish | 2 | g /serving | 70 - 130 | 1/3 plate (100 grams) |
10 | amdish | 3 | g /serving | 120 - 180 | 1/2 plate (150 grams) |
11 | amdish | 4 | g /serving | 170 - 230 | 2/3 plate (200 grams) |
12 | amdish | 5 | g /serving | 220 - 280 | 5/6 plate (250 grams) |
13 | amdish | 6 | g /serving | 270 - 400 | full plate (300 grams) |
14 | amdish | 7 | g /serving | 400 - 550 | overly full plate (500 grams) |
15 | ingredient | fraction | 0.1 - 0.3 | Fraction of fish in the dish | |
16 | amside | 1 | g /serving | 20 - 70 | 1/6 plate or below (50 grams) |
17 | amside | 2 | g /serving | 70 - 130 | 1/4 plate (100 grams) |
18 | amside | 3 | g /serving | 120 - 180 | 1/2 plate (150 grams) |
19 | amside | 4 | g /serving | 170 - 230 | 2/3 plate (200 grams) |
20 | amside | 5 | g /serving | 220 - 280 | 5/6 plate (250 grams) |
21 | change | 1 | fraction | -1 - -0.8 | Decrease it to zero |
22 | change | 2 | fraction | -0.9 - -0.5 | Decrease it to less than half |
23 | change | 3 | fraction | -0.6 - -0.1 | Decrease it a bit |
24 | change | 4 | fraction | 0 | No effect |
25 | change | 5 | fraction | 0.1 - 0.6 | Increase it a bit |
26 | change | 6 | fraction | 0.5 - 0.9 | Increase it over by half |
27 | change | 7 | fraction | 0.8 - 1.3 | Increase it over to double |
28 | change | 8 | fraction | -0.3 - 0.3 | Don't know |
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. The code stores a data.frame named survey.
- Model run 26.2.2018 [2]
Analyses
Descriptive statistics

Model must contain predictors such as country, gender, age etc. Maybe we should first study what determinants are important? Model must also contain determinants that would increase or decrease fish consumption. This should be conditional on the current consumption. How? Maybe we should look at principal coordinates analysis with all questions to see how they behave.
Also look at correlation table to see clusters.
Some obvious results:
- If reports no fish eating, many subsequent answers are NA.
- No vitamins correlates negatively with vitamin intake.
- Unknown salmon correlates negatively with the types of salmon eaten.
- Different age categories correlate with each other.
However, there are also meaningful negative correlations:
- Country vs allergy
- Country vs Norwegian salmon and Rainbow trout
- Country vs not traditional.
- Country vs recommendation awareness
- Allergy vs economic wellbeing
- Baltic salmon use (4 questions) vs Don't like taste and Not used to
- All questions between Easy to cook ... Traditional dish
Meaningful positive correlations:
- All questions between Baltic salmon ... Rainbow trout
- How often Baltic salmon/herring/side salmon/side herring
- How much Baltic salmon/herring/side salmon/side herring
- Better availability ... Recommendation
- All questions between Economic wellbeing...Personal aims
- Omega3, Vitamin D, and Other vitamins
Model runs
- Model run 13.3.2017
- Model run 21.4.2017 [3] old code from Answer merged to this code and debugged
Bayes model
- Model run 3.3.2017. All variables assumed independent. [4]
- Model run 3.3.2017. p has more dimensions. [5]
- Model run 25.3.2017. Several model versions: strange binomial+multivarnormal, binomial, fractalised multivarnormal [6]
- Model run 27.3.2017 [7]
- Other models except multivariate normal were archived and removed from active code 29.3.2017.
- Model run 29.3.2017 with raw data graphs [8]
- Model run 29.3.2017 with salmon and herring ovariables stored [9]
- Model run 13.4.2017 with first version of coordinate matrix and principal coordinate analysis [10]
- Model run 20.4.2017 [11] code works but needs a safety check against outliers
- Model run 21.4.2017 [12] some model results plotted
- Model run 21.4.2017 [13] ovariables produced by the model stored.
- Model run 18.5.2017 [14] small updates
- 13.2.2018 old model run but with new Opasnet [15]
Initiate ovariables
Amount estimated from a bayesian model.
- Model run 24.5.2017 [16]
Amount estimates directly from data rather than from a bayesian model.
- Initiation run 18.5.2017 [17]
- Initiation run 24.2.2018: sampling from survey rather than each respondent once [18]
Initiate other ovariables
- Code stores ovariables assump, often, much, oftenside, muchside, amount.
- Model run 19.5.2017 [19]
- Initiation run 24.5.2017 without jsp [20]
- Model run 8.6.2017 [21]
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.
See also
- Useful information about Wishart distribution and related topics:
Keywords
References
Related files