Difference between revisions of "Training health impact"

From Testiwiki
Jump to: navigation, search
(update does not work here, otherwise promising)
(Explanations: the whole section is outdated and removed)
 
(21 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
[[Category:Costs and valuations]]
 
[[Category:Costs and valuations]]
 
[[Category:Opasnet training]]
 
[[Category:Opasnet training]]
 +
[[Category:Contains R code]]
 
{{variable|moderator=Jouni|stub=Yes}}
 
{{variable|moderator=Jouni|stub=Yes}}
  
Line 9: Line 10:
 
== Answer ==
 
== Answer ==
  
There is no data; the answer is based on modelling only.
+
<rcode graphics=1>
  
<rcode
+
library(OpasnetUtils)
name="answer"
+
library(ggplot2)
label="Run code"
 
include="
 
page:Object-oriented_programming_in_Opasnet|name:answer|
 
page:OpasnetBaseUtils|name:generic|
 
page:Training_health_impact|name:formula
 
"
 
>
 
  
cat("Initiation successful. Now starting the model.\n")
+
objects.latest("Op_en5675", code_name = "initiate") # [[Training health impact]]
  
library(xtable)
+
health_impact <- EvalOutput(health_impact)
out <- make.ovariable(
+
 
data = NULL,
+
oprint(summary(health_impact))
formula = formula.Op_en5675,
+
 
dependencies = dependencies.Op_en5675)
+
ggplot(health_impact@output, aes(x = health_impactResult, colour = Year)) +
cat("Computing training exposures.\n")
+
geom_density() +
print(out)
+
facet_grid(Trait ~ Year) +
 +
theme_grey(base_size = 24)
  
 
</rcode>
 
</rcode>
  
 +
==Rationale==
 +
 +
===Data===
 +
 +
<t2b index="Trait" obs="Result" desc="Description" unit="cases /(µg/m3) /a">
 +
Respiratory disease|20 - 30|
 +
</t2b>
  
== Rationale ==
+
===Dependencies===
  
=== Formula ===
+
* [[Training exposure]]
  
<rcode
+
===Calculations===
name="formula"
 
label="Initiate functions"
 
include="
 
page:Object-oriented_programming_in_Opasnet|name:answer|
 
page:OpasnetBaseUtils|name:generic|
 
page:Training_exposure|name:formula
 
"
 
variables="name:population|description:What is the size of the population|default:100000"
 
>
 
  
dependencies.Op_en5675 <- list(
+
<rcode label="Initiate ovariable" name="initiate">
exposure = formula.Op_en5674(dependencies.Op_en5674), # Training exposure
 
erf = data.frame(Unit = "RR per ug/m3", Result = 1.5),
 
population = population,
 
background = 100 / 100000 # cases per 100000 person-years
 
)
 
  
formula.Op_en5675 <- function(x) {
+
library(OpasnetUtils)
cases <- x@population * x@background * exp(x@exposure * ln(x@erf))
 
return(cases)
 
}
 
  
cat("Initiation successful. Now starting the model.\n")
+
health_impact <- Ovariable("health_impact",
 +
dependencies = data.frame(Name = "exposure", Ident = "Op_en5674/initiate"), # [[Training exposure]] exposure
 +
formula = function(...) {
 +
ERF <- Ovariable("ERF", ddata = "Op_en5675") # [[Training health impact]]
 +
colnames(ERF@data) <- gsub("[ \\.]", "_", colnames(ERF@data))
  
library(xtable)
+
out <- exposure * ERF
out <- make.ovariable(
 
data = "0 - 100000",
 
formula = formula.Op_en5675,
 
dependencies = dependencies.Op_en5675)
 
cat("Computing training health impact.\n")
 
print(out)
 
  
########### update updates the sample of an ovariable based on data and function.
+
return(out)
setMethod(
 
f = "update",
 
signature = "ovariable",
 
definition = function(object) {
 
dat <- data.frame(Source = "Data", interpret(object@data))
 
dep <- object@dependencies
 
for(i in 1:length(dep)) {
 
if(class(dep[[i]]) == "ovariable") {
 
dep[[i]] <- dep[[i]]@sample
 
} else {
 
if(length(grep("Op_(en|fi)", dep[[i]])) > 0) {
 
dep[[i]] <- op_baseGetData("opasnet_base", dep[[i]])}
 
else {
 
if(class(dep[[i]]) != "data.frame" & !is.numeric(dep[[i]])) {
 
print(dep[[i]])
 
print(class(dep[[i]]))
 
dep[[i]] <- get(dep[[i]])
 
}
 
}
 
}
 
}
 
form <- data.frame(Source = "Formula", make.ovariable(object@formula(dep))@sample)
 
object@sample <- orbind(dat, form)@sample
 
return(object)
 
 
}
 
}
 
)
 
)
  
 +
objects.store(health_impact)
  
out <- update(out)
+
cat("Ovariable health_impact saved.\n")
print(out)
 
  
 
</rcode>
 
</rcode>
Line 116: Line 75:
  
 
==Related files==
 
==Related files==
 
{{mfiles}}
 

Latest revision as of 15:48, 24 March 2015



Question

What is the health impact in the Training assessment?

Answer

+ Show code

Rationale

Data

Difference between revisions of "Training health impact"(cases /(µg/m3) /a)
ObsTraitResultDescription
1Respiratory disease20 - 30

Dependencies

Calculations

+ Show code

See also

Materials and examples for training in Opasnet and open assessment
Help pages Wiki editingHow to edit wikipagesQuick reference for wiki editingDrawing graphsOpasnet policiesWatching pagesWriting formulaeWord to WikiWiki editing Advanced skills
Training assessment (examples of different objects) Training assessmentTraining exposureTraining health impactTraining costsClimate change policies and health in KuopioClimate change policies in Kuopio
Methods and concepts AssessmentVariableMethodQuestionAnswerRationaleAttributeDecisionResultObject-oriented programming in OpasnetUniversal objectStudyFormulaOpasnetBaseUtilsOpen assessmentPSSP
Terms with changed use ScopeDefinitionResultTool


Keywords

References


Related files