[Scipy-tickets] [SciPy] #1547: stats problem sampling heavy tailed distributions ?
SciPy Trac
scipy-tickets@scipy....
Mon Oct 31 11:22:43 CDT 2011
#1547: stats problem sampling heavy tailed distributions ?
-------------------------+--------------------------------------------------
Reporter: josefpktd | Owner: somebody
Type: defect | Status: new
Priority: normal | Milestone: Unscheduled
Component: scipy.stats | Version: 0.9.0
Keywords: |
-------------------------+--------------------------------------------------
looking at a test failure for the variance of inverse gamma, I don't see
where a problem could be
variance of a sample is too small with an alpha close to the boundary
where variance goes to infinite (alpha was initially randomly chosen for
the test suite)
{{{
>>> rvsg2 = stats.invgamma.rvs(2.0668996136993067, size=100000)
>>> rvsg2.mean()
0.93872480525513002
>>> rvsg2.var()
4.2851923812716173
>>> stats.invgamma.stats(2.0668996136993067, moments='mvsk')
(array(0.9372953060997531), array(13.131951625091878),
array(-0.4777296893768406
), array(-2.8665735140043456))
}}}
for larger values of alpha there are no problems
{{{
>>> rvsg8 = stats.invgamma.rvs(8., size=100000)
>>> rvsg8.mean()
0.14308306360000753
>>> rvsg8.var()
0.0034688970075502771
>>> stats.invgamma.stats(8, moments='mvsk')
(array(0.14285714285714285), array(0.003401360544217677),
array(1.95959179422656
13), array(8.700000000000012))
}}}
I checked a few values for the frequency distribution in the tails
compared to ppf, and it matches pretty well.
I have no clue why there is the discrepancy in the variance. I checked the
calculations for variance with Wikipedia. The rvs works generically with a
specified ppf.
--
Ticket URL: <http://projects.scipy.org/scipy/ticket/1547>
SciPy <http://www.scipy.org>
SciPy is open-source software for mathematics, science, and engineering.
More information about the Scipy-tickets
mailing list