Report

Stats for Engineers Lecture 6 Answers for Question sheet 1 are now online http://cosmologist.info/teaching/STAT/ Answers for Question sheet 2 should be available Friday evening Summary From Last Time (−1.5 < < −0.7) Continuous Random Variables () Probability Density Function (PDF) () ≤≤ = ∞ ′ ′ Exponential distribution = 1 −∞ − , = 0, >0 <0 Probability density for separation of random independent events with constant rate Normal/Gaussian distribution = 1 2 2 − − 2 22 (−∞ < < ∞) : mean : standard deviation Normal distribution Question from Derek Bruff Consider the continuous random variable X = the weight in pounds of a randomly selected newborn baby. Suppose that X can be modelled with a normal distribution with mean μ = 7.57 and standard deviation = 1.06. If the standard deviation were = 1.26 instead, how would that change the graph of the pdf of X? 1. 2. 3. 4. 5. 6. The graph would be narrower and have a greater maximum value. The graph would be narrower and have a lesser maximum value. The graph would be narrower and have the same maximum value. The graph would be wider and have a greater maximum value. The graph would be wider and have a lesser maximum value. The graph would be wider and have the same maximum value. ∞ = 1 −∞ 82% 12% 3% 1 2 0% 0% 3 4 3% 5 6 << = BUT: for normal distribution cannot integrate analytically. Instead use tables for standard Normal distribution: = If ∼ , 2 , then = − 1 2 ∼ (0,1) − 2 2 Why does this work? Change of variable The probability for X in a range around is for a distribution () is given by . The probability should be the same if it is written in terms of another variable = (). Hence = () ⇒ = i.e. change to = . − ⇒ = ⇒ = + 2 = 2 − 1 ⇒ = = 2 2 = 1 2 − 2 2 − 2 2 2 × N(0, 1) - standard Normal distribution = Use Normal tables for = ( < ) [also called Φ()] − ∼ (0,1) Q z = ≤ = −∞ Outside of exams this is probably best evaluated using a computer package (e.g. Maple, Mathematica, Matlab, Excel); for historical reasons you still have to use tables. 0 ≤ ≤ 3.59 z Example: If Z ~ N(0, 1): (a) ≤ 1.22 = Q 1.22 = 0.8888 (b) > −0.5 = ≤ 0.5 = Q(0.5) = 0.6915. = (c) ≤ −1.0 = ( ≥ 1.0) = 1 − ( < 1.0) = 1 − Q 1.0 = 1 − 0.8413 = 0.1587 = Symmetries If ∼ (0,1), which of the following is NOT the same as ( < 0.7)? 1. 2. 3. 4. 1 − ( > 0.7) ( > −0.7) 1 − ( > −0.7) 1 − ( < −0.7) 60% 10% 1 17% 13% 2 3 4 Symmetries If ∼ (0,1), which of the following is NOT the same as ( < 0.7)? 1 − > 0.7 ( > −0.7) 1 − ( > −0.7) 1 − ( < −0.7) = - - - = = (d) 0.5 < < 1.5 = < 1.5 − ( < 0.5) = Q 1.5 − Q(0.5) = 0.9332 −0.6915 = 0.2417 = − (e) < 1.356 Between Q 1.35 = 0.9115 and Q 1.36 = 0.9131 Using interpolation Q 1.356 = A 1.35 + B (1.36) Fraction of distance between 1.35 and 1.36: = 1.356 − 1.35 1.36 − 1.35 =1− = 0.6 = 0.4 Q 1.356 = 0.4 1.35 + 0.6(1.36) =0.9125 (f) 0.8 = ≤ = Q() What is ? Use table in reverse: between 0.84 and 0.85 Interpolating as before = × 0.084 + × 0.085 0.8−0.7995 = 0.8023−0.7995 = 0.18 = 1 − = 0.82 ⇒ = 0.82 × 0.084 + 0.18 × 0.085 ≈ 0.0842. Using Normal tables The error (in Celsius) on a cheap digital thermometer has a normal distribution, with ∼ 0,1 . What is the probability that a given temperature measurement is too cold by more than 1.54∘ C? 1. 2. 3. 4. 0.0618 0.9382 0.1236 0.0735 43% 36% 19% 2% 1. 2. 3. 4. Using Normal tables The error (in Celsius) on a cheap digital thermometer has a normal distribution, with ∼ 0,1 . That is the probability that a given temperature measurement is too cold by more than 1.54∘ C? Answer: Want < −1.54 = = ( > 1.54) = 1 − ( < 1.54) = 1 − Q(1.54) = 1 − 0.9382 = 0.0618 (g) Finding a range of values within which lies with probability 0.95: The answer is not unique; but suppose we want an interval which is symmetric about zero i.e. between − and . 0.95 So is where Q = 0.975 0.025+0.95 − 0.025 0.975 0.05/2=0.025 Use table in reverse: Q = 0.975 ⇒ = 1.96 95% of the probability is in the range −1.96 < < 1.96 In general 95% of the probability lies within 1.96 of the mean P=0.025 P=0.025 The range ± 1.96 is called a 95% confidence interval. Question from Derek Bruff Normal distribution If has a Normal distribution with mean = 20 and standard deviation = 4, which of the following could be a graph of the pdf of ? 1. 2. 3. 4. 45% 32% 20% 2% 1 2 3 4 Normal distribution If has a Normal distribution with mean = 20 and standard deviation = 4, which of the following could be a graph of the pdf of ? 1. 2. Too wide 3. Correct 4. Wrong mean i.e. Mean at = 20, 95% inside (5% outside) of ± 2, i.e. 20 ± 8 Too narrow Example: Manufacturing variability The outside diameter, X mm, of a copper pipe is N(15.00, 0.022) and the fittings for joining the pipe have inside diameter Y mm, where Y ~ N(15.07, 0.0222). (i) Find the probability that X exceeds 14.99 mm. (ii) Within what range will X lie with probability 0.95? (iii) Find the probability that a randomly chosen pipe fits into a randomly chosen fitting (i.e. X < Y). Y X Example: Manufacturing variability The outside diameter, X mm, of a copper pipe is N(15.00, 0.022) and the fittings for joining the pipe have inside diameter Y mm, where Y ~ N(15.07, 0.0222). (i) Find the probability that X exceeds 14.99 mm. Answer: ∼ , 2 Reminder: = = (15.0, 0.022 ) > 14.99 = > 14.99 − 15.0 0.02 = > −0.5 = < 0.5 = (0.5) ≈ 0.6915 − Example: Manufacturing variability The outside diameter, X mm, of a copper pipe is N(15.00, 0.022) and the fittings for joining the pipe have inside diameter Y mm, where Y ~ N(15.07, 0.0222). (ii) Within what range will X lie with probability 0.95? Answer From previous example −1.96 < < 1.96 = 0.95 i.e. lies in ± 1.96 with probability 0.95 ⇒ = 15 ± 1.96 × 0.02 ⇒ 14.96mm < < 15.04mm Where is the probability We found 95% of the probability lies within 14.96mm < < 15.04mm What is the probability that > 15.04mm? P=0.025 P=0.025 1. 2. 3. 4. 0.025 0.05 0.95 0.975 71% 14% 11% 4% 1. 2. 3. 4. Example: Manufacturing variability The outside diameter, X mm, of a copper pipe is N(15.00, 0.022) and the fittings for joining the pipe have inside diameter Y mm, where Y ~ N(15.07, 0.0222). (iii) Find the probability that a randomly chosen pipe fits into a randomly chosen fitting (i.e. X < Y). Answer For < we want ( − > 0). To answer this we need to know the distribution of − , where and both have (different) Normal distributions Distribution of the sum of Normal variates Means and variances of independent random variables just add. If 1 , 2 , … , are independent and each have a normal distribution ∼ , , 2 ⇒ 1+2 = 1 + 2 21+2 = 21 + 22 Etc. A special property of the Normal distribution is that the distribution of the sum of Normal variates is also a Normal distribution. [stated without proof] If 1 , 2 , … , are constants then: 1 1 + 2 2 + ⋯ ∼ (1 1 + ⋯ + , 12 2 + 22 2 + ⋯ + 2 2 ) E.g. 1 + 2 ∼ (1 + 2 , 12 + 22 ) 1 − 2 ∼ (1 − 2 , 12 + 22 ) Example: Manufacturing variability The outside diameter, X mm, of a copper pipe is N(15.00, 0.022) and the fittings for joining the pipe have inside diameter Y mm, where Y ~ N(15.07, 0.0222). (iii) Find the probability that a randomly chosen pipe fits into a randomly chosen fitting (i.e. X < Y). Answer For < we want ( − > 0). − ∼ − , 2 + 2 = 15.07 − 15,0.022 + 0.0222 = (0.07,0.000884) Hence − >0 = > 0−0.07 0.0.000884 = > −2.35 = < 2.35 = ≈ 0.991 Which of the following would make a random pipe more likely to fit into a random fitting? The outside diameter, X mm, of a copper pipe is N(15.00, 0.022) and the fittings for joining the pipe have inside diameter Y mm, where Y ~ N(15.07, 0.0222). Y 1. 2. 3. 4. X Decreasing mean of Y Increasing the variance of X Decreasing the variance of X Increasing the variance of Y 55% 16% 1 16% 14% 2 3 4 Which of the following would make a random pipe more likely to fit into a random fitting? The outside diameter, X mm, of a copper pipe is N(15.00, 0.022) and the fittings for joining the pipe have inside diameter Y mm, where Y ~ N(15.07, 0.0222). Y Answer Common sense. Or use = − ∼ − , 2 + 2 0 − < = >0 = > = < Larger probability if - larger (bigger average gap between pipe and fitting) - smaller (less fluctuation in gap size) 2 = 2 + 2 , so is smaller if variance of is decreased X Normal approximations Central Limit Theorem: If 1 , 2 … are independent random variables with the same distribution, which has mean and variance 2 (both finite), then the sum =1 tends to the distribution (, 2 ) as → ∞. 1 Hence: The sample mean = =1 is distributed approximately as 2 (, ). For the approximation to be good, n has to be bigger than 30 or more for skewed distributions, but can be quite small for simple symmetric distributions. The approximation tends to have much better fractional accuracy near the peak than in the tails: don’t rely on the approximation to estimate the probability of very rare events. It often also works for the sum of non-independent random variables, i.e. the sum tends to a normal distribution (but the variance is harder to calculate) Example: Average of n samples from a uniform distribution: Example: The mean weight of people in England is μ=72.4kg, with standard deviation =15kg. The London Eye at capacity holds 800 people at once. What is the distribution of the weight of the passengers at any random time when the Eye is full? Answer: The total weight of passengers is the sum of = 800 individual weights. Assuming independent: ⇒ by the central limit theorem ∼ (, 2 ) = 15Kg, = 800 ⇒ ∼ 800 × 72.4kg, 800 × 152 kg 2 = (58000kg, 180000kg 2 ) i.e. Normal with = 58000Kg , = 180000Kg = 424Kg [usual caveat: people visiting the Eye unlikely to actually have independent weights, e.g. families, school trips, etc.] Course Feedback Which best describes your experience of the lectures so far? Stopped prematurely, not many answers 1. 2. 3. 4. 5. 6. 7. 8. Too slow Speed OK, but struggling to understand many things Speed OK, I can understand most things A bit fast, I can only just keep up Too fast, I don’t have time to take notes though I still follow most of it Too fast, I feel completely lost most of the time I switch off and learn on my own from the notes and doing the questions I can’t hear the lectures well enough (e.g. speech too fast to understand or other people talking) 38% 31% 13% 13% 6% 0% 1 0% 2 3 4 5 6 0% 7 8 Course Feedback What do you think of clickers? 1. 2. 3. 4. 5. I think they are a good thing, help me learn and make lectures more interesting I enjoy the questions, but don’t think they help me learn I think they are a waste of time I think they are a good idea, but better questions would make them more useful I think they are a good idea, but need longer to answer questions 65% 14% 12% 7% 2% 1 2 3 4 5 Course Feedback How did you find the question sheets so far? 1. 2. 3. 4. 5. Challenging but I managed most of it OK Mostly fairly easy Had difficulty, but workshops helped me to understand Had difficulty and workshops were very little help I’ve not tried them 47% 20% 14% 16% 4% 1 2 3 4 5 Normal approximation to the Binomial If ∼ (, ) and is large and is not too near 0 or 1, then is approximately , 1 − . 1 2 = 10 = 1 2 = 50 = p=0.5 p=0.5 Approximating a range of possible results from a Binomial distribution e.g. (6 or fewer heads tossing a coin 10 times) = ( ≤ 6) if ∼ (10,0.5) ≤ 6 = = 0 + = 1 + ⋯ + = 6 = 0.8281 − 2 6.5 − 22 ≈ −∞ ≈Q 2 2 1.5 2.5 6.5 − =Q = Q 0.9487 = 0.8286 = = 5 2 = 1 − = 2.5 [not always so accurate at such low !] If ∼ (, 2 ) what is the best approximation for (3 or more heads when tossing a coin 10 times)? i.e. If ∼ (10,0.5), = 5, 2 = 1 − = 2.5, what is the best approximation for ( ≥ 3)? 1. ( > 2.5) 2. ( > 3) 3. ( > 3.5) 60% 27% 13% 1 2 3 Quality control example: The manufacturing of computer chips produces 10% defective chips. 200 chips are randomly selected from a large production batch. What is the probability that fewer than 15 are defective? Answer: mean = 200 × 0.1 = 20 variance 1 − = 200 × 0.1 × 0.9 = 18. So if is the number of defective chips, approximately ∼ 20,18 . Hence < 15 ≈ < 14.5 − 20 18 = < −1.296 = 1 − < 1.296 = 1 − [0.9015 + 0.6 × 0.9032 − 0.9015 ] ≈ 0.097 − ≈ 0.093. The Binomial This compares to the exact Binomial answer 14 =0 1 − answer is easy to calculate on a computer, but the Normal approximation is much easier if you have to do it by hand. The Normal approximation is about right, but not accurate.