[SciPy-User] specifying range in scipy.stats.truncnorm
Joon Ro
joonpyro@gmail....
Fri Jul 27 11:30:29 CDT 2012
Hi,
I tried to use scipy.stats.truncnorm and found the way to specifying the
parameters of truncated normal very confusing.
I expected a, b parameter to be the specification of the interval where
I want to truncate the distribution at, but it is not the case when the
normal I want to use is not standard.
According to the documentation, I need to standardize my values - for
example, if I want to have a truncated normal with mean 0.5, variance 1,
on [0, 1] interval, I need to do:
myclip_a = 0
myclip_b = 1
my_mean=0.5
my_std =1
a, b = (myclip_a - my_mean) / my_std, (myclip_b - my_mean) / my_std
rv = truncnorm(a, b, loc=my_mean, scale=my_std)
Which is unnecessarily complicated in my opinion. Since we have to
provide location and scale parameter anyway, why not make truncnorm to
accept the actual interval values (in this case, a, b = 0, 1) instead
and do the standardization internally? I think it would be more
intuitive that way.
Best regards,
Joon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/scipy-user/attachments/20120727/653e58fe/attachment.html
More information about the SciPy-User
mailing list