Dear Oleg, You're right. The points boil down to > That assumption (that the deviations are small) is not stated in types and it > is hard to see how can we enforce it. and even if it's small, there's corner cases at df/dx = 0 or df/dx = infinity (as you have mentioned.)
Thanks to your advices, I'll look for other ways to set up probabilistic computations. 2012/7/19 <o...@okmij.org>: > >> http://en.pk.paraiso-lang.org/Haskell/Monad-Gaussian >> What do you think? Will this be a good approach or bad? > > I don't think it is a Monad (or even restricted monad, see > below). Suppose G a is a `Gaussian' monad and n :: G Double is a > random number with the Gaussian (Normal distribution). Then > (\x -> x * x) `fmap` n > is a random number with the chi-square distribution (of > the degree of freedom 1). Chi-square is _not_ a normal > distribution. Perhaps a different example is clearer: > > (\x -> if x > 0 then 1.0 else 0.0) `fmap` n > > has also the type G Double but obviously does not have the normal > distribution (since that random variable is discrete). > > There are other problems > >> Let's start with some limitation; we restrict ourselves to Gaussian >> distributions and assume that the standard deviations are small >> compared to the scales we deal with. > > That assumption is not stated in types and it is hard to see how can > we enforce it. Nothing prevents us from writing > liftM2 n n > in which case the variance will no longer be small compared with the > mean. > > Just a technical remark: The way G a is written, it is a so-called > restricted monad, which is not a monad (the adjective `restricted' is > restrictive here). > http://okmij.org/ftp/Haskell/types.html#restricted-datatypes > > -- Takayuki MURANUSHI The Hakubi Center for Advanced Research, Kyoto University http://www.hakubi.kyoto-u.ac.jp/02_mem/h22/muranushi.html _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe