How to calculate peakiness or uniformity in histogram?












1












$begingroup$


I have a histogram with 20 bins ranging from -1 to 1 with an interval of 0.1.
I would like to know if the histogram distribution is uniform or is peaked.



I want to compare several such histograms and take the one which has more "uniform" distribution and less peaks.



Any suggestions on how to proceed ?










share|cite|improve this question









$endgroup$












  • $begingroup$
    Test the goodness of fit of the histogram to a uniform distribution?
    $endgroup$
    – Rahul
    Sep 6 '14 at 4:04










  • $begingroup$
    Thank you, i think it almost fits my need. But I heard of this word "peakiness test" but cannot get any reliable and exact information to use it . Do you know about it ?
    $endgroup$
    – Sai
    Sep 6 '14 at 4:26










  • $begingroup$
    You may also want to see this answer to the question "How does one measure the non-uniformity of a distribution?".
    $endgroup$
    – r.e.s.
    Sep 6 '14 at 4:37










  • $begingroup$
    Thank you, its a nice pointer, i ll explore this option.
    $endgroup$
    – Sai
    Sep 6 '14 at 4:44
















1












$begingroup$


I have a histogram with 20 bins ranging from -1 to 1 with an interval of 0.1.
I would like to know if the histogram distribution is uniform or is peaked.



I want to compare several such histograms and take the one which has more "uniform" distribution and less peaks.



Any suggestions on how to proceed ?










share|cite|improve this question









$endgroup$












  • $begingroup$
    Test the goodness of fit of the histogram to a uniform distribution?
    $endgroup$
    – Rahul
    Sep 6 '14 at 4:04










  • $begingroup$
    Thank you, i think it almost fits my need. But I heard of this word "peakiness test" but cannot get any reliable and exact information to use it . Do you know about it ?
    $endgroup$
    – Sai
    Sep 6 '14 at 4:26










  • $begingroup$
    You may also want to see this answer to the question "How does one measure the non-uniformity of a distribution?".
    $endgroup$
    – r.e.s.
    Sep 6 '14 at 4:37










  • $begingroup$
    Thank you, its a nice pointer, i ll explore this option.
    $endgroup$
    – Sai
    Sep 6 '14 at 4:44














1












1








1





$begingroup$


I have a histogram with 20 bins ranging from -1 to 1 with an interval of 0.1.
I would like to know if the histogram distribution is uniform or is peaked.



I want to compare several such histograms and take the one which has more "uniform" distribution and less peaks.



Any suggestions on how to proceed ?










share|cite|improve this question









$endgroup$




I have a histogram with 20 bins ranging from -1 to 1 with an interval of 0.1.
I would like to know if the histogram distribution is uniform or is peaked.



I want to compare several such histograms and take the one which has more "uniform" distribution and less peaks.



Any suggestions on how to proceed ?







statistics statistical-inference






share|cite|improve this question













share|cite|improve this question











share|cite|improve this question




share|cite|improve this question










asked Sep 6 '14 at 3:55









SaiSai

84




84












  • $begingroup$
    Test the goodness of fit of the histogram to a uniform distribution?
    $endgroup$
    – Rahul
    Sep 6 '14 at 4:04










  • $begingroup$
    Thank you, i think it almost fits my need. But I heard of this word "peakiness test" but cannot get any reliable and exact information to use it . Do you know about it ?
    $endgroup$
    – Sai
    Sep 6 '14 at 4:26










  • $begingroup$
    You may also want to see this answer to the question "How does one measure the non-uniformity of a distribution?".
    $endgroup$
    – r.e.s.
    Sep 6 '14 at 4:37










  • $begingroup$
    Thank you, its a nice pointer, i ll explore this option.
    $endgroup$
    – Sai
    Sep 6 '14 at 4:44


















  • $begingroup$
    Test the goodness of fit of the histogram to a uniform distribution?
    $endgroup$
    – Rahul
    Sep 6 '14 at 4:04










  • $begingroup$
    Thank you, i think it almost fits my need. But I heard of this word "peakiness test" but cannot get any reliable and exact information to use it . Do you know about it ?
    $endgroup$
    – Sai
    Sep 6 '14 at 4:26










  • $begingroup$
    You may also want to see this answer to the question "How does one measure the non-uniformity of a distribution?".
    $endgroup$
    – r.e.s.
    Sep 6 '14 at 4:37










  • $begingroup$
    Thank you, its a nice pointer, i ll explore this option.
    $endgroup$
    – Sai
    Sep 6 '14 at 4:44
















$begingroup$
Test the goodness of fit of the histogram to a uniform distribution?
$endgroup$
– Rahul
Sep 6 '14 at 4:04




$begingroup$
Test the goodness of fit of the histogram to a uniform distribution?
$endgroup$
– Rahul
Sep 6 '14 at 4:04












$begingroup$
Thank you, i think it almost fits my need. But I heard of this word "peakiness test" but cannot get any reliable and exact information to use it . Do you know about it ?
$endgroup$
– Sai
Sep 6 '14 at 4:26




$begingroup$
Thank you, i think it almost fits my need. But I heard of this word "peakiness test" but cannot get any reliable and exact information to use it . Do you know about it ?
$endgroup$
– Sai
Sep 6 '14 at 4:26












$begingroup$
You may also want to see this answer to the question "How does one measure the non-uniformity of a distribution?".
$endgroup$
– r.e.s.
Sep 6 '14 at 4:37




$begingroup$
You may also want to see this answer to the question "How does one measure the non-uniformity of a distribution?".
$endgroup$
– r.e.s.
Sep 6 '14 at 4:37












$begingroup$
Thank you, its a nice pointer, i ll explore this option.
$endgroup$
– Sai
Sep 6 '14 at 4:44




$begingroup$
Thank you, its a nice pointer, i ll explore this option.
$endgroup$
– Sai
Sep 6 '14 at 4:44










2 Answers
2






active

oldest

votes


















0












$begingroup$

The answer depends on what you are trying to do:




  1. Are you trying to infer which histogram was mostly likely to be generated by a uniform distribution OR

  2. Trying to find which histogram demonstrates the least non-uniformity?


These questions may seem the same, but they are not. Inference is very sensitive to the sample size, whereas descriptive measure take the data at face value.



If you are going for (1), then the suggestions in the comments or link will work fine. However, if you are trying to find the most uniform histogram, then this is not an inference problem, but a measurement problem...how do you measure non-uniformity?



At the risk of appearing shamelessly self-promoting, I recently answered a similar question by describing a method I developed to rand distributions by their degree of uniformity. Take a look and see if you think it is relevant to your problem.






share|cite|improve this answer











$endgroup$













  • $begingroup$
    I am trying to tackle the second one as mentioned in your answer. Could you tell why skewness or kurtosis cannot be a good measure ?
    $endgroup$
    – Sai
    Sep 8 '14 at 3:00












  • $begingroup$
    @Sai the problem with moment-based measures is that they are not unique. The most uniform distribution will certainly lack skew, but kurtosis is not easy to relate directly with uniformity...two distributions can have similar kurtosis but look very different. The path length method I use is based on a key feature of uniformity: its cdf is maximally linear given the constraints.
    $endgroup$
    – user76844
    Sep 8 '14 at 3:48



















0












$begingroup$

One possible approach would be to use the Chi-square test to compare the "observed" histogram counts with the "expected" uniform distribution.



The chi-square test statistic or its p-value may be used as a possible metric of "(non)uniformness" - highly non-uniform histograms would tend to have high chi-square values and the corresponding p-values approaching zero.



In Python:



from scipy.stats import chisquare
uniformness = chisquare(counts_vector).pvalue





share|cite|improve this answer









$endgroup$













    Your Answer





    StackExchange.ifUsing("editor", function () {
    return StackExchange.using("mathjaxEditing", function () {
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    });
    });
    }, "mathjax-editing");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "69"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f921084%2fhow-to-calculate-peakiness-or-uniformity-in-histogram%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0












    $begingroup$

    The answer depends on what you are trying to do:




    1. Are you trying to infer which histogram was mostly likely to be generated by a uniform distribution OR

    2. Trying to find which histogram demonstrates the least non-uniformity?


    These questions may seem the same, but they are not. Inference is very sensitive to the sample size, whereas descriptive measure take the data at face value.



    If you are going for (1), then the suggestions in the comments or link will work fine. However, if you are trying to find the most uniform histogram, then this is not an inference problem, but a measurement problem...how do you measure non-uniformity?



    At the risk of appearing shamelessly self-promoting, I recently answered a similar question by describing a method I developed to rand distributions by their degree of uniformity. Take a look and see if you think it is relevant to your problem.






    share|cite|improve this answer











    $endgroup$













    • $begingroup$
      I am trying to tackle the second one as mentioned in your answer. Could you tell why skewness or kurtosis cannot be a good measure ?
      $endgroup$
      – Sai
      Sep 8 '14 at 3:00












    • $begingroup$
      @Sai the problem with moment-based measures is that they are not unique. The most uniform distribution will certainly lack skew, but kurtosis is not easy to relate directly with uniformity...two distributions can have similar kurtosis but look very different. The path length method I use is based on a key feature of uniformity: its cdf is maximally linear given the constraints.
      $endgroup$
      – user76844
      Sep 8 '14 at 3:48
















    0












    $begingroup$

    The answer depends on what you are trying to do:




    1. Are you trying to infer which histogram was mostly likely to be generated by a uniform distribution OR

    2. Trying to find which histogram demonstrates the least non-uniformity?


    These questions may seem the same, but they are not. Inference is very sensitive to the sample size, whereas descriptive measure take the data at face value.



    If you are going for (1), then the suggestions in the comments or link will work fine. However, if you are trying to find the most uniform histogram, then this is not an inference problem, but a measurement problem...how do you measure non-uniformity?



    At the risk of appearing shamelessly self-promoting, I recently answered a similar question by describing a method I developed to rand distributions by their degree of uniformity. Take a look and see if you think it is relevant to your problem.






    share|cite|improve this answer











    $endgroup$













    • $begingroup$
      I am trying to tackle the second one as mentioned in your answer. Could you tell why skewness or kurtosis cannot be a good measure ?
      $endgroup$
      – Sai
      Sep 8 '14 at 3:00












    • $begingroup$
      @Sai the problem with moment-based measures is that they are not unique. The most uniform distribution will certainly lack skew, but kurtosis is not easy to relate directly with uniformity...two distributions can have similar kurtosis but look very different. The path length method I use is based on a key feature of uniformity: its cdf is maximally linear given the constraints.
      $endgroup$
      – user76844
      Sep 8 '14 at 3:48














    0












    0








    0





    $begingroup$

    The answer depends on what you are trying to do:




    1. Are you trying to infer which histogram was mostly likely to be generated by a uniform distribution OR

    2. Trying to find which histogram demonstrates the least non-uniformity?


    These questions may seem the same, but they are not. Inference is very sensitive to the sample size, whereas descriptive measure take the data at face value.



    If you are going for (1), then the suggestions in the comments or link will work fine. However, if you are trying to find the most uniform histogram, then this is not an inference problem, but a measurement problem...how do you measure non-uniformity?



    At the risk of appearing shamelessly self-promoting, I recently answered a similar question by describing a method I developed to rand distributions by their degree of uniformity. Take a look and see if you think it is relevant to your problem.






    share|cite|improve this answer











    $endgroup$



    The answer depends on what you are trying to do:




    1. Are you trying to infer which histogram was mostly likely to be generated by a uniform distribution OR

    2. Trying to find which histogram demonstrates the least non-uniformity?


    These questions may seem the same, but they are not. Inference is very sensitive to the sample size, whereas descriptive measure take the data at face value.



    If you are going for (1), then the suggestions in the comments or link will work fine. However, if you are trying to find the most uniform histogram, then this is not an inference problem, but a measurement problem...how do you measure non-uniformity?



    At the risk of appearing shamelessly self-promoting, I recently answered a similar question by describing a method I developed to rand distributions by their degree of uniformity. Take a look and see if you think it is relevant to your problem.







    share|cite|improve this answer














    share|cite|improve this answer



    share|cite|improve this answer








    edited Apr 13 '17 at 12:21









    Community

    1




    1










    answered Sep 6 '14 at 5:25







    user76844



















    • $begingroup$
      I am trying to tackle the second one as mentioned in your answer. Could you tell why skewness or kurtosis cannot be a good measure ?
      $endgroup$
      – Sai
      Sep 8 '14 at 3:00












    • $begingroup$
      @Sai the problem with moment-based measures is that they are not unique. The most uniform distribution will certainly lack skew, but kurtosis is not easy to relate directly with uniformity...two distributions can have similar kurtosis but look very different. The path length method I use is based on a key feature of uniformity: its cdf is maximally linear given the constraints.
      $endgroup$
      – user76844
      Sep 8 '14 at 3:48


















    • $begingroup$
      I am trying to tackle the second one as mentioned in your answer. Could you tell why skewness or kurtosis cannot be a good measure ?
      $endgroup$
      – Sai
      Sep 8 '14 at 3:00












    • $begingroup$
      @Sai the problem with moment-based measures is that they are not unique. The most uniform distribution will certainly lack skew, but kurtosis is not easy to relate directly with uniformity...two distributions can have similar kurtosis but look very different. The path length method I use is based on a key feature of uniformity: its cdf is maximally linear given the constraints.
      $endgroup$
      – user76844
      Sep 8 '14 at 3:48
















    $begingroup$
    I am trying to tackle the second one as mentioned in your answer. Could you tell why skewness or kurtosis cannot be a good measure ?
    $endgroup$
    – Sai
    Sep 8 '14 at 3:00






    $begingroup$
    I am trying to tackle the second one as mentioned in your answer. Could you tell why skewness or kurtosis cannot be a good measure ?
    $endgroup$
    – Sai
    Sep 8 '14 at 3:00














    $begingroup$
    @Sai the problem with moment-based measures is that they are not unique. The most uniform distribution will certainly lack skew, but kurtosis is not easy to relate directly with uniformity...two distributions can have similar kurtosis but look very different. The path length method I use is based on a key feature of uniformity: its cdf is maximally linear given the constraints.
    $endgroup$
    – user76844
    Sep 8 '14 at 3:48




    $begingroup$
    @Sai the problem with moment-based measures is that they are not unique. The most uniform distribution will certainly lack skew, but kurtosis is not easy to relate directly with uniformity...two distributions can have similar kurtosis but look very different. The path length method I use is based on a key feature of uniformity: its cdf is maximally linear given the constraints.
    $endgroup$
    – user76844
    Sep 8 '14 at 3:48











    0












    $begingroup$

    One possible approach would be to use the Chi-square test to compare the "observed" histogram counts with the "expected" uniform distribution.



    The chi-square test statistic or its p-value may be used as a possible metric of "(non)uniformness" - highly non-uniform histograms would tend to have high chi-square values and the corresponding p-values approaching zero.



    In Python:



    from scipy.stats import chisquare
    uniformness = chisquare(counts_vector).pvalue





    share|cite|improve this answer









    $endgroup$


















      0












      $begingroup$

      One possible approach would be to use the Chi-square test to compare the "observed" histogram counts with the "expected" uniform distribution.



      The chi-square test statistic or its p-value may be used as a possible metric of "(non)uniformness" - highly non-uniform histograms would tend to have high chi-square values and the corresponding p-values approaching zero.



      In Python:



      from scipy.stats import chisquare
      uniformness = chisquare(counts_vector).pvalue





      share|cite|improve this answer









      $endgroup$
















        0












        0








        0





        $begingroup$

        One possible approach would be to use the Chi-square test to compare the "observed" histogram counts with the "expected" uniform distribution.



        The chi-square test statistic or its p-value may be used as a possible metric of "(non)uniformness" - highly non-uniform histograms would tend to have high chi-square values and the corresponding p-values approaching zero.



        In Python:



        from scipy.stats import chisquare
        uniformness = chisquare(counts_vector).pvalue





        share|cite|improve this answer









        $endgroup$



        One possible approach would be to use the Chi-square test to compare the "observed" histogram counts with the "expected" uniform distribution.



        The chi-square test statistic or its p-value may be used as a possible metric of "(non)uniformness" - highly non-uniform histograms would tend to have high chi-square values and the corresponding p-values approaching zero.



        In Python:



        from scipy.stats import chisquare
        uniformness = chisquare(counts_vector).pvalue






        share|cite|improve this answer












        share|cite|improve this answer



        share|cite|improve this answer










        answered Jan 25 at 0:02









        KT.KT.

        13616




        13616






























            draft saved

            draft discarded




















































            Thanks for contributing an answer to Mathematics Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            Use MathJax to format equations. MathJax reference.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f921084%2fhow-to-calculate-peakiness-or-uniformity-in-histogram%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            MongoDB - Not Authorized To Execute Command

            How to fix TextFormField cause rebuild widget in Flutter

            in spring boot 2.1 many test slices are not allowed anymore due to multiple @BootstrapWith