| **Navigation:**  [[templates.htm|Templates]] > Guide to all Templates > [[additional libraries and templates.htm|Additional Libraries and Templates]] > Statistics Library >====== UPPERQUARTILE (upper quartile value of a set) ====== | [[summ summation of a set .htm|{{btn_prev_n.gif|Previous page}}]][[additional libraries and templates.htm|{{btn_home_n.gif|Return to chapter overview}}]][[variancep variance of a population .htm|{{btn_next_n.gif|Next page}}]] | | || **UPPERQUARTILE**(//dataset//) {{blk2blue.jpg|blk2blue.jpg}} | **UPPERQUARTILE** | Returns the median of the upper half of an ordered numeric data set. | | //Dataset// | The label of a QUEUE with its first component field defined as a REAL. | **UPPERQUARTILE **computes a value such that at most 75% of the set's values are less than the amount, and at most 25% of the set's values are greater than the amount. The function operates on the numeric set defined by all the entries in the first component of the designated QUEUE (//dataset//). For example, given the data set: [1,2,3,4,5,6,7,8] the upper quartile value is 6.5. In general, the UPPERQUARTILE function is only meaningful when the number of elements in the data set is large (ie. greater than 20). **See also:** [[lowerquartile lower quartile value of a set .htm|LOWERQUARTILE]] [[percentile pth percentile value of a set .htm|PERCENTILE]]. {{notebox.jpg|NoteBox.jpg}} The passed data set does not have to be sorted. The function copies the passed set. The passed data set is unchanged. **Return DataType:**     REAL **Example:** **StatSetXY  QUEUE,PRE()** **X           REAL** **           END** **UpperQuartileOfSet    REAL** **CODE** ** FREE(StatSetX)                     !free the QUEUE** ** CLEAR(STADAT:RECORD)               !clear the record buffer** ** STADAT:Id = STA:Id                 !prime the record buffer** ** STADAT:ItemNumber = 1** ** SET(STADAT:KeyIdItemNumber,STADAT:KeyIdItemNumber !position file pointer** ** LOOP                               !load the QUEUE** **   NEXT(StatisticsData)             !read next record** **   IF ERRORCODE() OR STADAT:Id NOT = STA:Id** **     BREAK** **   ELSE** **     StatSetX:X = STADAT:X         !load the QUEUE buffer** **     ADD(StatSetX)                 !add to the QUEUE** **   END** ** END** ** UpperQuartileOfSet = UPPERQUARTILE(StatSetX)   !call UPPERQUARTILE**