Survey
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
CERAM February-March-April 2008 Class 2 Statistical Inference Lionel Nesta Observatoire Français des Conjonctures Economiques [email protected] Hypothesis Testing The Notion of Hypothesis in Statistics Expectation An hypothesis is a conjecture, an expected explanation of why a given phenomenon is occurring Operational -ity An hypothesis must be precise, univocal and quantifiable Refutability Le result of a given experiment must give rise to either the refutation or the corroboration of the tested hypothesis Replicability Exclude ad hoc, local arrangements from experiment, and seek universality Examples of Good and Bad Hypotheses « The stakes Peugeot and Citroen have the same variance » « God exists! » « In general, the closure of a given production site in Europe is positively associated with the share price of a given company on financial markets. » « Knowledge has a positive impact on economic growth » Hypothesis Testing In statistics, hypothesis testing aims at accepting or rejecting a hypothesis The statistical hypothesis is called the “null hypothesis” H0 The null hypothesis proposes something initially presumed true. It is rejected only when it becomes evidently false, that is, when the researcher has a certain degree of confidence, usually 95% to 99%, that the data do not support the null hypothesis. The alternative hypothesis (or research hypothesis) H1 is the complement of H0. Hypothesis Testing There are two kinds of hypothesis testing: Homogeneity test compares the means of two samples. H0 : Mean(x) = Mean(y) ; Mean(x) = 0 H1 : Mean(x) ≠ Mean(y) ; Mean(x) ≠ 0 Conformity test looks at whether the distribution of a given sample follows the properties of a distribution law (normal, Gaussian, Poisson, binomial). H0 : ℓ(x) = ℓ*(x) H1 : ℓ(x) ≠ ℓ*(x) The Four Steps of Hypothesis Testing 1. Spelling out the null hypothesis H0 et and the alternative hypothesis H1. 2. Computation of a statistics corresponding to the distance between two sample means (homogeneity test) or between the sample and the distribution law (conformity test). 3. Computation of the (critical) probability to observe what one observes. 4. Conclusion of the test according to an agreed threshold around which one arbitrates between H0 and H1 . The Logic of Hypothesis Testing We need to say something about the reliability (or representativeness) of a mean Large number theory; Central limit theorem The notion of confidence interval Once done, we can whether two mean are alike If so (not), their confidence intervals are (not) overlapping Statistical Inference In real life calculating parameters of populations is prohibitive because populations are very large. Rather than investigating the whole population, we take a sample, calculate a statistic related to the parameter of interest, and make an inference. The sampling distribution of the statistic is the tool that tells us how close is the statistic to the parameter. Prerequisite Standard Normal Distribution Two Prerequisites Large number theory Large number theory tells us that the sample mean will converge to the population (true) mean as the sample size increases. Central Limit Theorem Central Limit Theorem tells us that for many samples of like and sufficiently large size, the histogram of these sample means will appear to be a normal distribution. The Dice Experiment Value P(X = x) 1 1/6 2 1/6 1 x6 21 E X X x 3.5 6 x 1 6 0.20 3 1/6 4 1/6 0.12 5 1/6 0.08 1/6 0.04 6 0.16 0.00 1 2 3 x 4 5 6 The Dice Experiment (n = 2) Sample 1 2 3 4 5 6 7 8 9 10 11 12 1,1 1,2 1,3 1,4 1,5 1,6 2,1 2,2 2,3 2,4 2,5 2,6 Mean Sample Mean 1 13 3,1 2 1.5 14 3,2 2.5 2 15 3,3 3 2.5 16 3,4 3.5 3 17 3,5 4 3.5 18 3,6 4.5 1.5 19 4,1 2.5 2 20 4,2 3 2.5 21 4,3 3.5 3 22 4,4 4 3.5 23 4,5 4.5 4 24 4,6 5 E X X 1 1 X1 X2 36 36 Sample 25 26 27 28 29 30 31 32 33 34 35 36 Mean 5,1 5,2 5,3 5,4 5,5 5,6 6,1 6,2 6,3 6,4 6,5 6,6 1 X 36 3.5 X 36 3 3.5 4 4.5 5 5.5 3.5 4 4.5 5 5.5 6 Sample 1 2 3 4 5 6 7 8 9 10 11 12 1,1 1,2 1,3 1,4 1,5 1,6 2,1 2,2 2,3 2,4 2,5 2,6 Mean Sample Mean 1 13 3,1 2 1.5 14 3,2 2.5 2 15 3,3 3 2.5 16 3,4 3.5 3 17 3,5 4 3.5 18 3,6 4.5 1.5 19 4,1 2.5 2 20 4,2 3 2.5 21 4,3 3.5 3 22 4,4 4 3.5 23 4,5 4.5 4 24 4,6 5 Sample 25 26 27 28 29 30 31 32 33 34 35 36 Mean 5,1 5,2 5,3 5,4 5,5 5,6 6,1 6,2 6,3 6,4 6,5 6,6 3 3.5 4 4.5 5 5.5 3.5 4 4.5 5 5.5 6 6/36 5/36 4/36 3/36 2/36 1/36 1 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 5.5 6.0 x The Normal Distribution In probability, a random variable follows a normal distribution law (also called Gaussian, Laplace-Gauss distribution law) of expectation μ and standard deviation σ if its probability density function (pdf) is such that f ( x) 1 2 e 1 x 2 2 This law is written N (μ,σ ²). The density function of a normal distribution is symmetrical. Normal Distributions For Different values of μ and σ 0.9 0.8 0.7 0.6 0.5 0.4 0.3 0.2 0.1 0 -5 -4 -3 -2 (μ=0;σ=1) -1 0 (μ=0.5;σ=1.1) 1 2 3 (μ=-2;σ=0.5) 4 5 The Standard Normal Distribution The standard normal distribution, also called Z distribution, represents a probability density function with mean μ = 0 and standard deviation σ = 1. It is written as N (0,1). All random variable following a normal law can be standardized via the following transformation z x The Standard Normal Distribution (μ=0; σ=1) 0.45 0.40 0.35 0.30 0.25 0.20 0.15 0.10 0.05 0.00 -5.0 -4.5 -4.0 -3.5 -3.0 -2.5 -2.0 -1.5 -1.0 -0.5 0.0 0.5 1.0 1.5 2.0 2.5 3.0 3.5 4.0 4.5 5.0 The Standard Normal Distribution 0.45 68% of observations 0.4 0.35 0.3 95% of observations 0.25 0.2 99.7% of observations 0.15 0.1 0.05 0 -5 -4 -3 -2 -1 0 1 2 3 4 5 The Standard Normal Distribution 0.45 0.4 0.35 0.3 0.25 95% of observations 0.2 0.15 0.1 2.5% 2.5% 0.05 0 -5 -4 -3 -2 -1 0 1 2 3 4 5 The Standard Normal Distribution (z scores) 0.45 0.4 0.35 0.3 0.25 P(Z ≥ 0) P(Z < 0) 0.2 0.15 0.1 0.05 0 -5 -4 -3 -2 -1 0 1 2 3 4 5 Probability of an event (z = 0.51) 0.45 0.4 0.35 0.3 0.25 P(Z ≥ 0.51) 0.2 0.15 0.1 0.05 0 -5 -4 -3 -2 -1 0 1 2 3 4 5 Probability of an event (z = 0.51) The z-score is used to compute the probability of obtaining an observed score. Example Let z = 0.51. What is the probability of observing z=0.51? It is the probability of observing z ≥ 0.51: P(z ≥ 0.51) = ?? Standard Normal Distribution Table z 0.00 0.01 0.02 0.03 0.04 0.05 0.06 0.07 0.08 0.09 0.0 0.500 0.496 0.492 0.488 0.484 0.480 0.476 0.472 0.468 0.464 0.1 0.460 0.456 0.452 0.448 0.444 0.440 0.436 0.433 0.429 0.425 0.2 0.421 0.417 0.413 0.409 0.405 0.401 0.397 0.394 0.390 0.386 0.3 0.382 0.378 0.375 0.371 0.367 0.363 0.359 0.356 0.352 0.348 0.4 0.345 0.341 0.337 0.334 0.330 0.326 0.323 0.319 0.316 0.312 0.5 0.309 0.305 0.302 0.298 0.295 0.291 0.288 0.284 0.281 0.278 0.6 0.274 0.271 0.268 0.264 0.261 0.258 0.255 0.251 0.248 0.245 0.7 0.242 0.239 0.236 0.233 0.230 0.227 0.224 0.221 0.218 0.215 0.8 0.212 0.209 0.206 0.203 0.201 0.198 0.195 0.192 0.189 0.187 0.9 0.184 0.181 0.179 0.176 0.174 0.171 0.169 0.166 0.164 0.161 1.0 0.159 0.156 0.154 0.152 0.149 0.147 0.145 0.142 0.140 0.138 1.6 0.055 0.054 0.053 0.052 0.050 0.050 0.049 0.048 0.047 0.046 1.9 0.029 0.028 0.027 0.027 0.026 0.026 0.025 0.024 0.024 0.023 2.0 0.023 0.022 0.022 0.021 0.021 0.020 0.020 0.019 0.019 0.018 2.5 0.006 0.006 0.006 0.006 0.006 0.005 0.005 0.005 0.005 0.005 2.9 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.002 0.001 0.001 Probability of an event (Z = 0.51) The Z-score is used to compute the probability of obtaining an observed score. Example Let z = 0.51. What is the probability of observing z=0.51? It is the probability of observing z ≥ 0.51: P(z ≥ 0.51) P(z ≥ 0.51) = 0.3050 Example Suppose that for a population students of a famous business school in Sophia-Antipolis, grades are distributed normal with an average of 10 and a standard deviation of 3. What proportion of them Exceeds 12 ; Exceeds 15 Does not exceed 8 ; Does not exceed 12 Let the mean μ = 10 and standard deviation σ = 3: 12 10 3 15 10 z 3 8 10 z 3 12 10 z 3 z 0.66. P( z 0.66) 0.255 25.5% 1.66. P( z 1.66) 0.049 4.9% 0.66. P( z 0.66) P( z 0.66) 0.255 25.5% 0.66. P( z 0.66) 1 - P( z 0.66) 1 0.255 74.5% Confidence Interval Inverting the way of thinking Until now, we have thought in terms of observations x and sample values μ and σ to produce the z score. Let us now imagine that we do not know x, we know μ and σ. If we consider any interval, we can write: z x- z x z x z ? ? Inverting the way of thinking If z∈[-2.55;+2.55] we know that 99% of z-scores will fall within the range If z∈[-1.64;+1.64] we know that 90% of z-scores will fall within the range Let us now consider an interval which comprises 95% of observations. Looking at the z table, we know that z=1.96 Pr 1.96 x 1.96 0.95 Confidence Interval In statistics, a confidence interval is an interval within which the value of a parameter is likely to be (the mean). Instead of estimating the parameter by a single value, an interval of likely estimates is given. Confidence intervals are used to indicate the reliability of an estimate. A1. The sample mean is a random variable following a normal distribution A2.The sample values μ and σ are good approximation of the population values. The Central Limit Theorem If a random sample is drawn from any population, the sampling distribution of the sample mean is approximately normal for a sufficiently large sample size. The larger the sample size, the more closely the sampling distribution of x will resemble a normal distribution. Moments of Sample Mean: The Mean 1 X 1 X 2 ... X n n 1 E X E X 1 E X 2 ... E X n n 1 E X ... n 1 E X n n X E X On average, the sample mean will be on target, that is, equal to the population mean. Moments of Sample Mean: The Variance 1 1 1 var X var X 1 var X 2 ... var X n n n n 1 var X 2 var X 1 var X 2 ... var X n n 1 var X 2 2 2 ... 2 n n 2 2 var X 2 n n Standard error of X n The standard deviation of the sample means represents the estimation error of the sample mean, and therefore it is called the standard error. The Sampling Distribution of the Sample Mean 1. x X 2 2 x 2. x n 3. If x is normal, x is normal. If x is nonnormal x is approximately normally distributed for sufficiently large sample size. Confidence Interval X z pc X 1.96 X 1.64 N N N X z pc X 1.96 X 1.64 N General definition Definition for 95% CI N N Definition for 90% CI Standard Normal Distribution and CI 0.45 90% of observations 0.4 0.35 0.3 95% of observations 0.25 0.2 99.7% of observations 0.15 0.1 0.05 0 -5 -4 -3 -2 -1 0 1 2 3 4 5 Application of Confidence Interval Let us draw a sample of 25 students from CERAM (n = 25), with X = 10 and σ = 3. Let us build the 95% CI 10 1.96 3 3 10 1.96 25 25 8.8 11.2 CERAM Average grades 0.14 0.12 95% of chances that the mean is indeed located within this interval 0.10 0.08 0.06 0.04 0.02 0.00 0 5 8.8 10 11.2 15 20 Application of Confidence Interval Let us draw a sample of 25 students from CERAM (n = 25), with X = 10 and σ = 3. Let us build the 95% CI 10 1.96 3 3 10 1.96 25 25 8.8 11.2 Let us draw a sample of 25 students from HEC (n = 30), with X = 11.5 and σ = 4.7. Let us build the 95% CI 11.5 1.96 4.7 4.7 11.5 1.96 30 30 9.8 13.2 HEC Average grades 0.09 0.08 95% of chances that the mean is indeed located within this interval 0.07 0.06 0.05 0.04 0.03 0.02 0.01 0.00 0 5 10 9.8 13.2 15 20 Hypothesis Testing Hypothesis 1 : Students from CERAM have an average grade which is not significantly different from 11 H0 : μ(CERAM) = 11 H1 : μ(CERAM) ≠ 11 I Accept H0 and reject H1 Hypothesis 2 : Students from CERAM have similar grades as students from HEC H0 : μ(CERAM) = μ(HEC) H1 : μ(CERAM) ≠ μ(HEC) I Accept H0 and reject H1 Comparing the Means Using CI’s 0.25 HEC 0.20 0.15 (μ=11.5;σ=4.7) (μ=10;σ=3) CERAM 0.10 0.05 The Overlap of the two CIs means that at 95% level, the two means do not differ significantly. 0.00 0 5 10 15 20 The Student Test Thus far, we have assumed that we know both the mean and the standard deviation of the population. But in fact, we do not know them: both μ and σ are unknown. The Student t statistics is then preferred to the z statistics. Its distribution is similar (identical to z as n → +∞). The CI becomes s X t N df cp Application of Student t to CI’s Let us draw a sample of 25 students from CERAM (n = 25), with μ = 10 and σ = 3. Let us build the 95% CI 3 3 24 10 t 10 t2.5 25 25 3 3 10 2.06 10 2.06 8.76 11.23 25 25 24 2.5 Let us draw a sample of 25 students from HEC (n = 30), with μ = 11.5 and σ = 4.7. Let us build the 95% CI 11.5 2.06 4.7 4.7 11.5 2.06 30 30 9.73 13.26 SPSS Application: Student t Import CERAM_LMC into SPSS Produce descriptive statistics for sales; labour, and R&D expenses Analyse Statistiques descriptives Descriptive Options: choose the statistics you may wish A newspaper writes that by and large, LMCs have 95,000 employees. Test statistically whether this is true at 1% level Test statistically whether this is true at 5% level Test statistically whether this is true at 10% and 20% level Write out H0 and H1 Analyse Comparer les moyennes Test t pour échantillon unique Options: 99; 95, 90% SPSS Application: t test at 99% level Statistiques sur échantillon unique labour N 1634 Moyenne Ecart-type 91298.87 96400.957 Erreur standard moyenne 2384.818 Test sur échantillon unique Valeur du test = 95000 labour t -1.552 ddl 1633 Sig. (bilatérale) .121 Différence moyenne -3701.130 Intervalle de confiance 99% de la différence Inférieure Supérieure -9851.20 2448.94 SPSS Application: t test at 95% level Statistiques sur échantillon unique labour N 1634 Moyenne Ecart-type 91298.87 96400.957 Erreur standard moyenne 2384.818 Test sur échantillon unique Valeur du test = 95000 labour t -1.552 ddl 1633 Sig. (bilatérale) .121 Différence moyenne -3701.130 Intervalle de confiance 95% de la différence Inférieure Supérieure -8378.75 976.50 SPSS Application: t test at 80% level Statistiques sur échantillon unique labour N 1634 Moyenne Ecart-type 91298.87 96400.957 Erreur standard moyenne 2384.818 Test sur échantillon unique Valeur du test = 95000 labour t -1.552 ddl 1633 Sig. (bilatérale) .121 Différence moyenne -3701.130 Intervalle de confiance 80% de la différence Inférieure Supérieure -6758.63 -643.63 SPSS Results (at 1% level) X 95000 t 0.01 X 95000 2.573 s2 s2 0.01 95000 X 95000 t N N 96400 96400 95000 X 95000 2.573 1634 1634 9851.20 95000 2448.94 85148.8 97448.94 Pr 85148.8 97448.94 0.99 Critical probability The confidence interval is designed in such a way that for each t statistics chosen, we define a share of observations which this CI is comprising. For large n, when t = 1.96, we have 95% CI For large n, when t = 2.55, we have 99% CI Actually, for each t, there corresponds a share of observations One can compute directly the t value from our observations as follows: t X s2 n Critical probability The confidence interval is designed in such a way that for each t statistics chosen, we define a share of observations which this CI is comprising. For large n, when t = 1.96, we have 95% CI For large n, when t = 2.55, we have 99% CI Actually, for each t, there corresponds a share of observation http://www.socr.ucla.edu/Applets.dir/T-table.html One can compute directly the t value from our observations as follows: X 95000 91298 95000 3702 t 1.552 s2 N 96400 1634 2384 Critical probability With t = 1.552, I can conclude the following: 12% probability that μ belongs to the distribution where the population mean = 95,000 I have 12% chances to wrongly reject H0 88% probability that μ belongs to another distribution where the population mean ≠ 95,000 I have 88% chances to rightly reject H0 Shall I the accept or reject H0? 88.0% 6.1% 6.1% Critical probability With t = 1.552, I can conclude the following: 12% probability that μ belongs to the distribution where the population mean = 95,000 I have 12% chances to wrongly reject H0 88% probability that μ belongs to another distribution where the population mean ≠ 95,000 I have 88% chances to rightly reject H0 I accept H0 !!! Critical probability The practice is to reject H0 only when the critical probability is lower than 0.1, or 10% Some are even more cautious and prefer to reject H0 at a critical probability level of 0.05, or 5%. In any case, the philosophy of the statistician is to be conservative. A Direct Comparison of Means Using Student t Another way to compare two sample means is to calculate the CI of the mean difference. If 0 does not belong to CI, then the two sample have significantly different means. 1 2 X 1 X 2 t pc s 2 p X 1 X1 X 2 2 (n1 1) (n2 1) sp n1 n2 X2 2 Standard error, also called pooled variance SPSS Application: t test comparing means Another newspaper argues that US companies are much larger than those from the rest of the world. Is this true? Produce descriptive statistics labour comparing the two groups Produce a group variables which equals 1 for US firms, 0 otherwise This is called a dummy variable Write out H0 and H1 Analyse Comparer les moyennes Test t pour échantillon indépendants What do you conclude at 5% level? What do you conclude at 1% level? SPSS Application: t test comparing means Statistiques de groupe labour AM 1 0 N 628 1006 Moyenne Ec art-type 97808.99 112765.1 87234.90 84403.469 Erreur standard moyenne 4499.817 2661.101 Te st d'échantillons indépendants Test de Levene sur l'égalit é des variances F labour Hy pothèse de varianc es égales Hy pothèse de varianc es inégales .024 Sig. .877 Test-t pour égalité des moyennes t ddl Sig. (bilatérale) Différence moyenne Différence éc art-t ype Int ervalle de confiance 95% de la différenc e Inférieure Supérieure 2.159 1632 .031 10574.084 4897.135 968.751 20179.417 2.023 1061.268 .043 10574.084 5227.792 316.102 20832.067 SPSS Application: t test comparing means Statistiques de groupe labour AM 1 0 N 628 1006 Moyenne Ec art-type 97808.99 112765.1 87234.90 84403.469 Erreur standard moyenne 4499.817 2661.101 Te st d'échantillons indépendants Test de Levene sur l'égalit é des variances F labour Hy pothèse de varianc es égales Hy pothèse de varianc es inégales .024 Sig. .877 Test-t pour égalité des moyennes t ddl Sig. (bilatérale) Différence moyenne Différence éc art-t ype Int ervalle de confiance 99% de la différenc e Inférieure Supérieure 2.159 1632 .031 10574.084 4897.135 -2054. 870 23203.038 2.023 1061.268 .043 10574.084 5227.792 -2916. 075 24064.243