Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/telkamp7/aedseo
Browse files Browse the repository at this point in the history
  • Loading branch information
telkamp7 committed Oct 30, 2023
2 parents e84d334 + e50b6aa commit 7c81b48
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 7 deletions.
6 changes: 4 additions & 2 deletions R/aedseo.R
Original file line number Diff line number Diff line change
Expand Up @@ -108,8 +108,10 @@ aedseo <- function(
# Turn the results into an `aedseo` class
ans <- tibble::new_tibble(
x = res,
class = "aedseo" # TODO: #8 Include metadata about the call, so it can
# be passed onto the `summary()` function. @telkamp7
class = "aedseo",
k = k,
level = level,
family = family
)

return(ans)
Expand Down
30 changes: 26 additions & 4 deletions R/summary.R
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@
#' )
#' # Print the summary of the aedseo_results to the console
#' summary(aedseo_results)
# TODO: #8 Incorporate additional metadata about the call to the `aedseo` function.
summary.aedseo <- function(object, ...) {
# Extract the last observation
last_observation <- dplyr::last(object)
Expand All @@ -58,22 +57,45 @@ summary.aedseo <- function(object, ...) {
dplyr::summarise(sum_of_growth_warnings = sum(.data$growth_warning)) %>%
dplyr::pull(sum_of_growth_warnings)

# Extract the attributes from the object
attributes_object <- attributes(object)

# Extract the object k, level, and family
k <- attributes_object$k
level <- attributes_object$level
family <- attributes_object$family

# Extract the lower and upper confidence intervals
lower_confidence_interval <- (1 - level) / 2
upper_confidence_interval <- level + lower_confidence_interval

# Generate the summary message
summary_message <- sprintf(
"Summary of aedseo Object
Called using distributional family:
%s
Window size for growth rate estimation and
calculation of sum of cases:
%d
Reference time point:
%s
Growth rate estimate:
Estimate Lower Upper
%.3f %.3f %.3f
Growth rate estimate at reference time point:
Estimate Lower (%.1f%%) Upper (%.1f%%)
%.3f %.3f %.3f
Total number of growth warnings in the series:
%d
Latest growth warning:
%s",
family,
k,
as.character(reference_time),
lower_confidence_interval * 100,
upper_confidence_interval * 100,
last_observation$growth_rate,
last_observation$lower_growth_rate,
last_observation$upper_growth_rate,
Expand Down
2 changes: 1 addition & 1 deletion vignettes/articles/aedseo.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ To accommodate a variety of scenarios encountered in practical applications, the


```{r parameter_combinations}
#TODO: #7 Conduct the simulation study and write the article on the `aedseo`
# TODO: #7 Conduct the simulation study and write the article on the `aedseo`
# package. @telkamp7
parameter_combinations <- as_tibble(expand_grid(
theta = c(3, 4, 5, 6, 7),
Expand Down

0 comments on commit 7c81b48

Please sign in to comment.