Skip to content

Commit

Permalink
update cdf.epidist to handle log prob
Browse files Browse the repository at this point in the history
  • Loading branch information
joshwlambert committed Nov 13, 2023
1 parent dd41ad1 commit 1504106
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 0 deletions.
2 changes: 2 additions & 0 deletions R/epidist.R
Original file line number Diff line number Diff line change
Expand Up @@ -613,6 +613,7 @@ is_epidist <- function(x) {
#' @param p The probabilities to evaluate at.
#' @param times The number of random samples.
#' @inheritParams print.epidist
#' @inheritParams distributional::cdf
#'
#' @return If an `<epidist>` object is given a numeric vector is returned, if an
#' `<vb_epidist>` object is given a list of two elements each with a numeric
Expand Down Expand Up @@ -693,6 +694,7 @@ cdf.epidist <- function(x, q, ..., log = FALSE) {
unlist <- length(x$prob_dist) == 1
if (inherits(x$prob_dist, "distcrete")) {
out <- x$prob_dist$p(q)
if (log) out <- log(out)
} else {
out <- distributional::cdf(x$prob_dist, q = q, ..., log = log)
}
Expand Down
2 changes: 2 additions & 0 deletions man/epidist_distribution_functions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1504106

Please sign in to comment.