Skip to content

Commit 1fb288a

Browse files
Update better-than-average-calculating-geometric-means-using-SQL.md
1 parent d6e90d8 commit 1fb288a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

better-than-average-calculating-geometric-means-using-SQL.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Geometric means are also appropriate when summarizing ratios or percentages. In
3333
select EXP(SUM(LN(pay))/COUNT(pay)) from employee;
3434
```
3535

36-
Alternative if you are using Google BigQuery, you can create User Defined Aggregate Function for Geometric Mean as following:
36+
Alternatively if you are using Google BigQuery, you can create User Defined Aggregate Function for Geometric Mean as following:
3737

3838
```sql
3939
CREATE TEMP AGGREGATE FUNCTION geometric_mean(
@@ -68,7 +68,6 @@ The calculation of the geometric mean requires that all values are non-zero and
6868

6969
If you have negative numbers, you will need to convert those numbers to a positive value before calculating the geometric mean. You can then assign the resulting geometric mean a negative value. If your data set contains both positive and negative values, you will have to separate them and find the geometric means for each group, and you can then find the weighted average of their individual geometric means to find the total geometric mean for the full data set.
7070

71-
If none of these options appeals to you, you are not alone! There is controversy among statisticians about what is the best method for dealing with these values. You may want to calculate several types of averages and decide what makes the most sense for you and the results you are trying to report.
7271

7372
# Conclusion
7473
If you are working with non-normal data, you should consider using the geometric mean as the measure of central tendency for your data. The geometric mean is a more robust and accurate way to find your average or expected value for data that is skewed, scaled, or proportional.

0 commit comments

Comments
 (0)