Consumption of Baltic herring in Finland: Difference between revisions
Jump to navigation
Jump to search
(code copied) |
m (→Answer) |
||
(One intermediate revision by the same user not shown) | |||
Line 8: | Line 8: | ||
== Answer == | == Answer == | ||
[[File:Consumption of Baltic herring by sex and age.png|450px]] | |||
<rcode embed=1 graphics=1> | |||
# This is code Op_en7403/answer on page [[Consumption of Baltic herring in Finland]] | |||
library(OpasnetUtils) | |||
library(ggplot2) | |||
objects.latest("Op_en6007", code_name = "answer") # OpasnetUtils/Drafts | |||
objects.latest("Op_en7403", code_name = "amount") # [[Consumption of Baltic herring in Finland]] | |||
amount <- EvalOutput(amount) | |||
amount$Age_group <- cut(as.numeric(as.character(amount$Ikä)), c(0, 20, 65, 80), include.lowest = TRUE) | |||
ggplot(amount@output, aes(x = amountResult, colour = Age_group)) + stat_ecdf(size = 2) + | |||
facet_wrap( ~ Sukupuoli) + scale_x_log10() + theme_gray(base_size = 24) + | |||
labs( | |||
title = "Baltic herring consumption by sex and age", | |||
colour = "Age group", | |||
x = "Consumption (g/d)", | |||
y = "Cumulative probability distribution" | |||
) | |||
</rcode> | |||
== Rationale == | == Rationale == | ||
Line 15: | Line 37: | ||
=== Calculations === | === Calculations === | ||
<rcode name="amount" label="Initiate amount (for developers only)"> | <rcode name="amount" label="Initiate amount (for developers only)" embed=1> | ||
#This code is | #This code is Op_en7403/amount on page [[Consumption of Baltic herring in Finland]] | ||
library(OpasnetUtils) | library(OpasnetUtils) | ||
Line 72: | Line 94: | ||
# lyhyt = lyhyt lista yksilökohtaisia määrittelyjä eli vain välttämättömät. | # lyhyt = lyhyt lista yksilökohtaisia määrittelyjä eli vain välttämättömät. | ||
lyhyt <- silakka[c("Age", "Ikä", "Hedelm", "Sukupuoli", "Rivi", "Maakunta")] | lyhyt <- silakka[c("Age", "Ikä", "Hedelm", "Sukupuoli", "Rivi", "Maakunta", "Rannikko")] | ||
kokoaik <- Ovariable("kokoaik", data = data.frame( | kokoaik <- Ovariable("kokoaik", data = data.frame( | ||
Line 187: | Line 209: | ||
out <- out + kouluruokailut * annos * into / 91 | out <- out + kouluruokailut * annos * into / 91 | ||
# Muutetaan Age ja Maakunta epävarmaksi eli ei-marginaaliksi | # Muutetaan Age ja Maakunta epävarmaksi eli ei-marginaaliksi | ||
out@marginal[colnames(out@output) %in% c("Age", "Maakunta")] <- FALSE | colnames(out@output)[colnames(out@output) == "Ikä"] <- "Ikä" | ||
# Sukupuoli ja Hedelm pidetään indekseinä koska niiden mukaan arvottiin | out@marginal[colnames(out@output) %in% c("Age", "Ikä", "Maakunta", "Rannikko")] <- FALSE | ||
out <- unkeep(out, cols = c("Rivi | # Sukupuoli ja Hedelm pidetään indekseinä koska niiden mukaan arvottiin | ||
out <- unkeep(out, cols = c("Rivi", "Arvo"), prevresults = TRUE, sources = TRUE) | |||
result(out)[result(out) == 0] <- 0.01 # Ei jätetä nollia saantiin | result(out)[result(out) == 0] <- 0.01 # Ei jätetä nollia saantiin | ||
Line 216: | Line 239: | ||
"kouluruokailut", | "kouluruokailut", | ||
"annos", | "annos", | ||
"into" | "into", | ||
"amount" | |||
) | ) | ||
cat("Objects | cat("Objects | ||
kokoaik, | |||
silakoita, | silakoita, | ||
silakanpaino, | silakanpaino, | ||
Line 227: | Line 252: | ||
kouluruokailut, | kouluruokailut, | ||
annos, | annos, | ||
into | into, | ||
amount | |||
stored,\n") | stored,\n") | ||
</rcode> | </rcode> |
Latest revision as of 23:31, 19 October 2015
Moderator:Jouni (see all) |
|
Upload data
|
Consumption of Baltic herring in Finland describes Baltic herring consumption by age, sex, and district.
Question
What is the Baltic herring consumption in Finland in different subgroups?
Answer
Rationale
Answer is based on an interview to random 2042 individuals in Finland in 2003.