EpiNow2 icon indicating copy to clipboard operation
EpiNow2 copied to clipboard

epinow: no non-missing arguments to max; returning -Inf - max

Open furqan915 opened this issue 3 years ago • 1 comments

Hello,

I am learning this EpiNow2 to forecast using my own data. I have input my data with two columns (dates and No.Cases).

reported_cases <- read.csv(file = "./new_combined_daily_with_additive_no.csv", header = TRUE, check.names = FALSE)
head(reported_cases)
reported_cases$Date <- lubridate::dmy(reported_cases$Date)
reporting_delay <- list(
   mean = convert_to_logmean(2, 1), mean_sd = 0.1,
   sd = convert_to_logsd(2, 1), sd_sd = 0.1,
   max = 15)
generation_time <- get_generation_time(disease = "SARS-CoV-2", source = "ganyani")
incubation_period <- get_incubation_period(disease = "SARS-CoV-2", source = "lauer")

All the data were loaded correctly. Whenever I run epinow command to analyse the data,

estimates <- epinow(reported_cases = reported_cases,
                    generation_time = generation_time,
                    delays = delay_opts(incubation_period, reporting_delay),
                    rt = rt_opts(prior = list(mean = 2, sd = 0.2)),
                    stan = stan_opts(cores = 4), logs = NULL)

then I get this error:

DEBUG [2021-08-04 17:50:28] Producing following optional outputs: samples, plots, latest, fit, timing
WARN [2021-08-04 17:50:28] epinow: no non-missing arguments to max; returning -Inf - max, reported_cases$date
Error in min(date) : invalid 'type' (closure) of argument
In addition: Warning message:
In max(reported_cases$date, na.rm = TRUE) :
  no non-missing arguments to max; returning -Inf

I couldn't identify the exact problem. Please help me to resolve this issue. Thanks

furqan915 avatar Aug 04 '21 13:08 furqan915

Hi @furqan915,

Thanks for opening this.

In your code, I see a Date variable and not a date variable. That seems like it may be the cause of the issue you are having?

seabbs avatar Aug 04 '21 16:08 seabbs