Closed mschauer closed 2 years ago
I would argue no.
I would say that a distribution is an object that has a density, and it has a (default) random number generating function, and so on. These are answers to questions that you can ask a distribution ("What's your log-density function? What's your default random number generating function?").
But I wouldn't say that a random number generating function has a density.
Yeah, also rand(randn)
doesn't make much sense, so that's a second datapoint.
Wait ...
On the other hand, I think that @cscherrer said that a set of samples is a measure - and so can be said to have a density. Is that the same density (in the limit of an infinite set of samples of a well behaved distribution) as the PDF of the distribution? So can a set of samples be seen as a measure that's a surrogate/approximantion of the distribution the samples were drawn from?
If so, then maybe something like a random number generator could be seen as "something like a measure" and be said to have a density. It would be neater with a sequence-like type though than with randn
. You can (at least in principle) do rand(sequence)
.
But I guess for sequences that can be seen as measures, we wouldn't need to add anything to DensityInterface itself. I'm closing this for now, but please feel free to reopen if necessary.
There is the question if
densityof(randn, [ -0.5361746874993382, -0.7359832283375626])
should give 0.1051408530281359.Or more formally, should we think of random variables and functions returning random numbers as in the scope of having a density (which would be then the density of the law of the samples)