feat: simulate_chain_stats() returns both size and length statistics#341
Draft
Copilot wants to merge 3 commits into
Draft
feat: simulate_chain_stats() returns both size and length statistics#341Copilot wants to merge 3 commits into
Copilot wants to merge 3 commits into
Conversation
- simulate_chain_stats() now tracks both chain size and chain length simultaneously; `statistic` is only the stopping criterion - <epichains_summary> changed from a numeric vector to a data.frame with `size` and `length` columns - format/summary methods updated to display both stats - summary.epichains() also computes and returns both stats - likelihood() updated to extract the relevant column from the data.frame - .offspring_ll() updated to extract statistic column before ecdf() - rborel() updated to extract `size` column from new data.frame - Tests and snapshots updated to match new data.frame API
Copilot
AI
changed the title
[WIP] Add simulate_chain_stats with limit on one stat reporting both stats
feat: simulate_chain_stats() returns both size and length statistics
Jun 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
simulate_chain_stats()only returned the statistic used as the stopping criterion, making it impossible to limit by one stat (e.g., generation length) while observing the other (e.g., outbreak size).Changes
Core API change:
<epichains_summary>is now a data frame<epichains_summary>changes from a single-column numeric vector to adata.framewithsizeandlengthcolumnsstatisticremains the stopping criterion; only that stat is censored atstat_threshold(the complementary stat reflects its actual value when the chain stopped)Updated consumers
format.epichains_summary()— displays both stats with stopping criterion and thresholdsummary.epichains_summary()— returnsmax_size/min_size/max_length/min_length(replacesmax_stat/min_stat)summary.epichains()— computes and returns both statslikelihood()— extracts the relevant column from the data frame; usesstat_thresholdonly when the requested statistic matches the stopping criterion (otherwiseInf, since the non-stopping stat is never censored).offspring_ll()(stat_likelihoods.R) — extracts statistic column before passing toecdf()rborel()(borel.R) — extractssizecolumn from the new data frameTests & snapshots
$size/$length,nrow(), and the renamed summary fields