Probability – Random variables – Estimation Confidence
Transcription
Probability – Random variables – Estimation Confidence
Probability – Random variables – Estimation Confidence interval C. Bardel September 2016 1 / 61 Descriptive statistics and inferential statistics Rappel Descriptive statistics Inferential (= inductive) statistics m se2 s description e f Population Summarize the data : numerically graphically Sample Population µ estimation m2 σ2 s σ s p f Estimations, confidence interval Hypothesis tests Based on probability theory 2 / 61 Outline 1 Reminder on probability theory Probability, conditional probability Discrete and continuous random variables Classical distributions functions 2 Estimation ponctuelle, estimation par IC Échantillonnage Estimateur et estimation ponctuelle Estimation par intervalle de confiance 3 / 61 Some definitions Sample space (=“univers”) Set of all possible outcomes in a random experiment Denoted by Ω Example : Rolling a 6-sided dice : Ω={1,2,3,4,5,6} Notion of event Elementary event : a result of a random experiment Example : A=« Get a 3 when rolling a 6-sided dice » Event : a subset of Ω Example : B=« Get more than 4 when rolling a 6-sided dice » Ω is a certain event The empty set ∅ is an impossible event 4 / 61 Set operations Union : (A∪B) or (A or B) A B A∪B 11111111111111 00000000000000 00000000000000 11111111111111 Ω 00000000000000 11111111111111 A 00000000000000 11111111111111 00000000000000 11111111111111 00000000000000 11111111111111 Ā 00000000000000 11111111111111 00000000000000 11111111111111 00000000000000 11111111111111 00000000000000 11111111111111 Complement of A : C (A) or A Intersection : (A∩B) or (A,B) A B A∩B Incompatible events A and B are incompatible if A∩B =∅ 111111 000000 A 000000 111111 000000 111111 000000 111111 000000 111111 000000 111111 B 5 / 61 Probability Definition Probability on Ω : an application P that associate to each event A a positive or null value P(A) verifying the following properties : P(Ω) = 1 If A and B are incompatible then P(A ∪ B) = P(A) + P(B) Properties P(∅) = 0 If A1 , A2 , . . . An are n two by two incompatible events then n X P(A1 ∪ A2 ∪ . . . ∪ An ) = P(Ai ) i=1 P A = 1 − P(A) If A and B are two events and A ⊂ B then P(A) ≤ P(B) P(A) ≤ 1 For two events A and B, P(A ∪ B) = P(A) + P(B) − P(A ∩ B) 6 / 61 Example Question 45% of a population declare that they are practising sport regularly, 30% that they are smoking and 10% that they both smoke and practise sport. An individual is picked up at random in this population. What is the probability that he does not smoke nor practise sport ? 7 / 61 Example Question 45% of a population declare that they are practising sport regularly, 30% that they are smoking and 10% that they both smoke and practise sport. An individual is picked up at random in this population. What is the probability that he does not smoke nor practise sport ? Answer F : «to smoke», P(F ) = 0.3 S : «to practise sport» P(S) = 0.45 P(F ∩ S) = 0.10 P F ∩ S =? ∩ S S Total F 0.1 0.2 0.3 F 0.35 0.35 0.7 Total 0.45 0.55 1 7 / 61 Conditional probability Definition Let’s consider a non empty event B For each event A, the conditional probability of A given B is denoted P(A|B). It is the probability of A if B is known to occur. P(A|B) = PB (A) = P(A ∩ B) P(B) Example Probability for an individual to develop lung cancer given that he smokes Probability to have Alzheimer disease given that he carries the apoE4 allele ⇒ Definition of the penetrance : P(disease|genotype) Sensitivity and specificity of a test, PPV, PNV P(reject hypothesis | hypothesis true) ex : type I error α = P(reject H0|H0 true) 8 / 61 Conditional probability (2) Graphical representation 111111111 000000000 B 000000000 111111111 A 000000000 111111111 000000000 111111111 000000000 111111111 Ω Ω P(A) B A P(A|B ) = P(A ∩ B ) P(B ) Properties PB is a probability : it has all the properties of a probability : P(Ω|B) = 1 and P(∅|B) = 0 P A|B =1-P(A|B) P(A1 ∪ A2 |B)=P(A1 |B)+P(A2 |B)-P(A1 ∩ A2 |B) Beware : A|B is not an event P(A|B) 6= P(B|A) 9 / 61 Independence of 2 events Definition 1 2 events A and B 6= ∅ are independent if an only if P(A|B) = P(A) Likewise, P(B|A) = P(B) Interpretation : the occurrence of an event does not influence the probability of the second event Definition 2 A and B are independent if and only if P(A ∩ B) = P(A) × P(B) Theorem A and B independent ⇔ A and B independent ⇔ A and B independent ⇔ A and B independent 10 / 61 Random variables : introduction Introduction Let Ω be the sample space for a random experiment. A random variable assign numeric values to the different events in the sample space Example 1 : rolling of a 6-sided die random variable (denoted rv) X : « # obtained when rolling a six-sided die » Possible values for this variable : {1, 2, 3, 4, 5, 6} Example 2 : Rhesus factor Rh positive : X=1 Rh negative : X=0 Possibles values for X : {0, 1} X is a rv associated to the experiment « Determination of Rh factor » Note A random variable is a quantitative variable 11 / 61 Classification of random variables Discrete random variables It has a finite or countable number of possible values Examples : Result obtain when rolling a die Number of surgical operation performed in a surgical service Continuous random variables It has an infinite uncountable number of possible values Examples : Blood glucose level Weight of newborn babies 12 / 61 Probability distribution function (1) : discrete RV Definition A probability-mass (or probability distribution) function is a mathematical relationship, that assigns to any possible value xi of a discrete random variable X the probability Pr(X = xi ). Let X be a discrete random variable. Its pdf is defined by : The set of all possible values for X : xi (i ∈ I , finite or countable) The probabilities pi = P(X = xi ) Properties ∀i ∈ I , P(X = xi ) ≥ 0 X X P(X = xi ) = pi = 1 i∈I i∈I Classical representation possible values probabilities x1 p1 ... ... xi pi ... ... xn pn 13 / 61 Probability distribution (2) : continuous random variables Problem The set of all possibles values is infinite uncountable The pdf cannot be define by the set of pairs (xi , pi ) ∀i, P(X = xi ) = pi = 0 Probability density function A probability density function is a function f such that : ∀x ∈ R, f (x) ≥ 0 R +∞ −∞ f (x)dx = 1 (area under the curve equals 1) Probability of an interval f (x ) Z P(a ≤ X ≤ b) = P(a ≤ X ≤ b ) b f (x)dx a a b x 14 / 61 Expected value (=“espérance”) Introduction Expected value = expectation = first moment = (theoretical) mean Indicator of central tendency : gives an idea of the position of possible values on a scale Definition in the case of a discrete rv X The expected value is denoted E(X ) or µx and is defined by : X X E(X ) = xi × P(X = xi ) = xi × pi i i If X (Ω) is finite, then i ∈ [0; n] If X (Ω) is infinite and uncountable, then i ∈ [0; +∞[ Definition in the case of a continuous rv Let X be a continuous rv and f its probability density function. The Z +∞ expected value of X is : E(X ) = xf (x)dx −∞ 15 / 61 Properties of the expected value Linearity Let X and Y be two rv and a et b two real numbers : E(aX + b) = aE(X ) + b E(X + Y ) = E(X ) + E(Y ) Centered variable If E(X ) = 0 then X is a centered rv Y = X − E(X ) is the centered rv associated to X 16 / 61 Variance of a rv Definition (discrete or continuous rv) Let X be a rv. Variance of X is denoted var(X ) or σX2 and is such that : var(X ) = E (X − E(X ))2 = E X 2 − E(X )2 Case 1 : X is a discrete rv X (xi − E(X ))2 × P(X = xi ) Or : i X 2 var(X ) = E X 2 − E(X )2 with E X 2 = xi × P(X = xi ) var(X ) = i Case 2 : X is a continuous rv with pdf f Z +∞ var(X ) = (x − E(X ))2 × f (x)dx −∞ Or : Z +∞ 2 2 2 var(X ) = E X − E(X ) avec E X = x 2 × f (x)dx −∞ 17 / 61 Properties of the variance Positivity A variance is always positive (or null) Variance is not linear ! Let X and Y two rv and a and b two real numbers : var(aX ) = a2 var(X ) var(X + b) = var(X ) var(aX + b) = a2 var(X ) var(X + Y ) = var(X ) + var(Y ) + 2cov(X , Y ) Scaled variable If var(X ) = 1 then X is a scaled rv 18 / 61 Standard deviation of a random variable Definition Let X be a random variable. The standard deviation of X , σX is : σX = p var(X ) σX is a measure of spread in the same unit as X → easier to interpret Standard score (=“Variable centrée réduite”) Let X be a rv with expected value E(X ) and standard deviation σx Z= X − E (X ) σx Z is the standard random variable associated to X E(Z ) = 0 var(Z ) = σZ2 = 1 19 / 61 Bernoulli distribution Probability distribution function Distribution of a rv with only 2 values : 0 and 1 xi pi 0 q 1 p X → Bern(p) p 1-p 0 1 Expected value and variance E(X ) = 0 × q + 1 × p = p E X 2 = 02 × q + 12 × p = p var(X ) = p −p 2 = p(1−p) = pq E(X ) = p var(X ) = pq Use Modeling random experiment results with 2 possible values Example : disease status of an individual 20 / 61 Binomial distribution (1) : introduction Problem In the general population, 85% are Rh+. Let’s consider a group of 5 patients. What is the probability of the event “2 patients in the group are Rh+”? Modeling For a patient : Let X be the rv representing Rh group. ( X = 1 if the patient is Rh+ X = 0 if the patient is RhX → Bern(p) avec p = P(Rh+) = 0.85 For the 5 patients : let Sn be the rv representing the number of Rh patients in the group. The Bernoulli trial is independently repeated 5 times. Sn = X1 + X2 + X3 + X4 + X5 Sn → Binomial 21 / 61 Binomial distribution (2) : probability density function The Binomial distribution and its 2 parameters n and p B(n, p) models the repetition of n independent Bernoulli trials with the same probability p P(Sn = k) : probability of k successes among the n repetitions P(Sn = k) = Ckn (p) k (1 − p) n−k Reminder n n! k Cn = = k k!(n − k)! 0 !=1 for k ∈ {1, 2, . . . , n} # combinations of k elements among n n! = 1 × 2 × . . . × n 22 / 61 Binomial distribution(3) : graphical representation Probability density function 0,2 B(50, 0.1) B(50, 0.5) 0,15 0,1 0,05 0 0 10 20 30 40 50 23 / 61 Binomial distribution (4) : expected value, variance and standard deviation Let Sn → B(n, p) Formulas E(Sn ) = np var(Sn ) = npq √ σSn = npq Proof E(Sn ) = E(X1 + X2 + . . . + Xn ) = E(X1 ) + E(X2 ) + . . . + E(Xn ) = p + p + . . . + p = np var(Sn ) = var(X1 + X2 + . . . + Xn ) = var(X1 ) + var(X2 ) + . . . + var(Xn ) = npq independence 24 / 61 Normal distribution (or Gaussian distribution) Introduction Most important distribution in statistics Models a lot of processes Other distributions can be approximated by a normal distribution, especially when the sample size is large Necessary for numerous statistical tests Parameters 2 parameters : µ, expected value σ, standard deviation (or σ 2 , variance) Notation : X → N (µ, σ) but also X ∼ N (µ, σ) 25 / 61 Normal distribution (2) : probability density function Expression Let X be a rv, normally distributed with expected value µ and standard deviation σ. Its probability density function is : ! 1 1 x −µ 2 ∀x ∈ R f (x) = √ × exp − 2 σ σ 2π Graphical representation 1,2 1 0,8 0,6 0,4 0,2 0 N (10, 2) N (20, 8) 26 / 61 Properties Graphical representation 0,6 N (10, 4) Symmetric about µ 2 points of inflection (point at which the slope of the curve changes direction) at µ − σ et µ + σ 0,4 0,2 Mode = µ= median 0 Area under the curve = 1 0 20 Linear combination of Gaussian rv Let X1 → N (µ1 , σ1 ) and X2 → N (µ2 , σ2 ), X1 and X2 being independent q 2 2 Y = aX1 + bX2 → N aµ1 + bµ2 , a2 σ1 + b2 σ2 27 / 61 Standard normal distribution Definition Normal distribution with expected value µ = 0 and sd σ = 1 Standardization of a normal variable : Subtract µ X −µ Z= Divide by σ σ Probability density function 1 f (u) = √ × exp 2π −1 2 u 2 N (0, 1) 2 Symmetric about 0 2 points of inflection at −1 and +1 1 Mode = 0 = median 0 Area under the curve 1 −6 −4 −2 0 2 4 6 28 / 61 Standard normal distribution table (p is given) N (0, 1) 2 1 0 −4 −3 −2 −1−z 0 z 1 2 3 4 How to use the table For a given probability p, in the table we can read z such that P(|Z | ≥ z) = p P(Z ≥ z) = P(Z ≤ −z) = p 2 Example Read in the table the value of z such that : p=0.1 p=0.05 p=0.01 29 / 61 Standard normal distribution table (p is given) N (0, 1) 2 1 0 −4 −3 −2 −1−z 0 z 1 2 3 4 How to use the table For a given probability p, in the table we can read z such that P(|Z | ≥ z) = p P(Z ≥ z) = P(Z ≤ −z) = p 2 Example Read in the table the value of z such that : p=0.1 z=1.645 p=0.05 z=1.960 p=0.01 z=2.576 29 / 61 Central limit theorem (CLT) Simplification Let X1 , X2 , . . . , Xn be random variables, mutually independent, with the same probability distribution function L(µ, σ). If n is sufficiently large random variable Sn = X1 + X2 + . . . + Xn is approximately normally distributed with an expected value equal to n × µ and a √ standard deviation equal to n × σ Consequence : random variable M (sample mean) X1 + X2 + . . . + Xn M= n If n is sufficiently large, then M is approximately normally distributed with an expected value equal to µM = µ and a sd equal to σM = √σn Notes Classically n is considered sufficiently large when n ≥ 30 The CLT explains why the normal distribution is so important 30 / 61 Normal approximation to the Binomial distribution (1) Approximation Let Sn → B(n, p) and X → Bern(p). Sn = n X Xi , the Xi being indépendantes i=1 According to the CLT Sn can be approximated by a normal distribution √ N (np, npq). Practical conditions If n ≥ 30, np ≥ 5 and n(1 − p) ≥ 5, B(n, p) can be approximated by √ N (np, npq) 31 / 61 Normal approximation to the Binomial distribution (2) Problem : discrete/continuous distributions Binomial distr. B(n, p) P(Sn = k) = Ckn (p) k (1 − p) n−k 6= 0 √ Normal distr. N (np, npq) P(Sn = k)=0 Continuity correction Binomial distr. B(n, p) P(Sn = k) P(Sn ≤ k) P(Sn < k) ... √ Normal distr N (np, npq) P k − 21 < Sn < k + 12 P Sn ≤ k + 12 P Sn ≤ k − 12 ... 32 / 61 Plan du cours 1 Reminder on probability theory 2 Estimation ponctuelle, estimation par IC Échantillonnage Estimateur et estimation ponctuelle Estimation par intervalle de confiance 33 / 61 Obtenir un échantillon Obtenir un échantillon représentatif Échantillons non représentatifs les étudiants en M2 neuroscience/ l’ensemble des étudiants français les 20 premières souris attrapées dans leur cage / l’ensemble des souris de laboratoire ... Échantillon représentatif Réaliser un tirage aléatoire Définition : échantillon aléatoire simple Tous les individus ont la même probabilité d’être choisis (tirage aléatoire) sont choisis de façon indépendante les uns des autres tirage avec remise ou tirage dans une population de grande taille par rapport à celle de l’échantillon 34 / 61 Fluctuations d’échantillonnage Population échantillon 1 proportion vert : 4/5 échantillon 2 proportion vert : 1/5 échantillon 3 proportion vert : 0/5 échantillon 4 proportion vert : 2/5 proportion vert : 10/30 Proportions observées dans les échantillon : estimations ponctuelles de la vraie proportion dans la population 35 / 61 Importance de la taille de l’échantillon Population N=30 pv = 0.33 pr = 0.33 échantillon 1 n=10 fv = 0.4 fr = 0.3 fb = 0.3 pb = 0.33 échantillon 2 n=5 fv = 0.2 fr = 0.2 fb = 0.6 Plus l’échantillon est de grande taille, plus l’estimation sera précise Si l’échantillon est trop grand par rapport à la taille de la population : problème d’individus non indépendants 36 / 61 Formalisation du problème : notion d’échantillon statistique Exemple Soit X la va modélisant le poids (kg) des nouveaux-nés en France X → L(µ, σ) µ : poids «moyen» σ : ecart-type du poids Exemple d’échantillon : (2.8, 4.2, 3.8, 3.2, . . . ) x1 = 2.8 est une réalisation de la v.a. X1 X1 : «première valeur observée sur un échantillon», X1 → L(µ, σ) x2 = 4.2 est une réalisation de la v.a. X2 X2 «deuxième valeur observée sur un échantillon». X2 → L(µ, σ) ... Conclusion Chaque valeur observée sur un échantillon correspond à la réalisation d’une v.a Xi . Les Xi sont indépendantes et toutes de même loi que X 37 / 61 Notion d’échantillon statistique (2) Échantillon statistique On ne considère plus des individus mais des variables aléatoires échantillon statistique de taille n : ensemble de n va (X1 , X2 , . . . , Xn ) valeurs observées de l’échantillon : (x1 , x2 , . . . , xn ) 38 / 61 Estimateur et estimations ponctuelles Notation θ = le paramètre à estimer θ : µ, σ, p, mediane, . . . Estimation Une estimation de θ est un nombre calculé en fonction des valeurs xi observées dans l’echantillon : t = f (x1 , x2 , . . . , xn ) Exemple : cas de l’estimation de µ x1 + x2 + . . . + xn m= n Estimateur Un estimateur de θ est une variable aléatoire exprimée en fonction des va d’échantillon Xi : T = f (X1 , X2 , . . . , Xn ) Exemple : cas de M (ou X̄ ), l’estimateur de µ M= X1 + X2 + . . . + Xn n 39 / 61 Ne pas confondre estimation, estimateur et le paramètre estimé! Lien entre estimateur et estimation Soit T un estimateur de θ T est une variable aléatoire Un échantillon → calcul d’une valeur t, réalisation de T t est une valeur calculée de T pour un échantillon donné Notations paramètre théorique µ σ2 σ p ou π estimateur M ou X̄ S2 S F estimation m ou x̄ ou µ̂ s 2 ou σˆ2 s ou σ̂ f ou p̂ 40 / 61 Qualité d’un estimateur (2) Variance faible Variance élevée Sans biais Avec biais 41 / 61 Estimateur et estimation ponctuelle de l’espérance µ Moyenne d’échantillon ou moyenne empirique M : moyenne d’échantillon ou moyenne empirique (parfois notée X̄ ) M= X1 + X2 + . . . + Xn n espérance de M : E(M) = µM 2 variance de M : var (M) = σM écart-type de M : σM Aussi appelé erreur-type, ou standard error [of the mean] (SE[M]) M est un estimateur sans biais et dont la variance −→ 0 n→+∞ Estimation de µ m : moyenne calculée dans un échantillon est une réalisation de M m est une estimation ponctuelle de µ 42 / 61 Loi de l’estimateur de l’espérance : approche intuitive Population Réalisations de M échantillon 1 m1 échantillon 2 m2 échantillon 3 m3 échantillon 4 m4 échantillon 5 m5 µM échantillon k mk n grand (≥ 30) Calcul de µM et σM 43 / 61 Loi de M Les différents cas Plusieurs cas : Si les Xi suivent une loi normale Si les Xi ne suivent pas une loi normale Si n ≥ 30 Si n < 30 Cas 1 : les Xi suivent une loi normale M est une combinaison linéaire de va Gaussiennes M → N (µM , σM ) Cas 2 : les Xi ne suivent pas une loi normale Si n ≥ 30 : application du théorème central limite M N (µM , σM ) Si n < 30 : on ne peut rien dire 44 / 61 Expression de µM et σM Espérance E(M) = µM en fonction de µ X1 + X2 + . . . + Xn E(M) = E n E(M) = 1 (E(X1 ) + E(X2 ) + . . . + E(Xn )) n E(M) = 1 × nµ = µ n 2 en fonction de σ 2 Variance var(M) = σM X1 + X2 + . . . + Xn 1 var(M) = var = 2 × var(X1 + X2 + . . . + Xn ) n n 1 var(M) = 2 × (var(X1 ) + var(X2 ) + · · · + var(Xn )) Independance n σ2 1 var(M) = 2 × nσ 2 = n n 45 / 61 Écart-type et Erreur type Écart-type = standard déviation (sd) Il représente la dispersion d’un ensemble de valeurs Il est utilisé pour décrire un échantillon ou une population : plus il est faible, plus les valeurs sont resserrées autour de la moyenne Erreur-type = Standard error [of the mean] (se ou sem) Elle représente la dispersion de l’estimation de la moyenne d’un ensemble de valeurs Elle est utilisée pour donner des informations sur l’estimation de la moyenne d’une population : plus elle est faible, plus l’estimation est précise Elle dépend beaucoup de la taille de l’échantillon Et en pratique dans un article, on utilise quoi ? Ca dépend de ce qu’on veut montrer ! Préciser dans la légende ce qu’on utilise (m ± sd ou m ± sem) 46 / 61 Estimateur de la variance Un estimateur de la variance intuitif biaisé 1X Se2 = (Xi − M)2 n i On peut montrer que cet estimateur est biaisé Estimateur non biaisé de la variance n 1 X 1 S = (Xi − M)2 = n−1 n−1 2 i=1 n X ! Xi2 −n×M 2 i=1 Estimation ponctuelle de la variance de la population ! ! n n X X 1 1 2 2 2 2 s = (xi − m) = xi − n × m n−1 n−1 i=1 i=1 47 / 61 Estimateur d’une proportion Définition d’un estimateur d’une proportion, F Soit X un va qui ne prend que deux valeurs, 0 et 1 Pn P(X = 1) = p Xi Sn = i=1 F = P(X = 0) = 1 − p n n On peut montrer que : Espérance : E(F ) = p Variance : var(F ) = p×(1−p) q n Écart-type : σF = p×(1−p) n F est un estimateur sans biais et dont la variance −→ 0 n→+∞ Si n ≥ 30, np ≥ 5 et n(1 − p) ≥ 5, F suit approximativement une loi normale Estimation ponctuelle f : proportion observée dans un échantillon est une estimation de p f est une réalisation de F 48 / 61 Introduction à l’estimation par intervalle de confiance (IC) Population espérance µ échantillon 1 m1 échantillon 2 m2 échantillon 3 m3 échantillon 4 m4 échantillon 5 m5 échantillon n mn µ m2 m4 mn m1 m5 m3 Estimation ponctuelle Exemple : X=«poids des nouveaux nés», X → L(µ, σ) Estimation ponctuelle de µ : définie par un estimateur (ici, la va M) calculée sur un échantillon → dépend de l’échantillon Problème : précision de l’estimation inconnue 49 / 61 Estimation par intevalle de confiance (IC) Principe Définir un intervalle dans lequel on a beaucoup de chances de trouver la valeur du paramètre à estimer Donner une précision sur la valeur de l’estimation ponctuelle Définition d’un IC1−α Un intervalle de confiance de niveau (de confiance) 1 − α est un intervalle calculé pour un échantillon donné, qui a (1-α)% de chances de contenir la vraie valeur de θ IC1−α (θ) = [Binf ; Bsup ] tel que P(Binf ≤ θ ≤ Bsup ) = 1 − α L’IC est aléatoire : ses bornes dépendent de l’échantillon considéré → On en calcule une estimation à partir d’un échantillon Calcul d’une infinité d’ic sur une infinité d’échantillons Alors on a une proportion (1 − α) d’ic qui contiennent bien θ 50 / 61 Intervalle de confiance d’une moyenne (approx normale) n ≥ 30 n < 30 X → L(µ, σ) X → N (µ, σ) Pas de conditions sur la loi de X (TLC) σ inconnu σ connu ic1−α(µ) = m ± zα × √sn σ inconnu ic1−α(µ) = m ± tαn−1 × √sn ic1−α(µ) = m ± zα × √σn m : estimation de l’espérance µ s : estimation de l’écart-type σ n : taille de l’échantillon zα et tα lus dans des tables 51 / 61 Lecture de zα dans la table de l’écart réduit N (0, 1) 2 1 0 −4 α 0.0 0.1 0.2 −3 0.00 ∞ 1.645 1.282 −2 0.01 2.576 1.598 1.254 −uα 0 −1 0.02 2.326 1.555 1.227 uα 1 0.03 2.170 1.514 1.200 0.04 2.054 1.476 1.175 2 3 0.05 1.960 1.440 1.150 4 0.06 1.881 1.405 1.126 0.07 1.812 1.372 1.103 0.08 1.751 1.341 1.080 0.09 1.695 1.311 1.058 Exemples : α = 0.05, µ a 95% de chance d’être dans l’ic : zα = 1.960 α = 0.10, µ a 90% de chance d’être dans l’ic : zα = 1.645 α = 0.23, µ a 77% de chance d’être dans l’ic : zα = 1.645 52 / 61 Lecture de tαn−1 dans la table de Student α 2 1−α −tαν Elle donne ν \α 1 ... 10 ... 21 tαν α 2 tαν 0 tel que P(|T | > tαν ) =α 0.90 0.158 0.50 1.000 0.30 1.963 0.20 3.078 0.10 6.314 0.05 12.706 0.02 31.821 0.01 63.657 0.001 636.619 0.129 0.700 1.093 1.372 1.812 2.228 2.764 3.169 4.587 0.127 0.686 1.063 1.323 1.721 2.080 2.518 2.831 3.819 Exemples : 10 = 2.228 n = 11, α = 0.05, µ a 95% de chance d’être dans l’ic : t0.05 21 = 2.831 n = 22, α = 0.01, µ a 99% de chance d’être dans l’ic : t0.01 53 / 61 Intervalle de confiance d’une proportion Réalisation de l’IC pour un échantillon Quand n est grand et en réalisant certaines approximations, on peut montrer que : r f (1 − f ) ic1−α (p) = f ± zα × n Vérification des conditions de validité Il faut absolument vérifier a posteriori que les approximations réalisées étaient légitimes Soit [f1 ; f2 ] l’intervalle de confiance trouvé. On vérifie que : n ≥ 30, nf1 ≥ 5, n(1 − f1 ) ≥ 5, nf2 ≥ 5, n(1 − f2 ) ≥ 5 54 / 61 Écriture d’un intervalle de confiance Règle d’arrondi Pour garantir le niveau de confiance 1 − α : On minore la borne inférieure On majore la borne supérieure Exemples ic0.95 (µ) = [34.31; 39.09] ic0.95 (µ) = [34.399; 39.001] → → ic0.95 (µ) = [34.3; 39.1] ic0.95 (µ) = [34.3; 39.1] 55 / 61 Exemple de la prévalence Estimation par ic de la prévalence d’une maladie n= 10000 f=0.01 (1%) ic0.95 (p) = f ± 1.96 × q f (1−f ) qn ic0.95 (p) = 0.01 ± 1.96 × 0.01×0.99 10000 ic0.95 (p) = 0.01 ± 0.002 ic0.95 (p) = [0.008; 0.012] Conditions de validité vérifiées : n ≥ 30, nf1 = 80, nf2 = 120, n(1 − f1 ) = 9920, n(1 − f2 ) = 9880 56 / 61 Précision d’un ic Définition sur l’exemple du calcul de la prévalence Rappel : ic0.95 (p) = 0.01 ± 0.002 ic0.95 (p) = [0.008; 0.012] Largeur l de l’ic : borne sup - borne inf. Ex :q l = 0.004 ) Dans le cas d’une proportion : l = 2 × zα × f (1−f n Précision i : précision = 1/2 largeur de l’ic. Ex : i = 0.002 i et l dépendent de n Nombre de sujets nécessaires pour avoir une précision inférieure ou égale à i1 =1% r f (1 − f ) f (1 − f ) i2 zα ≤ i1 ⇔ ≤ 12 n n zα f (1 − f ) × zα2 n≥ i12 AN : n ≥ 656.9 → n > 657 57 / 61 Bilan sur les ic Population Réalisations de M éch. 1 m1 éch. 2 m2 éch. 3 m3 éch. 4 m4 éch. 5 m5 éch. n mn µ m1 m2 m3 m4 m5 mn estimation ponctuelle estimation par ic L’ic est centré sur la moyenne observée dans l’échantillon Il a 1 − α% de chances de contenir la moyenne théorique µ 58 / 61 Représentation graphique Une représentation classique en biologie Que représentent les barres d’erreur ? écart-type (observé ou estimé) → si on décrit un échantillon ou la population dont il est issu sem ou intervalle de confiance → information sur la précision de la moyenne estimée Lien entre ic et sem (ex sur cas grand échantillon) : icα (µ) = m ± uα × sem uα = 1 ⇔ 0.31 < α < 0.32 m ± sem correspond à un ic à ∼ 68% MAIS . . . ... 59 / 61 Représentation graphique (2) Une représentation qui peut se révéler trompeuse Les problèmes Peu d’information sur le graphique Ne donne pas d’idée de la taille d’échantillon Reflète mal les distributions asymétriques 60 / 61 Représentation graphique (3) : que faire alors ? Pour décrire une distribution Si n relativement petit : dessiner tous les points (dotchart ou stripchart sous R) Si n est grand : boı̂te à moustache Pour donner des informations sur les moyennes des populations Précision de l’estimation : donner les ic dans le texte Comparaison de moyennes de plusieurs populations : faire un test statistique et donner le résultat du test 61 / 61