Home : Products : Hach WIMS : Hach WIMS Client : Documentation : Function Reference : Math Toolbox Functions : LMED
Q10754 - INFO: LMED

LMED returns the median value out of a specified number of values.  If the required number of values is not found within the search range the function returns no value (blank).

SYNTAX:

LMED(Cx, n, Range, Options)
where :
Cx is a conditional variable x
n specifies the number of values to get a median of
Range specifies the maximum range of days to search backward when looking for the specified number of values.  Example: if you set this at 366, the function will look for the specified number of values (n) until it finds all of them or has looked in 366 days.
Options indicate when to start looking and when to calculate the value.  The following lists the settings for the options parameter:

Value Start on Calc on
1 Today Every Day
2 Today 1st of month
3 Today Last of Month
4 Yesterday Every Day
5 Yesterday 1st of month
6 Yesterday Last of Month

NOTES:

This function will only calculate a median if the specified number of values (n) are found

EXAMPLE:

V97 = LMED(V70, 5, 183, 1)

This example searches variable 70 for the last 5 values, starting today and looking back up to 183 days.  Once the last 5 values are found, the Median is calculated and stored in variable 97:

 

Example with MDL Rules:

V = LMED(V5261,3,30,1)  and V = LMED(V5261,4,30,1)

On calculated variables, it is possible to elect to cascade MDL rules or not. Below is an example of cascading MOST frequent MDL symbol, ALL MDL symbols, and NONE or no MDL symbols. This also shows the difference between even number of data points and an odd number of data points when choosing a median value.

V9563 and V9564 - Most Frequent MDL Symbol
V9567 and V9565 - All MDL Symbols
V9568 and V9566 - No MDL Symbols

V9563, V9567, and V9568 have odd number of data points
V9564, V9565, and V9566 have even number of data points

Related Articles
No Related Articles Available.

Article Attachments
No Attachments Available.

Related External Links
No Related Links Available.
Help us improve this article...
What did you think of this article?

poor 
1
2
3
4
5
6
7
8
9
10

 excellent
Tell us why you rated the content this way. (optional)
 
Approved Comments...
No user comments available for this article.
Created on 2/13/2008 11:49 AM.
Last Modified on 8/25/2016 7:15 AM.
Last Modified by Scott Dorner.
Article has been viewed 4197 times.
Rated 5 out of 10 based on 5 votes.
Print Article
Email Article