Skip to content

Commit 40c7598

Browse files
author
Leo Bastos
committed
Descriptio et al
1 parent 74ca32d commit 40c7598

File tree

11 files changed

+26
-15
lines changed

11 files changed

+26
-15
lines changed

DESCRIPTION

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,10 @@
11
Package: nowcaster
22
Title: Nowcaster
3-
Version: 0.3.3
3+
Version: 1.0.0
44
Authors@R: c(
5-
person("Rafael", "Lopes", , "rafael.lp.silva@unesp.br", role = c("aut", "cre"),
5+
person("Rafael", "Lopes", , "rafael.lopes@yale.edu", role = c("aut", "cre"),
6+
comment = c(ORCID = "0000-0002-9416-6145")),
7+
person("Tatiana", "Portella", , "tatiana.portella@fiocruz.br", role = c("aut"),
68
comment = c(ORCID = "0000-0002-9416-6145")),
79
person("Leonardo", "Bastos", , "leonardo.bastos@fiocruz.br", role = c("aut"),
810
comment = c(ORCID = "0000-0002-1406-0122")))

R/data_w.R

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,11 +13,12 @@
1313
#' @param use.epiweek If TRUE, it uses the CDC epiweek definition where the week starts on Sunday, if FALSE it the week ends at the weekday of the last record date.
1414
#' @param K How much weeks to forecast ahead?
1515
#' [Default] K is 0, no forecasting ahead
16+
#' @param silent [Deprecated] to be removed.
1617
#'
1718
#' @return Data in weeks format, with the maximum dates for the last week used
1819
#' @export
1920
#'
20-
#' @examples If the last data is at a Sunday, so the weel starts at Monday before.
21+
#' @examples If the last data is at a Sunday, so the week starts at Monday before.
2122
#' If ends at Thursday, so it starts on the Friday before
2223
data.w <- function(dataset,
2324
trim.data,

R/data_w_no_age.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#' @param use.epiweek If TRUE, it uses the CDC epiweek definition where the week starts on Sunday, if FALSE it the week ends at the weekday of the last record date.
1212
#' @param K How much weeks to forecast ahead?
1313
#' [Default] K is 0, no forecasting ahead
14+
#' @param silent [Deprecated] to be removed.
1415
#'
1516
#' @return Data in weeks format, with the maximum dates for the last week used
1617
#' @export

R/nowcasting.summary.R

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
#' 'LSb' upper limit, 50% CI
1414
#' 'LIb' lower limit, 50% CI
1515
#' @export
16-
nowcasting.summary <- function(trajetory, age = F){
16+
nowcasting.summary <- function(trajectory, age = F){
1717

18-
total.summy <- trajetory |>
18+
total.summy <- trajectory |>
1919
dplyr::group_by(Time, dt_event, sample) |>
2020
dplyr::summarise(Y = sum(Y, na.rm = T)) |>
2121
dplyr::group_by(Time, dt_event) |>
@@ -26,7 +26,7 @@ nowcasting.summary <- function(trajetory, age = F){
2626
LSb = stats::quantile(Y, probs = 0.75, na.rm = T),
2727
.groups = "drop")
2828
if(age){
29-
age.summy <- trajetory |>
29+
age.summy <- trajectory |>
3030
dplyr::group_by(Time, dt_event, fx_etaria, fx_etaria.num) |>
3131
dplyr::summarise(Median = stats::median(Y, na.rm = T),
3232
LI = stats::quantile(Y, probs = 0.025, na.rm = T),

R/nowcasting_age.R

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#' @param dataset data pre formatted in to age classes and delays by week for each cases, delay triangle format
77
#' @param timeREmodel Latent model for time random effects.
88
#' [Default] is a second-order random walk model.
9+
#' @param zero_inflated [Experimental] It deals with zero-inflated data by using a zeroinflatednbinomial2 model.
910
#' @param INLAoutput return the INLA output. [Default] is FALSE.
1011
#' @param INLAoutputOnly return the only the INLA output. [Default] is FALSE.
1112
#' @param WAIC return the WAIC. [Default] is FALSE.
@@ -24,8 +25,8 @@ nowcasting_age <- function(dataset,
2425
family <- "zeroinflatednbinomial2"
2526
control.family <- list(
2627
hyper = list("theta1" = list(prior = "loggamma",
27-
param = c(0.01, 0.01)),
28-
# INLA defaulf fro a
28+
param = c(0.001, 0.001)),
29+
# INLA default fro a
2930
"theta2" = list(prior = "gaussian",
3031
param = c(2, 1)))
3132
)
@@ -86,7 +87,9 @@ nowcasting_age <- function(dataset,
8687
vector.samples0 <- lapply(X = srag.samples0.list,
8788
FUN = function(x, idx = index.missing){
8889
if(zero_inflated){
89-
unif.log <- as.numeric(stats::runif(idx,0,1) < x$hyperpar[2])
90+
# unif.log <- as.numeric(stats::runif(idx,0,1) < x$hyperpar[2])
91+
# p = 1 - (exp(eta) / (1+exp(eta)))^a ; eta -> grande; p -> 0
92+
unif.log <- as.numeric(stats::runif(idx,0,1) > 1-(exp(x$latent[idx]) / (1+exp(x$latent[idx])))^x$hyperpar[2])
9093
}else{
9194
unif.log = 1
9295
}

R/sragBH.r

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88
#' \describe{
99
#' \item{DT_SIN_PRI}{Date of onset symptoms.}
1010
#' \item{DT_DIGITA}{Date of recording.}
11-
#' \item{DT_SIN_PRI}{Date of onset symptoms.}
1211
#' \item{CLASSI_FIN}{Final classification of the case. (Not used for nowcasting)}
1312
#' \item{EVOLUCAO}{Case evolution. (Not used for nowcasting)}
1413
#' \item{CO_MUN_RES}{IBGE municipality code. Belo Horizonte is 310620.}

man/data.w.Rd

Lines changed: 3 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/data.w_no_age.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/nowcasting.summary.Rd

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/nowcasting_age.Rd

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)