Skip to content

Commit

Permalink
exporting namespace and fixing examples for new sweep fn
Browse files Browse the repository at this point in the history
  • Loading branch information
mponce0 committed Jul 24, 2020
1 parent fb9af2d commit d5c2680
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 11 deletions.
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,10 @@ export(itrends)
export(live.map)
export(mtrends)
export(plt.SIR.model)
export(preProcessingData)
export(report.summary)
export(single.trend)
export(sweep.SIR.models)
export(totals.plt)
export(tots.per.location)
importFrom(ape,read.GenBank)
Expand Down
2 changes: 1 addition & 1 deletion NEWS
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Jul 2020:
- Adding a new function, swipe_R0 for generating a range of values for R0 based on the starting date t0 to consider for the SIR model
- Adding a new function, sweep.SIR.models for generating a range of values for R0 based on the starting date t0 to consider for the SIR model

Jul 2020: Several new features and bugs fixes _ ver 1.1.1
- added new geographical categories to select data per continents, implemented via geographicalRegions() fn
Expand Down
3 changes: 2 additions & 1 deletion R/aux_utils.R
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ preProcessingData <- function(data0,geo.loc){
#' @param data0 data set
#' @param geo.loc geopgraphical location, can be a country, region, province or city
#'
#' @keywords internal
#' #@keywords internal
#' @export
#'

# define first column of data
Expand Down
18 changes: 9 additions & 9 deletions R/covid19_models.R
Original file line number Diff line number Diff line change
Expand Up @@ -424,7 +424,7 @@ plt.SIR.model <- function(SIR.model, geo.loc="",
#######################################################################


sweep_R0 <- function(data=NULL, geo.loc="Hubei",
sweep.SIR.models <- function(data=NULL, geo.loc="Hubei",
t0_range=15:20,
t1=NULL, deltaT=NULL,
tfinal=90,
Expand All @@ -433,27 +433,27 @@ sweep_R0 <- function(data=NULL, geo.loc="Hubei",

#' function to perform a sweep of models and generate values of R0
#'
#' @keywords export
#' @export
#'
#' @examples
#'
#' #TS read data
#' # read TimeSeries data
#' TS.data <- covid19.data("TS-confirmed")
#' #select a location of interest, eg. France
#' # select a location of interest, eg. France
#' # France has many entries, just pick "la France"
#' France.data <- TS.data[ (TS.data$Country.Region == "France") & (TS.data$Province.State == ""),]
#' # sweep values of R0 based on range of dates to consider for the model
#' ranges <- 15:20
#' params_sweep <- sweep_R0(data=FR.data,geo.loc="France", t0_range=ranges)
#' # R0s
#' deltaT <- 20
#' params_sweep <- sweep.SIR.models(data=France.data,geo.loc="France", t0_range=ranges, deltaT=deltaT)
#' # obtain the R0 values from the parameters
#' R0s <- unlist(params_sweep["R0",])
#' # nbr of infected cases
#' FR.infs<- preProcessingData(FR.data,"France")
#' FR.infs<- preProcessingData(France.data,"France")
#' # average per range
#' # define ranges
#' lst.ranges <- lapply(ranges, function(x) x:(x+deltaT))
#' # compute averages
#' avg.FR.infs <- lapply(lst.ranges, function(x) mean(FRf[x]))
#' avg.FR.infs <- lapply(lst.ranges, function(x) mean(FR.infs[x]))
#' # plots
#' plot(R0s, type='b')
#' # plot vs average number of infected cases
Expand Down

0 comments on commit d5c2680

Please sign in to comment.