Closed Vitalis95 closed 2 years ago
There likely is not a way to make this work with the existing birthday functions since
pbirthday(n)
does not compute P(X <= n) for some random variable,dbirthday()
, which would be needed to make the plot.In short, despite the names of these functions, they are not really part of a standard suite of d-, p-, and q-functions for a family of distributions.
We should probably update the documentation of pdist()
from
The most general function is pdist which can work with any distribution for which a p-function exists. As a convenience, wrappers are provided for several common distributions.
to something like
The most general function is pdist which can work with any distribution for which standard d-, p-, and q-functions exists. As a convenience, wrappers are provided for several common distributions.
@Vitalis95 , It is not clear to me what you wanted your code example to do. It is overspecified (you have given values to classes
, coincident
, and n
, so isn't clear what the argument q = 1
is supposed to do.) Do you just want pbirthday(classes = 365, coincident = 2, n = 23)
? If you just want a vectorized version of pbirthday()
, you could use Vectorize()
to create such a function or use sapply()
to compute vectorized results without first creating a function.
I am trying to generate probabilities also quantiles in mosaic package using birthday distribution, for the probabilities this is the r-code; mosaic::pdist(q=c(1), plot=FALSE, return="values", dist="birthday", classes = 365, coincident = 2, n=23)
but I get the following error, Error in seq.default(xlim[1], xlim[2], length.out = resolution) : 'from' must be a finite number