Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Column names switched in return value of simulate_chains #238

Closed
3 tasks done
sbfnk opened this issue Mar 26, 2024 · 1 comment · Fixed by #242
Closed
3 tasks done

Column names switched in return value of simulate_chains #238

sbfnk opened this issue Mar 26, 2024 · 1 comment · Fixed by #242
Milestone

Comments

@sbfnk
Copy link
Contributor

sbfnk commented Mar 26, 2024

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

  • I have the most recent version of epichains and R
  • I have found a bug
  • I have a reproducible example

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
Copy link
Member

jamesmbaazam commented May 1, 2024

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:

  • infectee_id -> index_case
  • sim_id -> infectee
  • infector_id -> infector

I'll remove the _id suffix as it's redundant. This will also prepare {epichains} for the suggestion in {simulist} to align outputs: epiverse-trace/simulist#43 (comment).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
2 participants