circstat / pycircstat

Toolbox for circular statistics with Python
MIT License
157 stars 42 forks source link

Warning: requirements for confidence levels not met #31

Open tomwallis opened 9 years ago

tomwallis commented 9 years ago

I'm just going through some of the circstat stuff.

When I run the following lines:

test_dat = np.array([1.80044838, 2.02938314, 1.03534016, 4.84225057,
                     1.54256458, 5.19290675, 2.18474784,
                     4.77054777, 1.51736933, 0.72727580])

m, (low, hi) = circ.mean(test_dat, ci=0.95)

I get the following warning:

PyCircStat/pycircstat/descriptive.py:271: UserWarning: Requirements for
confidence levels not met.
  warnings.warn('Requirements for confidence levels not met.')

and if I print the confidence limits:

print(m, low, hi)

I get

1.35173983072 nan nan

If I run nosetests -v, I see that test_mean_ci_limits passes ok, and test_mean_ci_2d gives the same warning (but passes).

What's going on? I presume it's something like that there are not enough data points to generate a distribution of means appropriate for computing 95% confidence intervals (i.e. there will only be a small-ish number of unique means, so the confidence limits are too coarse).

If that's the case, I think this warning could be made more specific (so that the user knows what "requirements" were not met).

philippberens commented 9 years ago

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1

You can see that the CI limits require a certain concentration of the data around the mean (lines 263 and 267). These seem not to be met my the test data, so the test data is likely not chosen ideally...

Am 07.11.2014 um 14:36 schrieb Tom Wallis:

I'm just going through some of the circstat stuff.

When I run the following lines:

|test_dat = np.array([1.80044838, 2.02938314, 1.03534016, 4.84225057, 1.54256458, 5.19290675, 2.18474784, 4.77054777, 1.51736933, 0.72727580])

m, (low, hi) = circ.mean(test_dat, ci=0.95) |

I get the following warning:

|PyCircStat/pycircstat/descriptive.py:271: UserWarning: Requirements for confidence levels not met. warnings.warn('Requirements for confidence levels not met.') |

and if I print the confidence limits:

|print(m, low, hi) |

I get

|1.35173983072 nan nan |

If I run nosetests -v, I see that test_mean_ci_limits passes ok, and test_mean_ci_2d gives the same warning (but passes).

What's going on? I presume it's something like that there are not enough data points to generate a distribution of means appropriate for computing 95% confidence intervals (i.e. there will only be a small-ish number of unique means, so the confidence limits are too coarse).

If that's the case, I think this warning could be made more specific (so that the user knows what "requirements" were not met).

— Reply to this email directly or view it on GitHub https://github.com/circstat/pycircstat/issues/31.


Dr. Philipp Berens

Bernstein Center for Computational Neuroscience University of Tübingen http://www.bethgelab.org http://philippberens.wordpress.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32)

iQEcBAEBAgAGBQJUXM0wAAoJEFmQiZzLSxYeGmsH/AtABeRMFWy0wu1MeAsHhAPp jJ7sd74BGg3bE6ia7G400b0Zrk8VAR9hOzhp0DgqPAfdhLqgyS8NTtk700BHSedg EyBoUBbqz0xWubS5dvSF7ibsiEWa3gZ9sjlD/IPW6Jk0EcIuNoioWB7BI7XFPnj+ p7boKcg/XFf7P+R6UK61KIQsnGRu/gjWvM/TmYjFX8SVhiZTkd1v1xD0K9iXsb/A nsUpCocEtCyJAePEU+/BncA07wKsfbBWnophnulAuX+OAp7GxIvzHbdy3QpV/+nR 6Eyih0UF2hk4eggs+nnh+n/gZ80/o5gGT/wvP82M4yi0Ds1uGCr6I4F3GWsqvMY= =Z40F -----END PGP SIGNATURE-----

tomwallis commented 9 years ago

Yep. I think it would be good to write one or two more sentences in the warning text explaining to users what those requirements are and why they might not be met.