epiverse-trace / epichains

[Under active development] Methods for simulating and analysing the sizes and lengths of infectious disease transmission chains from branching process models
https://epiverse-trace.github.io/epichains/
Other
5 stars 2 forks source link

Should `summary()` report infinite outbreaks as max? #239

Closed sbfnk closed 5 months ago

sbfnk commented 5 months ago

Perhaps just me but I find this a bit confusing. Should the Max not be Inf?

library("epichains")

set.seed(1)
chains_pois_offspring <- simulate_chains(
  index_cases = 3,
  statistic = "size",
  offspring_dist = rpois,
  stat_max = 10,
  lambda = 1
)
chains_pois_offspring |>
summary()
#> `epichains_summary` object 
#> 
#> [1]   1 Inf   2
#> 
#>  Simulated tree sizes: 
#> 
#> Max: 2
#> Min: 1

Created on 2024-03-26 with reprex v2.1.0

jamesmbaazam commented 5 months ago

Thanks. I think the initial idea was to report the max here as max(finite_values) since they are "observed". This is because the observation process doesn't know what Inf means except that it's a value >= `stat_max? Speaking out loud, it could be Inf with some text to explain that Infs are values above stat_max, which have been censored?

sbfnk commented 5 months ago

Perhaps report it as >=10 if stat_max is 10 etc.?

jamesmbaazam commented 5 months ago

That's a solution but it would make the values a string 😬 .

sbfnk commented 5 months ago

But the max/min aren't returned (only printed), or are they?

jamesmbaazam commented 5 months ago

The values are gotten from summary() and then formatted for printing. The nice thing about keeping the parameters as attributes is that we can let summary return Inf if it's the max, and in the formatting step, replace Inf with >=stat_max.

sbfnk commented 5 months ago

Yep that sounds like a great solution.