This version of asrol improves the calculation of the product of values and the geometric mean. Since both the statistics involve the multiplication of values in a given window, the presence of missing values and zeros present a challenge to getting the desired results. Following are the defaults in asrol to deal with missing values and zeros:
7.1 : Missing values are ignored when calculating the product or the geometric mean of values.
7.2 : To be consistent with Stata's default for geometric mean calculations, (see ameans), the default in asrol is to ignore zeros and negative number. So
Code:
the geometric mean of 0,2,4,6 is 3.6342412, that is [2 * 4 * 6]^(1/3).
Code:
the geometric mean of 0,-2,4,6 is 4.8989795, that is [4 * 6]^(1/2).
7.3 : Zeros are considered when calculating the product of values. So
Code:
the product of 0,2,4,6 is 0
Two variations are possible when we want to treat zeros differently. These are discussed below:
7.4 Option ignorezero: This option can be used to ignore zeros when calculating the product of values. Therefore, when the zero is ignored,
Code:
the product of 0,2,4,6 is 48
7.5 Option add(#): This option adds a constant # to each value in the range before calculating the product or the geometric mean. Once the required statistic is calculated, then the constant is subtracted back. So using option add(1), t
Code:
the product of 0,.2,.4,.6 is 1.6880001 = [1+0 * 1+.2 * 1+.4 * 1+.6] - 1
Code:
geometric mean is .280434 = [(1+0 * 1+.2 * 1+.4 * 1+.6)^(1/4)] - 1.
0 Response to ASROL Version update: Improvements in the calculation of geometric mean and products in a rolling window and over groups in Stata
Post a Comment