JuliaMath / DensityInterface.jl

Interface for mathematical/statistical densities in Julia
Other
12 stars 3 forks source link

Should random sequences be measure-like? #10

Closed mschauer closed 2 years ago

mschauer commented 2 years ago

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)

oschulz commented 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.

mschauer commented 2 years ago

Yeah, also rand(randn) doesn't make much sense, so that's a second datapoint.

oschulz commented 2 years ago

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).

oschulz commented 2 years ago

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.