Skip to content

Commit

Permalink
Skip monotonic transformation check if function is identity
Browse files Browse the repository at this point in the history
  • Loading branch information
mitchelloharawild committed Sep 17, 2024
1 parent 92546db commit 9e632cc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions R/transformed.R
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,9 @@ Ops.dist_transformed <- function(e1, e2) {
}

monotonic_increasing <- function(f, support) {
# Shortcut for identity function (used widely in ggdist)
if(identical(body(f), as.name(names(formals(f))))) return(TRUE)

# Currently assumes (without checking, #9) monotonicity of f over the domain
x <- f(field(support, "lim")[[1]])
x[[2L]] > x[[1L]]
Expand Down

0 comments on commit 9e632cc

Please sign in to comment.