I have a set of data (X and Y) and I need to do the following two types of binning:
Procedure A (constant steps)
- Finds the max and min in X
- Divide this interval in a number of bins chosen by me
- For each bin it creates a new set X, say X', where each entry is the central point of each bin (for "central" I mean the following: if I have (0,0,0,1,1) the central is 0.5)
- Of all the points falling in a bin, it takes the mean and standard deviation, and writes these two set of datas in Y' and another column for the error
Procedure B (constant information)
- Does the same thing but this time instead of fixing the number of bins, it allows me to fix the number of points per bin. However the X intervals should be calculated in the following way: if I have (3 ; 3.5 ; 4 ; 4.5 ; 5 ; 5.5) and I want three datas per bin the results should be (3 ; 3.5 ; 4) and ( 4 ; 4.5 ; 5) discarding 5 (so not (3 ; 3.5 ; 4) and ( 4.5 ; 5 ; 5.5) otherwise there is a hole of 0.5 between 4 and 4.5)
Is there a way to do these two calculations with a software?