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
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 2π2 (ββ < π₯ < β) π π: 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 ββ 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. 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. 60% 1 β π(π > 0.7) π(π > β0.7) 1 β π(π > β0.7) 1 β π(π < β0.7) 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 β 2π2 π β ββ β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.