Organize the data to set of bins of equal height
Clash 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?
histograms
add a comment |Â
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?
histograms
If the data were one dimensional, I'd say useQuantiles
, 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
add a comment |Â
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?
histograms
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
histograms
edited 35 mins ago
asked 1 hour ago
John Taylor
646211
646211
If the data were one dimensional, I'd say useQuantiles
, 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
add a comment |Â
If the data were one dimensional, I'd say useQuantiles
, 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
add a comment |Â
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"]
... 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
add a comment |Â
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]
add a comment |Â
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"]
... 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
add a comment |Â
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"]
... 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
add a comment |Â
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"]
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"]
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
add a comment |Â
... 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
add a comment |Â
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]
add a comment |Â
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]
add a comment |Â
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]
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]
edited 13 mins ago
answered 27 mins ago
Gladaed
977
977
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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