Training exposure: Difference between revisions

From Opasnet
Jump to navigation Jump to search
(works better)
 
(16 intermediate revisions by 3 users not shown)
Line 1: Line 1:
[[Category:Costs and valuations]]
[[Category:Costs and valuations]]
[[Category:Opasnet training]]
[[Category:Contains R code]]
{{variable|moderator=Jouni|stub=Yes}}
{{variable|moderator=Jouni|stub=Yes}}


Line 8: Line 10:
== Answer ==
== Answer ==


<t2b index="Year,Observation" locations="Unit,Result,Description" unit="-">
<rcode embed=1 graphics=1>
2012|ug/m3|1 - 2|
 
2020|ug/m3|10 - 11|
library(OpasnetUtils)
</t2b>
library(ggplot2)


objects.latest("Op_en5674", code_name = "initiate")
exposure
exposure <- EvalOutput(exposure) # for printing


<rcode
oprint(summary(exposure)) # fashionable design
name="answer"
label="Run code"
include="
page:Object-oriented_programming_in_Opasnet|name:answer|
page:OpasnetBaseUtils|name:generic|
page:Training_exposure|name:formula
"
>


out <- op_baseGetData("opasnet_base", "Op_en5674")
ggplot(exposure@output, aes(x = exposureResult, weight = 1, fill = Year)) +
colnames(out)[colnames(out) == "obs.1"] <- "Row"
geom_density() +
out <- tidy(out , direction = "wide")
theme_grey(base_size = 24)
print(out)
out <- make.ovariable(out)
cat("Computed training exposures.\n")
print(out)
print(formula.Op_en5674(dependencies.Op_en5674))
cat("Computed training exposures.\n")


</rcode>
</rcode>
Line 38: Line 29:
== Rationale ==
== Rationale ==


=== Formula ===
===Data===
 
<t2b index="Exposure agent,Year" obs="Result" desc="Description" unit="µg /m3">
PM2.5|2012|1 - 4|
PM2.5|2020|10 - 11|
</t2b>
 
=== Calculations ===


<rcode  
<rcode label="Initiate ovariable" name="initiate">
name="formula"
label="Initiate functions"  
include="
page:Object-oriented_programming_in_Opasnet|name:answer|
page:OpasnetBaseUtils|name:generic
"
>


cat("Initiation successful. Now starting the model.\n")
library(OpasnetUtils) # relevant libraries


############ tapply of ovariables applies a function to each cell of a ragged array, that is to each (non-empty) group of values given by a unique combination of the levels of certain factors.
# Define ovariable
### parameters (other parameters are as in generic tapply):
### X an ovariable


setMethod(f = "tapply",  
exposure <- Ovariable("exposure", ddata = "Op_en5674")
signature = signature(X = "ovariable"),
colnames(exposure@data) <- gsub("[ \\.]", "_", colnames(exposure@data))
definition = function(X, INDEX, FUN = NULL, ..., simplify = TRUE) {
out <- as.data.frame(as.table(tapply(X@sample$Result, INDEX, FUN, ..., simplify = TRUE)))
X@sample <- out
return(X)
}
)


formula.Op_en5674 <- function(x) {
objects.store(exposure) # save for later use
ueConc <- make.ovariable(x$microenvironment.concentration)
ueTime <- make.ovariable(x$microenvironment.time)
out <- ueConc * ueTime
out <- tapply(out, out@sample[c("Iter", "Unit")], sum)
return(out)
}


dependencies.Op_en5674 <- list(
cat("Ovariable exposure saved.\n")
microenvironment.concentration = data.frame(
Microenvironment = c("Home", "Other"),
Unit = "ug/m3",
Result = c(1, 2)),
microenvironment.time = data.frame(
Microenvironment = c("Home", "Other"),
Unit = "ug/m3",
Result = c(0.7, 0.3))
)


</rcode>
</rcode>
Line 87: Line 55:
==See also==
==See also==


{{urgenche}}
{{Opasnet training}}


==Keywords==
==Keywords==
Line 96: Line 64:


==Related files==
==Related files==
{{mfiles}}

Latest revision as of 08:18, 3 June 2015



Question

What is the exposure in the Training assessment?

Answer

+ Show code

Rationale

Data

Training exposure: Difference between revisions(µg /m3)
ObsExposure agentYearResultDescription
1PM2.520121 - 4
2PM2.5202010 - 11

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