-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
I've found an issue with the BCCG distribution functions. They don't gracefully handle missing values due to the use of any(q < 0), which will return NA if any of its inputs are missing. Here's a reprex, and a comparison to the behaviour of pnorm, which behaves as expected:
# quantiles
q1 = c(0,1)
q2 = c(0,1,NA_real_)
# Expected output: 2 numbers
gamlss.dist::pBCCG(q1, mu = 1, sigma = 1, nu = 0)
#> [1] 0.0 0.5
pnorm(q1, 1, 0.5)
#> [1] 0.02275013 0.50000000
# Expected output: 2 numbers and a missing value. pnorm does this,
# but pBCCG returns an error
gamlss.dist::pBCCG(q2, mu = 1, sigma = 1, nu = 0)
#> Error in if (any(q < 0)) stop(paste("q must be positive", "\n", "")): missing value where TRUE/FALSE needed
pnorm(q2, mean = 1, sd = 0.5)
#> [1] 0.02275013 0.50000000 NACreated on 2023-09-14 with reprex v2.0.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels