[1] 1 2 3 4
[1] 2.5
[1] 2.5
Measure of: Central tendency
AKA: Arithmetic mean; average; \(\bar{x}\) (sample mean); \(\mu\) (population mean); \(\mu_x\) (population mean)
Distinct from: Geometric mean (GM); Harmonic mean (HM); generalized mean/ Power mean; weighted arithmetic mean
English: Take a list of numbers, sum those numbers, and then divide by the number of numbers.
Formalization:
\[ \bar{x}=\frac{1}{n}(\sum^{n}_{i=1}x_i)=\frac{x_1+x_2+...+x_n}{n} \]
Cites: Wikipedia ; Wikidata ; Wolfram
Code
Documentation: mean: Arithmetic Mean
Examples:
Documentation: numpy.mean
Examples:
Documentation: PostgreSQL AVG Function
library(DBI)
# Create an ephemeral in-memory RSQLite database
#con <- dbConnect(RSQLite::SQLite(), dbname = ":memory:")
#dbListTables(con)
#dbWriteTable(con, "mtcars", mtcars)
#dbListTables(con)
#Configuration failed because libpq was not found. Try installing:
#* deb: libpq-dev libssl-dev (Debian, Ubuntu, etc)
#install.packages('RPostgres')
#remotes::install_github("r-dbi/RPostgres")
#Took forever because my file permissions were broken
#pg_lsclusters
require(RPostgres)
Loading required package: RPostgres
Bayesian average; Solving an age-old problem using Bayesian Average; Of bayesian average and star ratings; Bayesian Average Ratings ;
English: The Bayesian average is the weighted average of a prior and the observed sample average. When would you want this? When you have strong beliefs about the true mean, or when sample size is too small to reliable calculate a mean. For example a movie rating website where a movie may have only a single 5 star rating and so would rank higher than the Godfather with over a 100 almost all 5 star ratings.
Formalization:
\[ \bar{x}=\frac{C*m+(\sum^{n}_{i=1}x_i)}{c+n} \]
Where \(m\) is a prior for true mean, and \(C\) is a constant representing how many elements would be necessary to reliably estimate a sample mean.
Code