The Origin Forum
File Exchange
Try Origin for Free
The Origin Forum
Home | Profile | Register | Active Topics | Members | Search | FAQ | Send File to Tech support
Username:
Password:
Save Password
Forgot your Password? | Admin Options

 All Forums
 Origin Forum
 Origin Forum
 Basic Binning
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

AndreaP88

6 Posts

Posted - 09/18/2014 :  05:04:16 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi!

I guess my question is a common issue, so I ask it again in case something changed with the new version of Origin.

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 Origin?

Thanks in advance!

Origin 9.1.0
Windows 8.1

Edited by - AndreaP88 on 09/18/2014 05:42:53 AM

Hideo Fujii

USA
1582 Posts

Posted - 09/18/2014 :  5:50:51 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi AndreaP88,

For Procedure A, please try the following for your XY worksheet (col(1) for the 1st column, col(2) for 2nd column):

1) Sort the worksheet on the X column ascending
2) Get min and max of X column by:
sum(col(1));
  sum.min=;
  sum.max=;
3) Run the freq counts with:
- Set the Input to X column
- Turn OFF the "Auto" check box of the bin begin and end
- Enter the above min and max values there
- Select "Number of Bins" for Step By option, and enter the number of bins of your choice

4) Add extra column in the original XY worksheet, and run the following
script to set the group# in this extra column
/////////////////////////
range dest=1!col(3);
range ref=2!col(3);
NB=ref.getSize();
start=0;
gg=1;
for(ii=1; ii<=NB; ii++) {
  NJ=ref[ii];
  for(jj=1; jj<=NJ; jj++) {
    dest[start+jj]=gg;
  }
  start=start+jj-1;
  gg++;
}
dest[start+1]=gg-1; //for the last cell as max
/////////////////////////////
5) For col(2), run Stats on Column such that:
- Set the Recalculate mode to None
- Grouping Range set to col(3) for mean and SD.

6) In the result, insert a column before the Mean, then
- copy-and-paste the bin centers in freq table in 3) into this new column.
- Set the designation of this column as X.

Hope this helps.

--Hideo Fujii
OriginLab
Go to Top of Page
  Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
The Origin Forum © 2020 Originlab Corporation Go To Top Of Page
Snitz Forums 2000