Skip to content

Commit

Permalink
Merge pull request syounkin#11 from ITHIM/populationSize-#7
Browse files Browse the repository at this point in the history
Population size syounkin#7
  • Loading branch information
syounkin authored Jun 9, 2017
2 parents 29f0ad2 + b5277b5 commit c7b3ae3
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 26 deletions.
4 changes: 2 additions & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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 <[email protected]>
Maintainer: Samuel G. Younkin <[email protected]>
Description: Implements the Integrated Transport and Health Impacts
Expand Down
17 changes: 9 additions & 8 deletions R/functions-ITHIM.R
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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.")
}
Expand All @@ -120,7 +121,7 @@ createParameterList <- function(
muNonTravel = muNonTravel,
muNonTravelMatrix = muNonTravelMatrix,
GBD = GBD,
F = F,
F = N,
meanType = meanType,
quantiles = quantiles,
roadInjuries = roadInjuries,
Expand Down
17 changes: 17 additions & 0 deletions inst/F-old.csv
Original file line number Diff line number Diff line change
@@ -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
32 changes: 16 additions & 16 deletions inst/F.csv
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit c7b3ae3

Please sign in to comment.