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

Column names switched in return value of `simulate_chains` #238

Closed sbfnk closed 3 months ago

sbfnk commented 5 months ago

Please place an "x" in all the boxes that apply


I think the infectee_id and sim_id columns are swapped in the return value of simulate_chains. The first column below is the simulation (or index case) running form 1 to 3. The second one is the ID fo the infectee within each simulation.

I also wonder, in line with the terminology used in the documentation (and argument names) whether it would be clearer if the sim_id column was renamed to index_case.

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 |>
as.data.frame()
#>    infectee_id sim_id infector_id generation
#> 1            1      1          NA          1
#> 2            2      1          NA          1
#> 3            3      1          NA          1
#> 4            2      2           1          2
#> 5            3      2           1          2
#> 6            2      3           2          3
#> 7            2      4           2          3
#> 8            2      5           3          4
#> 9            2      6           3          4
#> 10           2      7           4          4
#> 11           2      8           4          4
#> 12           2      9           4          4
#> 13           2     10           5          5
#> 14           2     11           6          5

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

jamesmbaazam commented 3 months ago

Thanks for picking this up @sbfnk. This issue is related to #175, so I'll address them jointly. I agree that it would make more sense to make the following changes:

I'll remove the _id suffix as it's redundant. This will also prepare {epichains} for the suggestion in {simulist} to align outputs: https://github.com/epiverse-trace/simulist/issues/43#issuecomment-2085576932.