MGMP returns the Monthly geometric mean of a specified variable, adding one (1) to all values and then subtracting 1 from the end result if a zero is in the data. The result is stored on the last day of the month.
SYNTAX:
MGMP(Cx, optional Time Increment)
where :
Cx is a conditional variable x
Time Increment Optional - specifies the source variables (Cx) Frequency when the Source Variable (CX) and target variable's (i.e. the variable being calculated) frequencies do not match.
NOTES:
The variable being averaged must be specified as a Conditional Variable (use "C" instead of "V")
The result is stored based on target variables frequency:
In all cases: blank and negative values are ignored in the calculation. If there are any zeros in the data, all values, including zeros (0) are increased by one (1). The end result is then reduced by one (1) to compensate. If no zeros are in the data, the geometric mean is calculated directly on the values (i.e. one is NOT added to any values).
See Also: MGM, MGMC
EXAMPLE 1: Return Monthly geometric mean from a variable, adding 1 to all values and subtracting 1 from end result as data contains a zero.
Source variable (71) is set to Daily and Target variable (108) is also set to Daily. Because both the Source and Target variables are the same (Daily), the time increment BYDAY will be used.
V108 = MGMP(C71)
Variable 108 will contain the monthly geometric mean of variable 71, adding one to all non-negative values and subtracting 1 from the result of the geometric mean calculation:
EXAMPLE 2: Return Monthly geometric mean from a variable, where no zeros in data
In this case, since there are no zeros in the data set the calculation returns the geometric mean of 3, 11, and 7.
V4204 = MGMP(C4201)
EXAMPLE 3: Return the Monthly geometric mean from an Hourly variable into a Daily Calculation, adding 1 to all values and subtracting 1 from end result.
Source variable (71) is set to Hourly and Target variable (108) is set to Daily.
V71 - Is a hourly parameter
V108 - Is a daily calculation
V108 = MGMP(C71,BYHOUR)
Note: You MUST specify the Time Increment (BYHOUR) that matches the source variables frequency (IE the source variable V71 is Hourly, therefore we specify BYHOUR) in order for the function to return the correct value.
See: Working with Daily Detail Variables in Calculations.