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

Bug with Pareto distribution and eval quantile #40

Open
vincenzocoia opened this issue Jan 11, 2023 · 0 comments
Open

Bug with Pareto distribution and eval quantile #40

vincenzocoia opened this issue Jan 11, 2023 · 0 comments

Comments

@vincenzocoia
Copy link
Owner

vincenzocoia commented Jan 11, 2023

library(tidyverse)
library(distplyr)
dst_pareto <- local({
  ppareto <- function(q, xi, lower.tail = TRUE) {
    res <- pmin(1, q ^ (-1 / xi))
    if (lower.tail) res <- 1 - res
    res
  }
  dpareto <- function(q, xi) sapply(q, function(q_) if (q_ >= 1) q_ ^ (-1 / xi - 1) / xi else 0)
  qpareto <- function(p, xi) (1 - p) ^ (-xi)
  function(xi) dst_parametric("pareto", xi = xi, .variable = "continuous")
})
eval_quantile(maximise(dst_pareto(1), dst_pareto(2) + 5), at = 0.5)

Error in while (cdf_gt(cdf_left, p_min)) { :
missing value where TRUE/FALSE needed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant