Sample Mean and Variance From Scratch
Difficulty: Easy · Concept: Probability & Statistics — Expectation, Variance, Covariance
For a dataset , the mean is , and the population variance is the average squared deviation from that mean: . Every summary statistic on this site — standard deviation, standardization/z-scores, the Gaussian assumption behind MSE — builds on these two numbers.
Your task: implement sample_mean_and_variance(data), returning a (mean, variance) tuple. Use the population definition above (divide by , not ).
Next: Standardize a Dataset (Z-Score Normalization) (a harder variant), or skip ahead to Bayes' Theorem: Posterior From Scratch