diff --git a/DESCRIPTION b/DESCRIPTION index 58a7ceb..d9934c0 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,8 +1,8 @@ Package: ITHIM Type: Package Title: The Integrated Transport and Health Impacts Model -Version: 0.5.2 -Date: 2017-05-22 +Version: 0.5.3 +Date: 2017-06-08 Author: Samuel G. Younkin Maintainer: Samuel G. Younkin Description: Implements the Integrated Transport and Health Impacts diff --git a/R/functions-ITHIM.R b/R/functions-ITHIM.R index ea522b1..b677702 100644 --- a/R/functions-ITHIM.R +++ b/R/functions-ITHIM.R @@ -23,7 +23,7 @@ createITHIMFunction <- function(roadInjuriesFile = system.file("roadInjuriesUS.c safetyInNumbersFile = system.file("SiN.csv", package = "ITHIM"), FFile = system.file("F.csv",package = "ITHIM"), meanType = "overall"){ - + new("ITHIM", parameters = parameters <- createParameterList( activeTransportTimeFile = activeTransportTimeFile, distRoadTypeFile = distRoadTypeFile, @@ -83,25 +83,26 @@ createParameterList <- function( cvNonTravel <- 1 # coefficient of variation for leisure activity roadInjuries <- array() modeNames <- unlist(unique(lapply(roadInjuries, rownames))) - + # read safetyInNumbers using helper function which converts "normalize" csv into array safetyInNumbers <- readSafetyInNumbers(file = safetyInNumbersFile) - + # read distRoadType using helper function which converts "normalize" csv into array - + distRoadType <- readDistByRoadType(file = distRoadTypeFile) GBD <- readGBD(filename = GBDFile) - F <- readF(filename = FFile) + N <- readF(filename = FFile) + P <- N/sum(N) if( meanType == "referent" ){ muwt <- Mwt[3,2] muct <- Mct[3,2] }else if( meanType == "overall" ){ - muwt <- sum(F*Mwt) - muct <- sum(F*Mct) + muwt <- sum(P*Mwt) + muct <- sum(P*Mct) }else{ stop("Wrong meanType value.") } @@ -120,7 +121,7 @@ createParameterList <- function( muNonTravel = muNonTravel, muNonTravelMatrix = muNonTravelMatrix, GBD = GBD, - F = F, + F = N, meanType = meanType, quantiles = quantiles, roadInjuries = roadInjuries, diff --git a/inst/F-old.csv b/inst/F-old.csv new file mode 100644 index 0000000..6a8833a --- /dev/null +++ b/inst/F-old.csv @@ -0,0 +1,17 @@ +ageClass,sex,value +ageClass1,M,0.03535189 +ageClass2,M,0.06777091 +ageClass3,M,0.10827214 +ageClass4,M,0.10078132 +ageClass5,M,0.10124053 +ageClass6,M,0.04297974 +ageClass7,M,0.02363664 +ageClass8,M,0.01303553 +ageClass1,F,0.03373200 +ageClass2,F,0.06460902 +ageClass3,F,0.10256596 +ageClass4,F,0.09961365 +ageClass5,F,0.10519989 +ageClass6,F,0.04766630 +ageClass7,F,0.02974551 +ageClass8,F,0.02379898 diff --git a/inst/F.csv b/inst/F.csv index 6a8833a..64c6791 100644 --- a/inst/F.csv +++ b/inst/F.csv @@ -1,17 +1,17 @@ ageClass,sex,value -ageClass1,M,0.03535189 -ageClass2,M,0.06777091 -ageClass3,M,0.10827214 -ageClass4,M,0.10078132 -ageClass5,M,0.10124053 -ageClass6,M,0.04297974 -ageClass7,M,0.02363664 -ageClass8,M,0.01303553 -ageClass1,F,0.03373200 -ageClass2,F,0.06460902 -ageClass3,F,0.10256596 -ageClass4,F,0.09961365 -ageClass5,F,0.10519989 -ageClass6,F,0.04766630 -ageClass7,F,0.02974551 -ageClass8,F,0.02379898 +ageClass1,M,35351 +ageClass2,M,67770 +ageClass3,M,108272 +ageClass4,M,100781 +ageClass5,M,101240 +ageClass6,M,42979 +ageClass7,M,23636 +ageClass8,M,13035 +ageClass1,F,33732 +ageClass2,F,64609 +ageClass3,F,102565 +ageClass4,F,99613 +ageClass5,F,105199 +ageClass6,F,47666 +ageClass7,F,29745 +ageClass8,F,23798