T O P I C R E V I E W |
eulez |
Posted - 07/28/2004 : 11:50:26 AM 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. |
4 L A T E S T R E P L I E S (Newest First) |
Gary Lane |
Posted - 07/30/2004 : 12:16:48 PM 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
|
Mike Buess |
Posted - 07/28/2004 : 12:50:09 PM 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 |
eulez |
Posted - 07/28/2004 : 12:21:40 PM 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.
|
Mike Buess |
Posted - 07/28/2004 : 12:08:23 PM 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 |
|
|