CDCgov / ww-inference-model

An in-development R package and a Bayesian hierarchical model jointly fitting multiple "local" wastewater data streams and "global" case count data to produce nowcasts and forecasts of both observations
https://cdcgov.github.io/ww-inference-model/
Apache License 2.0
16 stars 2 forks source link

Adding class and methods for wwinference model fit #58

Closed gvegayon closed 1 month ago

gvegayon commented 2 months ago

This PR does the following:

gvegayon commented 1 month ago

OK, @kaitejohnson, this is ready for review. To avoid getting stuck, I suggest adding more S3 methods later (e.g., plot, vcov, confint, etc.).

seabbs commented 1 month ago

Add get_draws_df() (new generic with S3 method: default and wwinference_fit)

if going to do this why not write a method for posterior

kaitejohnson commented 1 month ago

@gvegayon Reminder to add to NEWS.md with a description of this change! I keep forgetting to do that/keep the date updated.

gvegayon commented 1 month ago

@gvegayon A few suggested changes and some questions. Overall looking really good and excited to have this working! I think I am just trying to wrap my head around what the use case of the .default is

Here is a reprex illustrating the use of S3 methods with default:

myfun <- function(x) UseMethod("myfun")

myfun.data.frame <- function(x) {
  message("data.frame")
}

myfun.default <- function(x) {
  message("default")
}

myfun.integer <- function(x) {
  message("integer")
}

myfun(USArrests)
#> data.frame
myfun(1L)
#> integer
myfun("G")
#> default

Created on 2024-08-28 with reprex v2.1.0