I would like to know without checking the documentation, what values a probability distribution accepts as arguments.
A single parameter can be a:
- double between -Inf and Inf
- double between 0 and Inf
- positive integer
- double between 0 and 1
(I know, for example, multinomial distribution has vector arguments, but let's concentrate now on the distribution having scalar arguments.)
library(dplyr)
checkArgBoundaries <- function(distribution) {
#The number of parameters the distribution has
nparams <- formals(get(paste0("r",distribution))) %>% names %>% {.[!(. %in% c("n","ncp"))]} %>% length
while(TRUE) {
canWeBreak <- tryCatch({
#This is problematic, since we should generate value candidates representing the boundaries here.
do.call(get(paste0("r",distribution)), valuecandidates)
TRUE
}, warning = \(w) {
FALSE
}
if(canWeBreak) {break}
}
}
And for binomial distribution, for example, we should get a result that the size argument should be a positive integer and the prob argument should be between 0 and 1.