Statistiques
Estimation, tests, régression — la science de l'inférence à partir des données.
§ 1 Statistiques descriptives
Pour un échantillon $(x_1,\ldots,x_n)$ :
- Moyenne : $\bar x = \dfrac{1}{n}\sum_{i=1}^n x_i$
- Médiane : valeur centrale (ordonnée), moins sensible aux outliers
- Mode : valeur la plus fréquente
- Variance empirique : $s^2 = \dfrac{1}{n}\sum(x_i-\bar x)^2$ (ou $\frac{1}{n-1}$ pour variance corrigée)
- Écart-type : $s = \sqrt{s^2}$
- Étendue : $\max - \min$
- IQR : $Q_3 - Q_1$ (écart interquartile)
- Coefficient de variation : $CV = s/\bar x$
- Asymétrie (skewness) : $\gamma_1 = \dfrac{m_3}{s^3}$ où $m_k = \frac{1}{n}\sum(x_i-\bar x)^k$
- Aplatissement (kurtosis) : $\gamma_2 = \dfrac{m_4}{s^4} - 3$ (excès par rapport à la normale)
- Normale : $\gamma_1=0$, $\gamma_2=0$. Leptokurtique si $\gamma_2>0$.
§ 2 Théorie de l'estimation
Un estimateur de $\theta$ est une statistique $\hat\theta = g(X_1,\ldots,X_n)$. Propriétés souhaitables :
- Sans biais : $\mathbb{E}[\hat\theta] = \theta$ (biais $= \mathbb{E}[\hat\theta]-\theta = 0$)
- Convergent : $\hat\theta_n\xrightarrow{\mathbb{P}}\theta$ quand $n\to\infty$
- Efficace : variance minimale parmi les estimateurs sans biais (ESBV)
- Robuste : peu sensible aux déviations du modèle
Pour tout estimateur sans biais $\hat\theta$ de $\theta$ :
$I_n(\theta)$ est l'information de Fisher. Un estimateur atteignant cette borne est dit efficace.
L'estimateur du maximum de vraisemblance maximise $L(\theta) = \prod_{i=1}^n f(x_i;\theta)$ (ou équivalent $\ell(\theta)=\ln L(\theta)$) :
Propriétés asymptotiques : convergent, asymptotiquement efficace, $\sqrt{n}(\hat\theta_{MV}-\theta)\xrightarrow{\mathcal{L}}\mathcal{N}(0, I_1(\theta)^{-1})$.
| Modèle | $\hat\theta_{MV}$ | Sans biais ? |
|---|---|---|
| $\mathcal{N}(\mu,\sigma^2)$, $\mu$ inconnu | $\hat\mu = \bar X$ | Oui |
| $\mathcal{N}(\mu,\sigma^2)$, $\sigma^2$ inconnu | $\hat\sigma^2 = \frac{1}{n}\sum(X_i-\bar X)^2$ | Non ($S^2=\frac{n}{n-1}\hat\sigma^2$ est sans biais) |
| $\mathcal{E}(\lambda)$ | $\hat\lambda = 1/\bar X$ | Non (biaisé) |
| $\mathcal{B}(1,p)$ | $\hat p = \bar X$ | Oui |
§ 3 Intervalles de confiance
Un IC à niveau $1-\alpha$ pour $\theta$ est un intervalle aléatoire $[L(X),U(X)]$ tel que :
Interprétation fréquentiste : si on répète l'expérience, $100(1-\alpha)\%$ des IC construits contiendront $\theta$.
| Paramètre | Conditions | IC à $1-\alpha$ |
|---|---|---|
| Moyenne $\mu$ | $\sigma^2$ connu, $n$ qqcq | $\bar X \pm z_{\alpha/2}\dfrac{\sigma}{\sqrt{n}}$ |
| Moyenne $\mu$ | $\sigma^2$ inconnu, $n$ grand | $\bar X \pm z_{\alpha/2}\dfrac{S}{\sqrt{n}}$ |
| Moyenne $\mu$ | $\sigma^2$ inconnu, $n$ petit, normale | $\bar X \pm t_{n-1,\alpha/2}\dfrac{S}{\sqrt{n}}$ |
| Proportion $p$ | $np\geq 5$, $n(1-p)\geq 5$ | $\hat p \pm z_{\alpha/2}\sqrt{\hat p(1-\hat p)/n}$ |
| Variance $\sigma^2$ | Population normale | $\left[\dfrac{(n-1)S^2}{\chi^2_{n-1,\alpha/2}},\, \dfrac{(n-1)S^2}{\chi^2_{n-1,1-\alpha/2}}\right]$ |
Où $z_{\alpha/2} = \Phi^{-1}(1-\alpha/2)$ (quantile de $\mathcal{N}(0,1)$) et $t_{n-1,\alpha/2}$ quantile de Student à $n-1$ degrés de liberté.
§ 4 Tests d'hypothèses
On teste $H_0$ (hypothèse nulle) contre $H_1$ (alternative). La statistique de test $T$ suit une loi connue sous $H_0$. On rejette $H_0$ si $T$ tombe dans la zone de rejet $\mathcal{R}$.
- Erreur de type I : rejeter $H_0$ quand elle est vraie. Probabilité $= \alpha$ (niveau du test)
- Erreur de type II : accepter $H_0$ quand elle est fausse. Probabilité $= \beta$
- Puissance : $1-\beta = \mathbb{P}(\text{rejeter }H_0 | H_1\text{ vraie})$
- $p$-valeur : probabilité (sous $H_0$) d'observer une statistique aussi extrême que celle observée
| Test | $H_0$ | Statistique | Loi sous $H_0$ |
|---|---|---|---|
| $z$-test | $\mu=\mu_0$ ($\sigma$ connu) | $Z=\frac{\bar X-\mu_0}{\sigma/\sqrt{n}}$ | $\mathcal{N}(0,1)$ |
| $t$-test 1 éch. | $\mu=\mu_0$ ($\sigma$ inconnu) | $T=\frac{\bar X-\mu_0}{S/\sqrt{n}}$ | $t_{n-1}$ |
| $t$-test 2 éch. | $\mu_1=\mu_2$ | $T=\frac{\bar X_1-\bar X_2}{S_p\sqrt{1/n_1+1/n_2}}$ | $t_{n_1+n_2-2}$ |
| $\chi^2$ ajustement | Loi $F_0$ spécifiée | $\sum\frac{(O_i-E_i)^2}{E_i}$ | $\chi^2_{k-1}$ |
| $\chi^2$ indépendance | Indépendance | $\sum\frac{(O_{ij}-E_{ij})^2}{E_{ij}}$ | $\chi^2_{(r-1)(c-1)}$ |
| $F$-test | $\sigma_1^2=\sigma_2^2$ | $F=S_1^2/S_2^2$ | $F_{n_1-1,n_2-1}$ |
Pour tester $H_0:\theta=\theta_0$ contre $H_1:\theta=\theta_1$ (simples), le test le plus puissant au niveau $\alpha$ est le test de rapport de vraisemblance : rejeter $H_0$ si $\Lambda(X) = L(\theta_1;X)/L(\theta_0;X) > c_\alpha$.
§ 5 Régression linéaire
Ces estimateurs sont BLUE (Best Linear Unbiased Estimators) par le théorème de Gauss-Markov.
$R^2\in[0,1]$ : part de variance expliquée par le modèle. $R^2$ ajusté : $\bar R^2 = 1-(1-R^2)\frac{n-1}{n-p-1}$.
Matrice de variance-covariance de $\hat{\boldsymbol\beta}$ : $\sigma^2(\mathbf{X}^\top\mathbf{X})^{-1}$.
- Résidus : $e_i = Y_i - \hat Y_i$. Doit être $\sim\mathcal{N}(0,\sigma^2)$ (QQ-plot)
- Homoscédasticité : variance constante (test de Breusch-Pagan)
- Indépendance : test de Durbin-Watson (autocorrélation)
- Multicolinéarité : VIF (Variance Inflation Factor)
- Points leviers et influents : distance de Cook
§ 6 Analyse de la variance (ANOVA)
$k$ groupes, $n_j$ obs. par groupe. Modèle : $Y_{ij} = \mu + \alpha_j + \varepsilon_{ij}$, $\varepsilon_{ij}\sim\mathcal{N}(0,\sigma^2)$, $\sum n_j\alpha_j=0$.
$H_0:\alpha_1=\cdots=\alpha_k=0$ (toutes les moyennes égales).
$SS_B = \sum n_j(\bar Y_j - \bar Y)^2$ (variance inter), $SS_W = \sum\sum(Y_{ij}-\bar Y_j)^2$ (variance intra).
Après ANOVA significative, tests post-hoc pour identifier les groupes différents :
- Tukey HSD : contrôle le FWER (Family-Wise Error Rate)
- Bonferroni : niveau ajusté $\alpha/m$ pour $m$ comparaisons
- Benjamini-Hochberg : contrôle le FDR (False Discovery Rate)
§ 7 Tests non-paramétriques
Utilisés quand les hypothèses de normalité ne sont pas vérifiées, ou pour des données ordinales.
| Test paramétrique | Équivalent non-paramétrique | Statistique |
|---|---|---|
| $t$-test 1 échantillon | Wilcoxon signé-rangé | $W = \sum\mathrm{sgn}(x_i-\mu_0)\cdot R_i$ |
| $t$-test 2 échantillons | Mann-Whitney $U$ | $U = n_1 n_2 + n_1(n_1+1)/2 - R_1$ |
| ANOVA 1 facteur | Kruskal-Wallis | $H = \frac{12}{n(n+1)}\sum\frac{R_j^2}{n_j}-3(n+1)$ |
| Corrélation de Pearson | Spearman $\rho$, Kendall $\tau$ | Rang des données |
| Test de normalité | Kolmogorov-Smirnov, Shapiro-Wilk | $D=\sup|F_n-F_0|$ |
§ 8 Statistique bayésienne
$\theta$ est traité comme une variable aléatoire. On part d'une loi a priori $\pi(\theta)$ et on la met à jour avec les données via Bayes :
$\pi(\theta|x)$ est la loi a posteriori.
- MAP (Maximum A Posteriori) : $\hat\theta_{MAP} = \arg\max_\theta \pi(\theta|x)$
- EAP (Expected A Posteriori) : $\hat\theta_{EAP} = \mathbb{E}[\theta|x]$ (minimise la perte quadratique)
| Vraisemblance | A priori conjugué | A posteriori |
|---|---|---|
| $\mathcal{B}(n,p)$ | $\mathrm{Beta}(\alpha,\beta)$ | $\mathrm{Beta}(\alpha+x, \beta+n-x)$ |
| $\mathcal{P}(\lambda)$ | $\Gamma(\alpha,\beta)$ | $\Gamma(\alpha+\sum x_i, \beta+n)$ |
| $\mathcal{N}(\mu,\sigma^2)$ ($\sigma$ connu) | $\mathcal{N}(\mu_0,\tau_0^2)$ | $\mathcal{N}(\mu_n,\tau_n^2)$ (combinaison pondérée) |
Quand la loi a posteriori est intractable, on utilise les méthodes de Monte Carlo par chaînes de Markov (MCMC) : algorithme de Metropolis-Hastings, échantillonnage de Gibbs. Ces méthodes permettent d'approcher $\pi(\theta|x)$ par simulation.