Difference between revisions of "Goherr: Fish consumption study"
m (→Preprocessing) |
(→Bayes model) |
||
Line 251: | Line 251: | ||
* Model run 29.3.2017 with raw data graphs [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=BB8nePJb7hzSw6Ha] | * Model run 29.3.2017 with raw data graphs [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=BB8nePJb7hzSw6Ha] | ||
* Model run 29.3.2017 with salmon and herring ovariables stored [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=2Hz4tYjrQLnUfIXw] | * Model run 29.3.2017 with salmon and herring ovariables stored [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=2Hz4tYjrQLnUfIXw] | ||
+ | * Model run 13.4.2017 with first version of coordinate matrix and principal coordinate analysis [http://en.opasnet.org/en-opwiki/index.php?title=Special:RTools&id=2k2dKhYPc2UkOCY5] | ||
<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 260: | Line 261: | ||
library(rjags) | library(rjags) | ||
library(car) | library(car) | ||
+ | library(vegan) | ||
+ | #library(gridExtra) # Error: package ‘gridExtra’ was built before R 3.0.0: please re-install it | ||
# Fish intake in humans | # Fish intake in humans | ||
Line 272: | Line 275: | ||
# Total amount eaten of each fish per modelled individual is finally calculated. | # Total amount eaten of each fish per modelled individual is finally calculated. | ||
− | objects.latest("Op_en7749", " | + | objects.latest("Op_en7749", "preprocess2") # [[Goherr: Fish consumption study]]: survey, surcol |
agel <- as.character(unique(survey$Ages)) | agel <- as.character(unique(survey$Ages)) | ||
Line 302: | Line 305: | ||
# BUT: there are so many missing values, that we just model BH and BS separately now. | # BUT: there are so many missing values, that we just model BH and BS separately now. | ||
− | surv$Ages <- match(surv$Ages, agel) # Not a factor, coerce to integer | + | #surv$Ages <- match(surv$Ages, agel) # Not a factor, coerce to integer |
surv <- as.data.frame(lapply(surv, FUN = function(x) as.integer(x))) # Coerce to integers | surv <- as.data.frame(lapply(surv, FUN = function(x) as.integer(x))) # Coerce to integers | ||
surv[is.na(surv[[12]]) | surv[[12]] == 3 , 12] <- 1 # Eat Baltic herring: I don't know --> No | surv[is.na(surv[[12]]) | surv[[12]] == 3 , 12] <- 1 # Eat Baltic herring: I don't know --> No | ||
Line 462: | Line 465: | ||
musides <- Ovariable("musides", data = jhm[jsm$Question == 4, 2:3]) | musides <- Ovariable("musides", data = jhm[jsm$Question == 4, 2:3]) | ||
− | objects.store(oftenh, muchh, ofsideh, musideh, oftens, muchs, ofsides, musides) | + | #objects.store(oftenh, muchh, ofsideh, musideh, oftens, muchs, ofsides, musides) |
− | cat("Ovariables oftenh, muchh, ofsideh, musideh, oftens, muchs, ofsides, musides stored.\n") | + | #cat("Ovariables oftenh, muchh, ofsideh, musideh, oftens, muchs, ofsides, musides stored.\n") |
+ | |||
+ | ##################### CORRELATION MATRIX | ||
+ | |||
+ | temp <- sapply(survey, as.numeric) # Can be done for surv to get a smaller matrix | ||
+ | |||
+ | survey_correlations <- (cor(temp, method="spearman", use="pairwise.complete.obs")) | ||
+ | |||
+ | temp <- colnames(survey_correlations) | ||
+ | |||
+ | melted_correlations <- melt(survey_correlations) | ||
+ | |||
+ | melted_correlations$Var1 <- factor(melted_correlations$Var1, levels=temp) | ||
+ | melted_correlations$Var2 <- factor(melted_correlations$Var2, levels=temp) | ||
+ | melted_correlations$value <- ifelse(melted_correlations$value >= 0.99,NA,melted_correlations$value) | ||
+ | |||
+ | ggplot(melted_correlations, aes(x = Var1, y = Var2, fill = value, label= round(value, 2)))+ | ||
+ | geom_raster()+ | ||
+ | theme(axis.text.x=element_text(angle=90,hjust=1,vjust=0.4))+ | ||
+ | scale_fill_gradient2(low = "#480610", mid = "#FFFFFF", high = "#06480F", midpoint = 0, space = "Lab", guide = "colourbar") | ||
+ | |||
+ | ############################### PRINCIPAL COORDINATE ANALYSIS (PCoA) | ||
+ | |||
+ | #tämä osa valmistaa sen datan. | ||
+ | hypocols1 <- c(46:49,95:98) | ||
+ | answ <- sapply(survey[hypocols1], FUN=as.numeric) | ||
+ | answ <- as.matrix(answ[!is.na(rowSums(answ)),]) | ||
+ | |||
+ | pcoa_caps <- capscale(t(answ) ~ 1, distance="euclidean") ##PCoA done | ||
+ | |||
+ | ## Kuva koko hypoteeseista | ||
+ | |||
+ | traits <- as.factor(c(rep("bipedalism", 10), rep("brain", 10), rep("hairlessness", 8), | ||
+ | rep("fat", 4), rep("larynx", 3), rep("speech", 7), rep("other", 9))) | ||
+ | colstr <- c("palevioletred1","royalblue1","seagreen1","violet","khaki2","skyblue", "orange") | ||
+ | trait.cols <- colstr[traits] | ||
+ | |||
+ | hypo_sizes <- (5 - colMeans(answ)) | ||
+ | leg_sizes <- c(4, 3, 2, 1, 0.01) | ||
+ | |||
+ | #pdf(file="pcoa_plot.pdf", height=6, width=7.5) | ||
+ | plot(pcoa_caps, display = c("sp", "wa"), type="n")#, xlim=c(-6,4.5)) ## PCoA biplot, full scale | ||
+ | points(pcoa_caps, display= c("sp"), col="gray40") # adding the people points | ||
+ | points(pcoa_caps, display= c("wa"), pch=19)#, cex=hypo_sizes, col=trait.cols) | ||
+ | text(pcoa_caps, display=c("wa"), srt=25, cex=0.5) | ||
+ | #legend(x=-6, y=3.8, levels(traits), fill=colstr, bty="n", cex=1) | ||
+ | #legend(-6, -2, legend=c("Very likely", "Moderately likely", | ||
+ | # "No opinion", "Moderately unlikely", "Very unlikely"), | ||
+ | # pch=21, pt.cex = leg_sizes, bty="n", cex=1) | ||
+ | #dev.off() | ||
+ | |||
</rcode> | </rcode> | ||
Revision as of 16:50, 13 April 2017
This page is a variable.
The page identifier is Op_en7749 |
---|
Moderator:Arja (see all) |
This page is a stub. You may improve it into a full page, and then a rating bar will appear here. |
Upload data
|
Contents
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.
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. The code stores a data.frame named survey.
- Model run 13.4.2017 [1]
Analyses
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
Study plan:
- Determinants
Bayes model
- Model run 3.3.2017. All variables assumed independent. [2]
- Model run 3.3.2017. p has more dimensions. [3]
- Model run 25.3.2017. Several model versions: strange binomial+multivarnormal, binomial, fractalised multivarnormal [4]
- Model run 27.3.2017 [5]
- Other models except multivariate normal were archived and removed from active code 29.3.2017.
- Model run 29.3.2017 with raw data graphs [6]
- Model run 29.3.2017 with salmon and herring ovariables stored [7]
- Model run 13.4.2017 with first version of coordinate matrix and principal coordinate analysis [8]
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.
Assumptions
The following assumptions are used:
Obs | Variable | value | Explanation | Result |
---|---|---|---|---|
1 | freq | 6 | times per year | 260 - 364 |
2 | freq | 5 | times per year | 104 - 208 |
3 | freq | 4 | times per year | 52 |
4 | freq | 3 | times per year | 12 - 36 |
5 | freq | 2 | times per year | 2 - 5 |
6 | freq | 1 | times per year | 0.5 - 0.9 |
7 | freq | 0 | times per year | 0 |
8 | amdish | 0 | grams / serving | 20 - 50 |
9 | amdish | 1 | grams / serving | 70 - 100 |
10 | amdish | 2 | grams / serving | 120 - 150 |
11 | amdish | 3 | grams / serving | 170 - 200 |
12 | amdish | 4 | grams / serving | 220 - 250 |
13 | amdish | 5 | grams / serving | 270 - 300 |
14 | amdish | 6 | grams / serving | 450 - 500 |
15 | ingridient | fraction | 0.1 - 0.3 | |
16 | amside | 0 | grams / serving | 20 - 50 |
17 | amside | 1 | grams / serving | 70 - 100 |
18 | amside | 2 | grams / serving | 120 - 150 |
19 | amside | 3 | grams / serving | 170 - 200 |
20 | amside | 4 | grams / serving | 220 - 250 |
Questionnaire
Show details | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
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
- Useful information about Wishart distribution and related topics:
Keywords
References
Related files
<mfanonymousfilelist></mfanonymousfilelist>