# # Logic Behind Calculation Methods

When configuring analysis metrics for event analysis, or displaying metrics during retention or distribution analysis, you need to select the appropriate calculation method according to the content being analyzed. The logic behind some of the methods is explained in this section.

## # Preset calculation methods

- Event totals: how many times the event was triggered.
- Uniques: how many unique users triggered the event.
- Times per user: i.e., total number of times/number of triggering users, how many times each triggering user triggered the event on average.

## # Number

Calculation methods | Logic |
---|---|

Average | Sum of property values / number of property values |

Per user | Sum of property values / number of triggering users, i.e., the average sum of property values per user who triggered the event. |

Median | The middle value of the list of property values arranged in the order from smallest to largest. If there is an even number of property values, the median is the mean of the two middle numbers. |

The mean reflects the average performance of the dataset. But if there are significantly higher or lower values than the other properties, the median is more representative of the overall dataset than the mean. Suppose that four users triggered a total of seven payment events.

Users | Amount per payment |
---|---|

A | 6, 648 |

B | 30, 30, 30 |

C | 128 |

D | 6 |

Calculation method | Logic |
---|---|

N-th Percentile | The property value at the N-th percentile when the property values are sorted from largest to smallest. The median is the 50th percentile. |

In addition to the median, other N-th Percentiles are also commonly used to better measure data distribution. For example, we can observe the changes in N-th Percentiles of the core resource inventory to determine whether to launch new props to consume resources.

Calculation method | Logic |
---|---|

Variance | First obtain the mean value, then calculate the squared deviation of each property value from the mean, and finally calculate Variance as the average of squared deviations |

standard deviation(Std Dev) | Square root of variance |

The Variance and standard deviation (Std Dev) can be used to measure the fluctuation of the data. If the mean paid amount of the experimental group is similar to that of the control groups, but the SD of experimental group is significantly larger than that of the control group, we can see that the metric data of the experimental group is more affected by large purchase orders.

## # List

Calculation method | Logic |
---|---|

Deduplication of array | Count how many non-repeating lists there are, taking the list as a whole. |

Deduplication of set | Get sets first by re-sorting the non-repeating elements of each list, and then count how many non-repeating sets there are. |

Deduplication of element | Extract all the elements in all the lists, and then count how many non-repeating elements there are. |

For games, it is common to record hero IDs included in lineups using a list property. If you want to see how many heroes have been included the lineups, you can use “Number of unique elements” to count them. You can also use “Number of unique lists” or “Number of unique sets” to analyze how many non-repeating lineups there are. Specifically, the latter metric does not consider the order of the heroes in the list or whether they appeared more than once.

Suppose that there are four list-type property values: [a,b,c], [a,b,c,c], [c,b,a] and [a,b,c,d].

- Deduplication of array = 4
- Deduplication of set = 2
- Deduplication of element = 4

## # Boolean

Calculation method | Logic |
---|---|

True totals False totals | Number of events with property value as True/False |

Null totals Not null totals | Number of events with property value as null/not null |