R Under development (unstable) (2024-07-10 r86888 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > require(fitdistrplus) Loading required package: fitdistrplus Loading required package: MASS Loading required package: survival > > #case where the density returns a Not-an-Numeric value. > detectbound("gamma", c(shape=3, scale=3), 1:10, echo=TRUE) [1] "shape" "scale" shape scale 3 3 shape 1 tested value -1 3 [1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN [1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2 tested value 1.490116e-08 3 [1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN [1] 1.067715e-08 3.825256e-09 1.827277e-09 9.819759e-10 5.628932e-10 [6] 3.361088e-10 2.064279e-10 1.294230e-10 8.243168e-11 5.315839e-11 3 tested value 1 3 [1] 0.23884377 0.17113904 0.12262648 0.08786571 0.06295853 0.04511176 [7] 0.03232399 0.02316115 0.01659569 0.01189133 [1] 0.23884377 0.17113904 0.12262648 0.08786571 0.06295854 0.04511176 [7] 0.03232399 0.02316115 0.01659569 0.01189133 scale 1 tested value 3 -1 [1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN [1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN 2 tested value 3 1.490116e-08 [1] NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN [1] 0 0 0 0 0 0 0 0 0 0 3 tested value 3 1 [1] 0.183939726 0.270670571 0.224041808 0.146525109 0.084224335 0.044617537 [7] 0.022341107 0.010734803 0.004998097 0.002269996 [1] 0.183939715 0.270670562 0.224041808 0.146525113 0.084224340 0.044617541 [7] 0.022341109 0.010734805 0.004998098 0.002269997 shape scale lowb 0 0 uppb Inf Inf > detectbound("logis", c(location=3, scale=3), 1:10) location scale lowb -Inf 0 uppb Inf Inf > detectbound("geom", c(prob=1/2), 1:10) prob lowb 0 uppb 1 > > #test rate-scale arg > detectbound("gamma", c(shape=1, scale=3), 1:10) shape scale lowb 0 0 uppb Inf Inf > detectbound("gamma", c(shape=1, rate=1/3), 1:10) shape scale lowb 0 0 uppb Inf Inf > > > #case where the density returns a Not-an-Numeric value and one parameter is fixed. > detectbound("gamma", c(shape=3), 1:10, fix.arg=c(scale=3)) shape lowb 0 uppb Inf > > > #case where the density returns an error rather than a Not-an-Numeric value. > dgeom2 <- function(x, prob, log=FALSE) + { + stopifnot(prob >= 0 && prob <= 1) + dgeom(x, prob, log) + } > detectbound("geom2", c(prob=1/2), 1:10) prob lowb 0 uppb 1 > > #case where the density returns a Not-an-Numeric value for actuar package > require(actuar) Loading required package: actuar Attaching package: 'actuar' The following objects are masked from 'package:stats': sd, var The following object is masked from 'package:grDevices': cm > > detectbound("burr", c(shape1=3, shape2=3, rate=1), 1:10) shape1 shape2 scale lowb 0 0 0 uppb Inf Inf Inf > detectbound("llogis", c(shape=3, rate=1), 1:10) shape scale lowb 0 0 uppb Inf Inf > > proc.time() user system elapsed 1.46 0.20 1.67