Organize the data to set of bins of equal height

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
2
down vote

favorite












Consider the data in the form data = 1,10,1,12,.... How to organize this data in the set



data1 = Width1,Height,Width2,Height,...,


where Width1, Width2, … are widths of bins (from 0 to 10, from 10 to 25 and so on) which correspond to equal heights Height of the data points inside the bins?










share|improve this question























  • If the data were one dimensional, I'd say use Quantiles, but I guess I have no clue what is being asked. Maybe a small example input and output would help.
    – Michael E2
    45 mins ago










  • @MichaelE2 : consider that each row corresponds to one event. Then the first column data1 is the width of the bin, while the second column is the number of events in this bin. I am looking for a function in Mathematica that automatically finds the widths of the bins in a way such that the number of events in each bin will be equal. Say for data = {1,2,1,3,1,4,1,5,1,25,1,90, if I set the number of events to Height=2, the data1 will be data1 = 3-2, 2,5-4,2,90-25,2
    – John Taylor
    30 mins ago














up vote
2
down vote

favorite












Consider the data in the form data = 1,10,1,12,.... How to organize this data in the set



data1 = Width1,Height,Width2,Height,...,


where Width1, Width2, … are widths of bins (from 0 to 10, from 10 to 25 and so on) which correspond to equal heights Height of the data points inside the bins?










share|improve this question























  • If the data were one dimensional, I'd say use Quantiles, but I guess I have no clue what is being asked. Maybe a small example input and output would help.
    – Michael E2
    45 mins ago










  • @MichaelE2 : consider that each row corresponds to one event. Then the first column data1 is the width of the bin, while the second column is the number of events in this bin. I am looking for a function in Mathematica that automatically finds the widths of the bins in a way such that the number of events in each bin will be equal. Say for data = {1,2,1,3,1,4,1,5,1,25,1,90, if I set the number of events to Height=2, the data1 will be data1 = 3-2, 2,5-4,2,90-25,2
    – John Taylor
    30 mins ago












up vote
2
down vote

favorite









up vote
2
down vote

favorite











Consider the data in the form data = 1,10,1,12,.... How to organize this data in the set



data1 = Width1,Height,Width2,Height,...,


where Width1, Width2, … are widths of bins (from 0 to 10, from 10 to 25 and so on) which correspond to equal heights Height of the data points inside the bins?










share|improve this question















Consider the data in the form data = 1,10,1,12,.... How to organize this data in the set



data1 = Width1,Height,Width2,Height,...,


where Width1, Width2, … are widths of bins (from 0 to 10, from 10 to 25 and so on) which correspond to equal heights Height of the data points inside the bins?







histograms






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 35 mins ago

























asked 1 hour ago









John Taylor

646211




646211











  • If the data were one dimensional, I'd say use Quantiles, but I guess I have no clue what is being asked. Maybe a small example input and output would help.
    – Michael E2
    45 mins ago










  • @MichaelE2 : consider that each row corresponds to one event. Then the first column data1 is the width of the bin, while the second column is the number of events in this bin. I am looking for a function in Mathematica that automatically finds the widths of the bins in a way such that the number of events in each bin will be equal. Say for data = {1,2,1,3,1,4,1,5,1,25,1,90, if I set the number of events to Height=2, the data1 will be data1 = 3-2, 2,5-4,2,90-25,2
    – John Taylor
    30 mins ago
















  • If the data were one dimensional, I'd say use Quantiles, but I guess I have no clue what is being asked. Maybe a small example input and output would help.
    – Michael E2
    45 mins ago










  • @MichaelE2 : consider that each row corresponds to one event. Then the first column data1 is the width of the bin, while the second column is the number of events in this bin. I am looking for a function in Mathematica that automatically finds the widths of the bins in a way such that the number of events in each bin will be equal. Say for data = {1,2,1,3,1,4,1,5,1,25,1,90, if I set the number of events to Height=2, the data1 will be data1 = 3-2, 2,5-4,2,90-25,2
    – John Taylor
    30 mins ago















If the data were one dimensional, I'd say use Quantiles, but I guess I have no clue what is being asked. Maybe a small example input and output would help.
– Michael E2
45 mins ago




If the data were one dimensional, I'd say use Quantiles, but I guess I have no clue what is being asked. Maybe a small example input and output would help.
– Michael E2
45 mins ago












@MichaelE2 : consider that each row corresponds to one event. Then the first column data1 is the width of the bin, while the second column is the number of events in this bin. I am looking for a function in Mathematica that automatically finds the widths of the bins in a way such that the number of events in each bin will be equal. Say for data = {1,2,1,3,1,4,1,5,1,25,1,90, if I set the number of events to Height=2, the data1 will be data1 = 3-2, 2,5-4,2,90-25,2
– John Taylor
30 mins ago




@MichaelE2 : consider that each row corresponds to one event. Then the first column data1 is the width of the bin, while the second column is the number of events in this bin. I am looking for a function in Mathematica that automatically finds the widths of the bins in a way such that the number of events in each bin will be equal. Say for data = {1,2,1,3,1,4,1,5,1,25,1,90, if I set the number of events to Height=2, the data1 will be data1 = 3-2, 2,5-4,2,90-25,2
– John Taylor
30 mins ago










2 Answers
2






active

oldest

votes

















up vote
3
down vote













You can use EmpiricalDistribution and Quantile to determine the bins:



data1 = RandomVariate[NormalDistribution, 100];
ed = EmpiricalDistribution[data1];
n = 10;
binspec = Quantile[ed, Range[0, 1, 1/(n - 1)]];
Histogram[data1, binspec, "Count"]


enter image description here






share|improve this answer




















  • ... the bin heigths are almost equal.
    – kglr
    6 mins ago










  • Seems to leave off the largest data point: Histogram[data1, Append[#, Max@binspec + 1] & /@ binspec, "Count"] Need to nudge the last quantile, I guess.
    – Michael E2
    34 secs ago

















up vote
1
down vote













You can use Histogram to plot histograms.



If you allready know how many points were in one particular bin you could recreate a longer list with values within this one bin, histogram seems to do this counting for you. Your widths (data1[[All,1]]) will need to be changed such that you know the borders of your bins which such be in a list like b1,b2,….
Call Histogram[points, widths]



Feel free to refer to the Documentation and expand Details and Options for further variants.



Edit: e.g.:



Histogram[1,2,3, 50,49,0,10,25,100]





share|improve this answer






















    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: "387"
    ;
    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',
    convertImagesToLinks: false,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f183691%2forganize-the-data-to-set-of-bins-of-equal-height%23new-answer', 'question_page');

    );

    Post as a guest






























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    3
    down vote













    You can use EmpiricalDistribution and Quantile to determine the bins:



    data1 = RandomVariate[NormalDistribution, 100];
    ed = EmpiricalDistribution[data1];
    n = 10;
    binspec = Quantile[ed, Range[0, 1, 1/(n - 1)]];
    Histogram[data1, binspec, "Count"]


    enter image description here






    share|improve this answer




















    • ... the bin heigths are almost equal.
      – kglr
      6 mins ago










    • Seems to leave off the largest data point: Histogram[data1, Append[#, Max@binspec + 1] & /@ binspec, "Count"] Need to nudge the last quantile, I guess.
      – Michael E2
      34 secs ago














    up vote
    3
    down vote













    You can use EmpiricalDistribution and Quantile to determine the bins:



    data1 = RandomVariate[NormalDistribution, 100];
    ed = EmpiricalDistribution[data1];
    n = 10;
    binspec = Quantile[ed, Range[0, 1, 1/(n - 1)]];
    Histogram[data1, binspec, "Count"]


    enter image description here






    share|improve this answer




















    • ... the bin heigths are almost equal.
      – kglr
      6 mins ago










    • Seems to leave off the largest data point: Histogram[data1, Append[#, Max@binspec + 1] & /@ binspec, "Count"] Need to nudge the last quantile, I guess.
      – Michael E2
      34 secs ago












    up vote
    3
    down vote










    up vote
    3
    down vote









    You can use EmpiricalDistribution and Quantile to determine the bins:



    data1 = RandomVariate[NormalDistribution, 100];
    ed = EmpiricalDistribution[data1];
    n = 10;
    binspec = Quantile[ed, Range[0, 1, 1/(n - 1)]];
    Histogram[data1, binspec, "Count"]


    enter image description here






    share|improve this answer












    You can use EmpiricalDistribution and Quantile to determine the bins:



    data1 = RandomVariate[NormalDistribution, 100];
    ed = EmpiricalDistribution[data1];
    n = 10;
    binspec = Quantile[ed, Range[0, 1, 1/(n - 1)]];
    Histogram[data1, binspec, "Count"]


    enter image description here







    share|improve this answer












    share|improve this answer



    share|improve this answer










    answered 12 mins ago









    kglr

    165k8188388




    165k8188388











    • ... the bin heigths are almost equal.
      – kglr
      6 mins ago










    • Seems to leave off the largest data point: Histogram[data1, Append[#, Max@binspec + 1] & /@ binspec, "Count"] Need to nudge the last quantile, I guess.
      – Michael E2
      34 secs ago
















    • ... the bin heigths are almost equal.
      – kglr
      6 mins ago










    • Seems to leave off the largest data point: Histogram[data1, Append[#, Max@binspec + 1] & /@ binspec, "Count"] Need to nudge the last quantile, I guess.
      – Michael E2
      34 secs ago















    ... the bin heigths are almost equal.
    – kglr
    6 mins ago




    ... the bin heigths are almost equal.
    – kglr
    6 mins ago












    Seems to leave off the largest data point: Histogram[data1, Append[#, Max@binspec + 1] & /@ binspec, "Count"] Need to nudge the last quantile, I guess.
    – Michael E2
    34 secs ago




    Seems to leave off the largest data point: Histogram[data1, Append[#, Max@binspec + 1] & /@ binspec, "Count"] Need to nudge the last quantile, I guess.
    – Michael E2
    34 secs ago










    up vote
    1
    down vote













    You can use Histogram to plot histograms.



    If you allready know how many points were in one particular bin you could recreate a longer list with values within this one bin, histogram seems to do this counting for you. Your widths (data1[[All,1]]) will need to be changed such that you know the borders of your bins which such be in a list like b1,b2,….
    Call Histogram[points, widths]



    Feel free to refer to the Documentation and expand Details and Options for further variants.



    Edit: e.g.:



    Histogram[1,2,3, 50,49,0,10,25,100]





    share|improve this answer


























      up vote
      1
      down vote













      You can use Histogram to plot histograms.



      If you allready know how many points were in one particular bin you could recreate a longer list with values within this one bin, histogram seems to do this counting for you. Your widths (data1[[All,1]]) will need to be changed such that you know the borders of your bins which such be in a list like b1,b2,….
      Call Histogram[points, widths]



      Feel free to refer to the Documentation and expand Details and Options for further variants.



      Edit: e.g.:



      Histogram[1,2,3, 50,49,0,10,25,100]





      share|improve this answer
























        up vote
        1
        down vote










        up vote
        1
        down vote









        You can use Histogram to plot histograms.



        If you allready know how many points were in one particular bin you could recreate a longer list with values within this one bin, histogram seems to do this counting for you. Your widths (data1[[All,1]]) will need to be changed such that you know the borders of your bins which such be in a list like b1,b2,….
        Call Histogram[points, widths]



        Feel free to refer to the Documentation and expand Details and Options for further variants.



        Edit: e.g.:



        Histogram[1,2,3, 50,49,0,10,25,100]





        share|improve this answer














        You can use Histogram to plot histograms.



        If you allready know how many points were in one particular bin you could recreate a longer list with values within this one bin, histogram seems to do this counting for you. Your widths (data1[[All,1]]) will need to be changed such that you know the borders of your bins which such be in a list like b1,b2,….
        Call Histogram[points, widths]



        Feel free to refer to the Documentation and expand Details and Options for further variants.



        Edit: e.g.:



        Histogram[1,2,3, 50,49,0,10,25,100]






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited 13 mins ago

























        answered 27 mins ago









        Gladaed

        977




        977



























             

            draft saved


            draft discarded















































             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmathematica.stackexchange.com%2fquestions%2f183691%2forganize-the-data-to-set-of-bins-of-equal-height%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What does second last employer means? [closed]

            Installing NextGIS Connect into QGIS 3?

            One-line joke