igarnier / prbnmcn-stats

Basic statistics library
https://igarnier.github.io/prbnmcn-stats/
MIT License
6 stars 0 forks source link

multidimensional distribution support #2

Open nilsbecker opened 9 months ago

nilsbecker commented 9 months ago

it would be nice to have some basic support for multidimensional distributions. i can think of

this would already be useful -- maybe there is something else that is equally basic?

igarnier commented 9 months ago

I think those are nice suggestions! It's true the choice of distributions is a bit thin right now.

combinators to make random vectors with independent but not identically distributed components from existing distributions

Do you have something in mind API-wise for this one? We could either introduce tupN : 'a1 t * ... * 'aN t -> ('a1 * ... * 'aN) t for N = 1,2,3,4...K with K fixed, or if we don't care about having heterogeneous types something like vector : int -> (int -> 'a t) -> 'a array t

potentially, a simpler way to make vectors with independent uniform components with componentwise different support.

Same question, if you have a signature in mind (or can point me to something existing elsewhere) that'd be great!

nilsbecker commented 8 months ago

hmm, i think allowing different types in different dimensions could be useful for a case of discrete x continuous data. so i like the tupN type better i think. maybe both?

for the rectangular one, probably the vector type is sufficient and easier.

igarnier commented 8 months ago

Part of this seems like an easy improvement, I'll try to get to that soon.

For the multidimensional gaussian, it's not so clear I can get something efficient in a short amount of time. There is code that has been written by much better numerical experts than I so I should probably find some good MIT-licensed implementation.

igarnier commented 8 months ago

I added some rectangle and tupN combinators for Gen and Pdfs: