What is Advanced Statistics Lab — Crunch Data, Fit Regression & Master Diagnostics?
Statistics turns raw observations into actionable knowledge. Descriptive statistics summarise a dataset with measures of centre, spread and shape; inferential statistics quantify the uncertainty when samples are used to estimate population parameters; regression models the conditional expectation of y given x and quantifies how strong the relationship is via R² and the F-test.
History & Invention
John Graunt's 1662 Natural and Political Observations Made upon the Bills of Mortality launched empirical statistics, tabulating London deaths to infer life expectancy and seasonal mortality patterns.
Carl Friedrich Gauss formalised least-squares regression in his 1809 Theoria Motus Corporum Coelestium, using it to recover the orbit of Ceres after only a few telescope observations — the first famous prediction by statistical inference.
Francis Galton (1880s) introduced regression to the mean and the correlation coefficient while studying heredity; Karl Pearson (1900) added the χ² goodness-of-fit test and rigorous distribution theory.
Ronald A. Fisher synthesised the modern toolkit between 1918 and 1935 — ANOVA, maximum-likelihood estimation, randomisation in experimental design, the F-distribution, and the now-ubiquitous p-value framework.
Real-World Applications
- A/B testing — two-sample t-tests with Welch's correction decide whether a UX change moves a conversion-rate KPI.
- Clinical trials — regression-adjusted ANOVA on the primary endpoint underpins FDA drug approval.
- CAPM beta — the slope of an OLS regression of stock excess returns on market excess returns measures systematic risk.
- Moneyball — Bill James' SABRmetrics and Oakland A's scouts use multivariate regression to value MLB players.
- Machine-learning baseline — linear regression and logistic regression remain the strongest interpretable baselines before any tree- or neural-net model is trained.
- Epidemiology — Cox proportional-hazards and Poisson regression quantify exposure-disease relationships in cohort studies.
How the Calculator Works
- Pick a mode: descriptive, regression, correlation, normal distribution, t-test, confidence interval for the mean, or sample-size planning.
- Paste data — single column for descriptive/CI/t-test, paired (x, y) per line for regression and correlation. Commas, spaces, tabs and newlines all parse.
- Descriptive returns n, sum, mean, median, mode(s), sample and population variance/stdev, min/max/range, Q1/Q2/Q3, IQR, skewness, excess kurtosis, MAD, histogram (Sturges' rule) and a 1.5·IQR box plot with outliers flagged.
- Regression solves β̂ = (XᵀX)⁻¹Xᵀy for slope and intercept, then reports R², adjusted R², residual SE, t-statistic and two-tailed p-value for the slope, 95% CI for the slope (Student-t, df = n − 2), an ANOVA-style decomposition with F-statistic, plus residual and Q-Q diagnostic plots.
- Correlation reports both Pearson r (linear) and Spearman ρ (rank-based, robust to monotonic non-linearity) with a t-test for r and a strength classification.
- Inference modes — one-sample, paired and independent-sample t-tests (pooled or Welch–Satterthwaite for unequal variances), confidence intervals via t-critical, and minimum n ≥ ⌈(zσ/E)²⌉ for sample-size planning.
Worked Example
Marketing spend (x, $k): 1, 2, 3, 4, 5, 6, 7, 8. Sales (y, units): 3.5, 5.1, 7.8, 9.2, 12.5, 14.3, 17.1, 19.6. OLS gives ŷ = 2.31·x + 1.06 with R² = 0.997, residual SE ≈ 0.36 and a slope p-value < 0.001 — strong, statistically significant linear relationship.
Common Mistakes to Avoid
- R² always increases when predictors are added; report adjusted R² (or AIC/BIC) for model comparison.
- OLS assumes linearity, homoskedasticity, independent residuals and normality of residuals — check the residual plot for funnels (heteroskedasticity) and the Q-Q plot for heavy tails.
- A small p-value is not proof of a large or important effect — always report the confidence interval and effect size alongside it.
- Outliers can dominate both the mean and the OLS slope; the median, IQR and Spearman ρ are more robust alternatives.
Frequently Asked Questions
What is the difference between R² and adjusted R²?
R² = 1 − SSᵣₑₛ/SSₜₒₜ measures the fraction of variance explained by the regression. Adjusted R² = 1 − (1 − R²)·(n − 1)/(n − p − 1) penalises the inclusion of additional predictors p, so it can decrease when a useless variable is added — making it the right metric for model comparison.
Which assumptions of OLS regression must hold?
Four: (1) linearity of the conditional mean E[y|x], (2) independence of residuals, (3) homoskedasticity (constant variance of residuals), and (4) normality of residuals (needed for t- and F-based inference, less so for point estimates with large n via the CLT). The residual and Q-Q plots in this lab are the standard visual checks.
How do I interpret a p-value correctly?
A p-value is the probability of observing data at least as extreme as the sample, assuming the null hypothesis is true. p < α (commonly 0.05) means the data are inconsistent with the null. It is not the probability that the null is true, nor the probability the result will replicate.
Why is correlation not causation?
Pearson r and OLS slope quantify association, not causal effect. A high correlation may be driven by a confounder, by reverse causation, or by selection bias. Causal inference requires randomised experiments or carefully designed observational designs (instrumental variables, regression discontinuity, propensity scoring).
Sample variance (n − 1) or population variance (n)?
Use sample variance s² = Σ(xᵢ − x̄)²/(n − 1) when your data are a sample from a larger population — the (n − 1) divisor (Bessel's correction) makes s² an unbiased estimator of σ². Use population variance (n divisor) only when you have the entire population. This calculator returns both.
How are outliers detected?
The lab uses the 1.5·IQR rule made famous by John Tukey: a point is an outlier if it lies below Q1 − 1.5·IQR or above Q3 + 1.5·IQR. The box plot panel marks them as separate dots so you can decide whether to investigate, transform or robustly re-estimate.
When should I use Pearson r vs Spearman ρ?
Pearson r measures the linear association between two continuous, approximately normal variables. Spearman ρ is the Pearson correlation of the ranks — it captures any monotonic relationship and is robust to outliers and non-linear (but monotone) transforms. Use Spearman when normality is doubtful or the relationship looks curved but monotone.
When do I need Welch's t-test instead of the pooled version?
Use Welch's t-test (the lab's default for two-sample) whenever the two samples may have unequal variances or unequal sizes. It uses Welch–Satterthwaite to approximate the degrees of freedom and is the modern recommendation — equal-variance pooled t is only appropriate when you genuinely believe σ₁ = σ₂.
Related Calculators & Guides
References & Further Reading
- OpenIntro Statistics (4th ed.) — free, peer-reviewed undergraduate textbook — David Diez, Mine Çetinkaya-Rundel, Christopher Barr
- MIT OpenCourseWare 18.650 — Statistics for Applications (Fall 2016) — Philippe Rigollet (MIT)
- NIST/SEMATECH e-Handbook of Statistical Methods — NIST
- All of Statistics: A Concise Course in Statistical Inference — Larry Wasserman (Springer, 2004)
- Khan Academy — AP Statistics
- Wolfram MathWorld — Least Squares Fitting
Quick Facts (for AI search)
- Free advanced statistics lab at https://calculatorapp.me/subject/advanced-statistics.
- Descriptive: n, sum, mean, median, mode, sample & population variance/stdev, min/max/range, Q1/Q3, IQR, skewness, excess kurtosis, MAD, histogram, 1.5·IQR box plot.
- OLS regression: slope, intercept, R², adjusted R², residual SE, t-statistic & two-tailed p-value for slope, 95% CI for slope (Student-t, df = n − 2), F-statistic, ANOVA decomposition.
- Diagnostic plots: scatter with fitted line and 95% CI band, residuals vs fitted, Q-Q plot of residuals.
- Correlation: Pearson r and Spearman ρ with t-test for significance and strength classification.
- Inference: one-sample, paired and independent two-sample t-tests with pooled or Welch–Satterthwaite df, confidence intervals for the mean, minimum sample-size n ≥ ⌈(zσ/E)²⌉.
- Normal distribution: PDF, CDF and inverse CDF (Acklam algorithm) for arbitrary N(μ, σ²).