stddev_samp(...)

stddev_samp(...)

Returns a sampled standard deviation of a given set of numbers

Works with the following datatypes:

This function works with 2.1 endpoint(s). What does this mean? »

The stddev_samp(...) function is most commonly used in $select aggregations to return the standard deviation of the a sample of a set of numeric values (Numbers, Doubles, or Moneys). It is most often used to compare the distribution of values against the mean of those values. For example, to fetch the average and standard deviation of the salaries of all of the employees at the City of Chicago:

https://data.cityofchicago.org/resource/tt4n-kn4t.json?$select=avg(annual_salary),stddev_samp(annual_salary)

It can also be used in $group aggregations, like this one to get the average and standard deviation of salaries by job type:

https://data.cityofchicago.org/resource/tt4n-kn4t.json?$select=job_titles,avg(annual_salary),stddev_samp(annual_salary)&$group=job_titles

A similar function, stddev_pop(...) allows you to calculate the standard deviation based on the entire population of values.