Using the Right Mean for Meaningful Performance Analysis
This article discusses statistical approaches used in the world of web performance evaluation using real-world performance data.
Join the DZone community and get the full member experience.Join For Free
performance analytics is a field that deals with huge discrete data sets that need to be grouped, organized, and aggregated to gain an understanding of the data. synthetic and real user monitoring are the two most popular techniques to evaluate the performance of websites; both these techniques use historical data sets to evaluate performance.
in web performance analytics, it is preferred to use statistical values that describe a central tendency (the odd number measure of central location) for the discrete data set under observation. the statistical metric can be used to evaluate and analyze the data. these data sets have innumerable data points that need to be aggregated using different statistical approaches.
with the number of statistical metrics available, the big question is how do you determine the right statistical metric for a given data set. mean, median, and geometric mean are all valid measures of central tendency, but under different conditions, some measures of central tendency are more appropriate to use than others.
this article discusses different statistical approaches used in the world of web performance evaluation and the methods preferred in different contexts of performance analysis using real-world performance data.
common statistical metrics
here are some common statistical metrics you should know about.
arithmetic mean (average)
the average is used to describe a single central value in a large set of discrete data. the mathematical formula to calculate the average is: the average is equal to the sum of all data points divided by the number of items, where n represents the number of data samples.
median is the middle score for a set of data that has been arranged in the order of magnitude. let us consider a set of data point as [12, 31, 44, 47, 22, 18, 60, 75, 80] . to get the median of the data set, the data points need to be sorted in ascending order: 12, 18, 22, 31, 44, 47, 60, 75, 80 .
the median for the above data set is 44, as the middle item is ( n +1)/2 if there's an odd number of items. the median would be n /2 if there is an even number of items in the series.
the geometric mean is the n th positive root of the product of n positive given values. the mathematical formula to calculate the geometric mean for x containing n discrete set of data points is:
standard deviation is used for measuring the extent of variation of the data samples around the center. the mathematical formulae to calculate the standard deviation for a set of data samples is:
...where a denotes the average of n data samples of value x .
determining the right statistical approach
the two graphs below illustrate the different data distributions we come across in web performance monitoring. using the formulae explained above, we have derived the average, median and the geometric mean of the web page load time for website a and b.
web page load time website a:
web page load time website b:
let's discuss a few use cases to understand how different statistical metrics are applicable in different scenarios.
use case 1
g1 — scatter plot showing web page load time data set:
g2 — histogram showing the distribution of data:
the graphs g1 and g2 plot data for web page load time. the uneven distribution of the data points in the scatter plot and histogram helps us understand how inconsistent the load time is.
we can see a higher number of data points in the trailing end of the gaussian distribution in the histogram (g2); this means that most of the data points are of higher value.
what would be a good statistical metric in such cases? before answering this, lets us take an example. consider the following data set:
dataset = [4,4.3,5,6.5,6.8,7,7.2,20,30]
if we use the median, it gives a value of 6.8. but most of the data points tend towards a higher range with 30 being the highest. so, taking the median value in cases with higher outliers is not an accurate estimate of the page load time. median should be used for data sets with fewer outliers and values that are concentrated towards the center of the gaussian distribution.
now let us take the average for this same data set. this gives us a value of 27.4 which is slightly more skewed towards the outlier values. once again, the average is not an accurate measure for web page load time.
since median and average don’t apply to this set of data, let us consider the geometric mean. we get a value of 7.8 using geometric mean; this value is closer to the central value and is not skewed to the higher or lower values in the data set.
in this use case, we have determined the geometric mean as the most accurate statistical method to analyze the data.
use case 2
g3 — scatter plot showing web page load time data set:
g4 — histogram shown the distribution of data:
in the graphs above (g3 and g4), most of the data points are close to each other with a higher population in the center of the gaussian surface. the difference between each of the data points is much less than the distribution considered in the previous scenario. this indicates a consistent page load time across different test runs.
using average or median to evaluate the central tendency would be more accurate in this case as there are not many outliers so the average wouldn’t be skewed towards the outlier values.
use case 3
the above data distribution shows the web page load time for two different websites. in performance analysis, we need to evaluate the consistency of a web page. and if there is high volatility in the page performance then we should be able to measure the difference between the central value versus the outliers.
in this case, the standard deviation values are 9.1 and 1.7 seconds for website a and b respectively while the median for website a and b are 26.6 and 18.1 seconds. based on the standard deviation values, we see there are data points for website a at 36 secs (median + sd) and website b at 20 secs (median + sd). this means that website a had a high number of data points concentrated at 36 secs or more and website b had high number data points concentrated at 20 secs or more.
to know what percent of data had a higher value when compared to the standard deviation we can use the cumulative distribution graph.
website a: website b:
from the cumulative distribution graph shown above, we can see that website a had almost 20% of data points higher than the standard deviation values whereas website b had 10% of data more than standard deviation value.
standard deviation can be used for evaluating how far and consistent the data points are with respect to the central value of data distribution in performance analysis.
median and average are applicable when the data points are concentrated towards the center of the gaussian distribution. on the other hand, if there are more data points distributed towards the tail of the gaussian distribution and there is a high difference between each data point, then geometric mean would be a better choice. standard deviation should be used to understand the variance of the data points from the median value and to gauge the consistency of the site's performance.
Published at DZone with permission of Kameerath Abdul Kareem, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.