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 for Programming
 Forum for Origin C
 Median (and other simple Stats) at Origin C
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic Lock Topic Edit Topic Delete Topic New Topic Reply to Topic

eulez

Spain
Posts

Posted - 07/28/2004 :  11:50:26 AM  Show Profile  Edit Topic  Reply with Quote  View user's IP address  Delete Topic
Hi!

I am beginning with Origin C. I am trying to obtain the "median" value of a Dataset, but I do not know how I could do it.

I get "maximum", "minimum" through ds.max (where ds is a Dataset object) and "mean" with the use of BasicStats and Data_sum.

However I do not find anything about "median" or the other stats from "Statistics On Columns".

I would feel very pleased if anyone could help me. Thank you.

Mike Buess

USA
3037 Posts

Posted - 07/28/2004 :  12:08:23 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
The example under Function:Data_Sum shows you how. Mean is bsStat.mean...

int iSize;
Dataset dsDataIn("Data1_B");
iSize=dsDataIn.GetSize();
Dataset dsSumOfDataIn("Data1_C");
dsSumOfDataIn.SetSize(iSize);
BasicStats bsStat;
Data_sum( &dsDataIn, &bsStat, &dsSumOfDataIn );
printf( "Min = %f\nMax = %f\nMean = %f\nSD = %f\nTotal = %f\nSSDM = %f\nN = %d\nMissing = %d\niMax = %d\niMin = %d",bsStat.min, bsStat.max, bsStat.mean, bsStat.sd, bsStat.total,bsStat.ssdm,bsStat.N, bsStat.Missing, bsStat.iMax, bsStat.iMin );


Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 07/28/2004 12:17:05 PM
Go to Top of Page

eulez

Spain
Posts

Posted - 07/28/2004 :  12:21:40 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Well, that's right, I used this example for "mean" and "sd". But I said that I need "MEDIAN", and "SE", and all the calculation from "Statistics on Columns". I saw at the data.h where BasicStats is placed and there are no "median" or "se" methods.

Thank you.
Go to Top of Page

Mike Buess

USA
3037 Posts

Posted - 07/28/2004 :  12:50:09 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Sorry, I misread your post. You can find the median with Data_percentiles...

Dataset dsA( "Data1_A" );
double dPercent = 50, dPercentile;
Data_percentiles( &dsA, &dPercent, &dPercentile, 1 );
printf( "The 50th percentile is %g\n", dPercentile );

There's a shortcut function called y50 that will also work...

Dataset dsA("Data1_A");
double dP50 = y50(dsA);
printf("50th Percentile of Data1_A is %g", dP50);

Also, see the Median Filtering add-on at the File Exchange...
http://www.originlab.com/FileExchange/details.aspx?C=5&cid=18&fid=83

Not sure about se.

Mike Buess
Origin WebRing Member

Edited by - Mike Buess on 07/28/2004 1:07:36 PM
Go to Top of Page

Gary Lane

USA
150 Posts

Posted - 07/30/2004 :  12:16:48 PM  Show Profile  Edit Reply  Reply with Quote  View user's IP address  Delete Reply
Hi,

Mike got it right for median in Origin v7.5....also:

double se = bsStat.sd/sqrt(bsStat.N);

OC in Origin v8 will have much more robust Statistics capabilities.

Gary

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