[Under active development] Methods for simulating and analysing the sizes and lengths of infectious disease transmission chains from branching process models
The broader question is whether it would not be clearer to define S3 methods for numeric, epichains and epichains_summary where
likelihood.epichains <- function(chains, ...) {
likelihood(summary(chains, ...))
}
likelihood.epichains_summary <- function(chains, stat_max = Inf, ...) {
stat_max_from_sim <- attr(chains, "stat_max")
if (missing(stat_max)) {
stat_max <- stat_max_from_sim
} else if (stat_max != stat_max_from_sim) {
warning(`stat_max` is different from the one used in the simulations given in `chains`")
}
likelihood(as.numeric(chains, stat_max, ...))
}
and the current likelihood() becomes likelihood.numeric()
The broader question is whether it would not be clearer to define S3 methods for
numeric
,epichains
andepichains_summary
whereand the current
likelihood()
becomeslikelihood.numeric()
_Originally posted by @sbfnk in https://github.com/epiverse-trace/epichains/pull/213#discussion_r1588871470_