distributional
distributional copied to clipboard
Improve accuracy of summary statistic methods for transformed distributions
I'm not sure the exact problem, but it seems that the mean()
of transformed distributions is not always correct. Here's an example of exp()
applied to dist_normal()
, which should yield a lognormal distribution, giving incorrect means:
> x = dist_normal(0:1, 1:2)
> mean(x)
[1] 0 1
> mean(exp(x)) # should be roughly exp(c(0.5, 3))
[1] 1.500000 8.154845
> exp(c(0.5, 3))
[1] 1.648721 20.085537
I'm not sure the issue. It does appear to work in some cases:
> mean(log(exp(x))) # should be roughly c(0, 1)
[1] -4.732208e-07 1.000000e+00