Skip to content

Commit

Permalink
address #125 for residence regional name, but not a general-purpose s…
Browse files Browse the repository at this point in the history
…olution yet
  • Loading branch information
famulare committed Nov 26, 2019
1 parent 1e0eab5 commit e0e8d9d
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions incidenceMapR/R/smoothModel.R
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,21 @@ smoothModel <- function(db, shp, family = NULL, neighborGraph = NULL){
}
# site-location interaction
# COMMENTED CODE BELOW ALMOST CERTAINLY DOESN'T WORK! PLACEHOLDER FOR ISSUE #125.
# if('residence_regional_name' %in% names(inputData)){
# inputData$site_region_regionIdx <- inputData$residence_regional_nameRow
# inputData$site_region_siteIdx <- inputData$site_row_iid
#
# formula <- update(formula, ~ . + f(site_region_siteIdx, model='iid', diagonal=1e-3, hyper=modelDefinition$site_age, constr = TRUE, replicate=replicateIdx,
# group = site_region_regionIdx, control.group=list(model="iid")))
# }
if('residence_regional_name' %in% names(inputData)){
inputData$site_region_regionIdx <- inputData$residence_regional_nameRow
inputData$site_region_siteIdx <- inputData$site_row_iid

if(exists('shp')){
neighborGraph <- constructAdjacencyNetwork(shp)

formula <- update(formula, ~ . + f(site_region_siteIdx, model='bym2', graph=modelDefinition$neighborGraph, diagonal=1e-3, hyper=modelDefinition$local, constr = TRUE, replicate=replicateIdx,
group = site_region_regionIdx, control.group=list(model="iid")))

} else {
formula <- update(formula, ~ . + f(site_region_siteIdx, model='iid', diagonal=1e-3, hyper=modelDefinition$local, constr = TRUE, replicate=replicateIdx,
group = site_region_regionIdx, control.group=list(model="iid")))
}
}
}

if(COLUMN %in% c('residence_regional_name')){
Expand Down

0 comments on commit e0e8d9d

Please sign in to comment.