Page 1 of 1

computing the median

Posted: Tue Sep 03, 2002 9:03 pm
by Nick
is there a recommended way to calculated the median value in RR (it is sometimes preferred to the average).____median in this case is the "middle" value between min and max.____

=> RE: computing the median

Posted: Thu Sep 05, 2002 7:43 am
by kfleming
You could create a preprocessed total that counts the records in the group. Then sort the group by the field whose median value you need.__Create a calc that divides the pre-processed total by 2 and then do a running total. When the running total meets or equals the /2 calc, then you are at the middle value.____Kathleen__R&R Support

==> RE: computing the median

Posted: Thu Sep 05, 2002 2:09 pm
by rlwarden_(Guest)
How would you calculate the median for multiple data fields in the same record?

===> RE: computing the median

Posted: Fri Sep 06, 2002 10:40 pm
by Nick
thanks for the explanation.____if you had more than one field you needed to calculate a median value for - you would need to make an additional pass of the data - with that additional field sorted and calculated - then export that result to an xbase file - which is related to in the next report - that sorts the data on the 2nd field, etc. There would be 1 more report than the number of data fields that needed to have the median calculated.____it^s like doing your own "preprocessed" totals...__the first report would be real simple and only do the needed calculation and export - preparing the data for the 2nd report, etc.____you can use RR to build the index on the exported dbf using flexlink -or- you can used visual foxpro, etc to build the index.____i had one guy that knows more about statistics than i do tell me that one program (SPSS) adjusts the median on an even/odd number of records in the set - if it^s odd- you use the exact value of the midpoint record - if it^s even - you take the average of the two midpoint records (low and high). of course that wouldn^t be correct if the median had to be a "real" value instead of a calculated one.____i think we^ve exhausted the discussion on median for now...__back to you,__nick__