Open dbeacham opened 8 years ago
Sorry for long silence
So you're proposing to add method with default implementation to DiscreteDistribution
type class, right? I think it's nice addition, I won't add it myself so I mark this issue as "help needed"
I'd completely forgotten about this!
Yeah - the default can just do the dumb thing of calling the pdf or cdf multiple times.
I'll hopefully have a bit of free time over the next week - will try and get a pull request over to you.
I have quite a few applications where I need to compute the pdf (or cdf) of a discrete distribution over the whole range [n, n+1, ..., n+N]. At the moment, that requires calling the pdf (or cdf) function for each value in the range. However, for many distributions it's much quicker to calculate the first case and then use your knowledge of the distribution to calculate the values for [n+1, ..., n+N]. You then end up with an unfolding operation:
which for the binomial distribution would look like