Math Exam Help For any help regarding Math Exam Help visit : https://www.liveexamhelper.com/ , Email - info@liveexamhelper.com or call us at - +1 678 648 4277 Live Exam Helper
Problems 1 Confidence intervals 1. Basketball. Supp os e that against a certain opponent the number of points the MI T basketaball te am scores is normally distributed with unknown mean θ and unknown vari ance, σ 2 . Suppo se that over the course of the last 10 games between the two teams M I T scored the following points: 59, 62, 59, 74, 70, 61, 62, 66, 62, 75 (a)Compute a 95% t–confidence interval for θ. Does 95% confidence mean that the the interval you just found is 95%?
probability θ is in
(b) Now s u pp o s e that you learn that σ 2 = 25. Compute a 95% z–confidence interval for θ. How doe s this compare to the interval in ( a ) ? (c)Let X b e the number of points scored in a game. Supp os e that your friend is a confirmed Bayesian with a priori belief θ ∼ N (60, 16) and that X ∼ N (θ, 25). He computes a 95% probability interval for θ, given the data in part (a). How doe s this interval compare to the intervals in ( a ) and ( b ) ? (d) Which of the three intervals constructed above do you prefer? W hy? 2.T h e volume in a se t of wine bottles is known to follow a N(µ, 25) distribution. You take a sample of the bottles and measure their volumes. How many bottles do you have to sample to have a 95% confidence interval for µ with width 1? 3. Suppo s e data x 1 , . . . , x n are i.i.d. and drawn from N(µ, σ 2 ), where µ and σ are unknown. Sup pos e a data se t is taken and we have n = 49, sample mean x¯ = 92 and sample standard deviation s = 0.75. Find a 90% confidence interval for µ. 4.You do a poll to s e e what fraction p of the population supports candidate A over candidate B. (a) How many pe ople do you need to poll to know p to within 1% with 95% confidence. (b)Let p b e the fraction of the population who prefer candidate A. If you poll 400 people, how many have to prefer candidate A to so that the 90% confidence interval is entirely above p = 0.5.
Live Exam Helper
5. S u p p o s e you m ad e 40 confidence intervals with confidence level 95%. Abou t how many of t h e m would you ex p e c t to b e “wrong’? T h a t is, how many would not actually contain t h e parameter being es ti mate d? Should you b e surprised if 10 of t h e m are wrong?
2 χ 2 confidence interval 6. Hotel. A oc c up an c y 5.86 rooms confidence rented.
statistician c h o os e s 27 randomly se l e cte d dates, and w hen examining t h e records of a particular motel for th o s e dates, finds a standard deviation of rented. If t h e number of rooms rented is normally distributed, find t h e 95% interval for t h e population standard deviation of t h e number of rooms
3 Bootstrapping 7. Parametric bootstrap S u p p o s e we have a sampl e of size 100 drawn from unknown p. T h e M L E estimate for p is given b y b y pˆ = 1/x¯. 3.30, so pˆ = 1/x¯ = 0.30303.
a g e om ( p ) distribution A s s u m e for our data x¯
with =
(a) Outline t h e s t e p s ne2.68 e de d2.77 to 2.79 ge nerate a 2.82 parametric b oots tr ap2.8890%2.89 confidence 2.81 2.84 2.84 2.85 interval. 2.91 2.91 2.91 2.92 2.94 2.94 2.95 2.97 2.97 2.99 3.00
3.00
3.01
3.01
3.17 3.18 3.23 3.23 3.25 3.25 3.28 3.29 3.31 3.32 3.35 3.35 3.38 3.38 3.42 3.42 3.44 3.45 3.46 3.46 3.50 3.50 3.55 3.56 3.62 3.63 3.73 3.73 points x ,
3.20 3.23 3.25 3.29 3.32 3.36 3.39 3.43 3.45 3.47 3.52 3.57 3.65 .3.74 .x
3.20 3.24 3.26 3.30 3.34 3.36 3.39 3.43 3.45 3.47 3.52 3.58 3.65 3.76 with
3.01
3.03
3.04
3.04
3.04
3.04
3.22 3.23 3.25 3.25 3.27 3.27 3.30 3.30 3.35 3.35 3.37 3.37 3.40 3.41 3.44 3.44 3.45 3.46 3.49 3.49 3.54 3.54 3.61 3.61 3.70 3.72 =3.86 3.3.3.89
3.23 3.25 3.27 3.31 3.35 3.37 3.42 3.44 3.46 3.50 3.54 3.61 3.72 3.91
(b)S u p p o s e t h e following sorted list consists of 200 b oot st ra p m e ans c om p ut e d from a 3.04 3.05 3.06 3.06 3.07 3.07 3.07 3.08 3.08 3.08 sam pl e of size 100 drawn a geometric(0.30303) Use 3.13 t h e list to 3.08 from 3.09 3.09 3.10 3.11 3.11 distribution. 3.12 3.13 3.13 construct a 90% CI for p. 3.13 3.15 3.15 3.15 3.16 3.16 3.16 3.16 3.17 3.17
8. Empirical bootstrap S u p p o s e we ha d 100 data
1
.
100
3.20 3.24 3.26 3.30 3.34 3.37 3.40 3.43 3.45 3.49 3.52 3.59 3.67 3.78 sam pl e
3.21 3.21 3.24 3.24 3.26 3.26 3.30 3.30 3.34 3.34 3.37 3.37 3.40 3.40 3.43 3.44 3.45 3.45 3.49 3.49 3.52 3.53 3.59 3.60 3.67 3.68 3.79 median3.80 qˆ
Live Exam Helper
0 .5
(a)Outline t h e s t e p s ne e de d to ge nerate an empirical b oots tr ap 90% confidence interval for t h e median q0.5. (b)S u p p o s e now th at t h e sorted list in t h e previous proble ms consists of 200 empirical b oots tr ap medians c o m p u te d from re sam ple s of size 100 drawn from t h e original data. Use t h e list to construct a 90% CI for q0.5.
4 Linear regression/Least squares 9. Fitting a line to data using the MLE. S u p p o s e you have bivariate data (x 1 , y 1 ), . . . , ( x n , y n ). A common model is tha t the re is a linear relationship betwe en x and y, s o in principle t h e data shoul d lie exactly along a line. However since data h a s random noise and our model is probably not exac t this will not b e t h e case. W h at we can do is look for t h e line t ha t b e s t fi ts t h e data. To do this we will u s e a simple linear regression model. For bivariate data t h e simple linear regression mode l a s s u m e s t ha t t h e x i are not random b u t t ha t for s om e values of t h e parame ters a and b t h e value y i is drawn from t h e random variable Y i ∼ ax i + b + ε i where ε i is a normal random variable with mean 0 and variance σ 2 . We a ss u m e all of t h e random variables ε i are independent. Notes. 1. T h e model a s s u m e s th at σ is a known constant, t h e s a m e for e ac h ε i . 2. We think of ε i as t h e measureme nt error, so t h e model s ays th at y i = ax i + b + random measureme nt error. Give t h e formula for t h e likelihood function f (y i | a, b, x i , σ ) corresponding to one random 3. Re me m be r th at (x i , y i ) are not2 variables. T h e y are values of data. value y i . (Hint: y i − ax i − b ∼ N(0, σ ) .) (a) T h e distribution of Y i d e p e n d s on a, b, σ and x i . Of t h e s e only a and b are not known. (b) (i ) S u p p o s e we have data (1, 8), (3, 2), (5, 1). B a s e d on our model write down t h e likelihood and log likelihood a s functions of a, b, and σ. (ii) For general data (x 1 , y 1 ), . . . , ( x n , y n ) give t h e likelihood and and log likelihood functions (again as functions of a, b, and σ). (c) A s s u m e σ is a constant, known value. For t h e data in part b ( i ) find t h e maximum 10. W ha t is t h mate e relationship n correlation and least squares fit line? likelihood e sti s for a andbetwee b 11.
You have bivariate data (x i , y i ). You have reason to s u s p e c t t h e data is related b y all i). y i = a/ x i + Ui where Ui is a random variable with mean 0 and variance σ 2 ( t h e s am e for Find t h e least square s estimate of a.
Live Exam Helper
12. Least Squares and MLE. In this proble m we will s e e th at t h e least squares fit of a line is j u s t t h e M L E assuming t h e error te rm s are normally distributed. For bivariate data (x 1 , y 1 ), . . . , ( x n , y n ), t h e simple linear regression model s ays th at y i is a random value generated b y a random variable Yi = ax i + b + ε i where a, b, x i are fi xe d (not random) values, and ε i is a random variable with mean 0 and variance σ 2 . (a) S u p p o s e th at e ac h ε i ∼ N(0, σ 2 ). Show tha t Yi ∼ N(ax i + b, σ 2 ). (b) Give t h e formula for t h e p df f Y i ( y i ) of Y i . (c) Write down t h e likelihood of t h e data a s a function of a, b, and σ.
Live Exam Helper
Standard normal table of left tail probabilities. z -4.00 -3.95 -3.90 -3.85 -3.80 -3.75 -3.70 -3.65 -3.60 -3.55 -3.50 -3.45 -3.40 -3.35 -3.30 -3.25 -3.20 -3.15 -3.10 -3.05 -3.00 -2.95 -2.90 -2.85 -2.80 -2.75 -2.70 -2.65 -2.60 -2.55 -2.50 -2.45 -2.40 -2.35 -2.30 -2.25 -2.20 -2.15 -2.10 -2.05
Φ(z) 0.0000 0.0000 0.0000 0.0001 0.0001 0.0001 0.0001 0.0001 0.0002 0.0002 0.0002 0.0003 0.0003 0.0004 0.0005 0.0006 0.0007 0.0008 0.0010 0.0011 0.0013 0.0016 0.0019 0.0022 0.0026 0.0030 0.0035 0.0040 0.0047 0.0054 0.0062 0.0071 0.0082 0.0094 0.0107 0.0122 0.0139 0.0158 0.0179 0.0202
z -2.00 -1.95 -1.90 -1.85 -1.80 -1.75 -1.70 -1.65 -1.60 -1.55 -1.50 -1.45 -1.40 -1.35 -1.30 -1.25 -1.20 -1.15 -1.10 -1.05 -1.00 -0.95 -0.90 -0.85 -0.80 -0.75 -0.70 -0.65 -0.60 -0.55 -0.50 -0.45 -0.40 -0.35 -0.30 -0.25 -0.20 -0.15 -0.10 -0.05
Φ(z) 0.0228 0.0256 0.0287 0.0322 0.0359 0.0401 0.0446 0.0495 0.0548 0.0606 0.0668 0.0735 0.0808 0.0885 0.0968 0.1056 0.1151 0.1251 0.1357 0.1469 0.1587 0.1711 0.1841 0.1977 0.2119 0.2266 0.2420 0.2578 0.2743 0.2912 0.3085 0.3264 0.3446 0.3632 0.3821 0.4013 0.4207 0.4404 0.4602 0.4801
z 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45 0.50 0.55 0.60 0.65 0.70 0.75 0.80 0.85 0.90 0.95 1.00 1.05 1.10 1.15 1.20 1.25 1.30 1.35 1.40 1.45 1.50 1.55 1.60 1.65 1.70 1.75 1.80 1.85 1.90 1.95
Φ(z) 0.5000 0.5199 0.5398 0.5596 0.5793 0.5987 0.6179 0.6368 0.6554 0.6736 0.6915 0.7088 0.7257 0.7422 0.7580 0.7734 0.7881 0.8023 0.8159 0.8289 0.8413 0.8531 0.8643 0.8749 0.8849 0.8944 0.9032 0.9115 0.9192 0.9265 0.9332 0.9394 0.9452 0.9505 0.9554 0.9599 0.9641 0.9678 0.9713 0.9744
z 2.00 2.05 2.10 2.15 2.20 2.25 2.30 2.35 2.40 2.45 2.50 2.55 2.60 2.65 2.70 2.75 2.80 2.85 2.90 2.95 3.00 3.05 3.10 3.15 3.20 3.25 3.30 3.35 3.40 3.45 3.50 3.55 3.60 3.65 3.70 3.75 3.80 3.85 3.90 3.95
Φ ( z) 0.9772 0.9798 0.9821 0.9842 0.9861 0.9878 0.9893 0.9906 0.9918 0.9929 0.9938 0.9946 0.9953 0.9960 0.9965 0.9970 0.9974 0.9978 0.9981 0.9984 0.9987 0.9989 0.9990 0.9992 0.9993 0.9994 0.9995 0.9996 0.9997 0.9997 0.9998 0.9998 0.9998 0.9999 0.9999 0.9999 0.9999 0.9999 1.0000 1.0000
Φ(z) = P ( Z ≤ z ) for N(0, 1). (Use interpolation to estimate values to a 3rd decimal place.)
z
Live Exam Helper
Table of Student t critical values (right-tail) T h e table sh ows tdf, p = t h e 1 − p quantile of t(df ). We only give values for p ≤ 0.5. Use s ym m e try to find t h e values for p > 0.5, e.g. t5, 0.975 = −t5, 0.025
In R notation tdf, p = qt(1-p, df). df\p 1 2 3 4 5 6 7 8 9 10 16 17 18 19 20 21 22 23 24 25 30 31 32 33 34 35 40 41 42 43 44 45 46 47 48 49
0.005 63.66 9.92 5.84 4.60 4.03 3.71 3.50 3.36 3.25 3.17 2.92 2.90 2.88 2.86 2.85 2.83 2.82 2.81 2.80 2.79 2.75 2.74 2.74 2.73 2.73 2.72 2.70 2.70 2.70 2.70 2.69 2.69 2.69 2.68 2.68 2.68
0.010 31.82 6.96 4.54 3.75 3.36 3.14 3.00 2.90 2.82 2.76 2.58 2.57 2.55 2.54 2.53 2.52 2.51 2.50 2.49 2.49 2.46 2.45 2.45 2.44 2.44 2.44 2.42 2.42 2.42 2.42 2.41 2.41 2.41 2.41 2.41 2.40
0.015 21.20 5.64 3.90 3.30 3.00 2.83 2.71 2.63 2.57 2.53 2.38 2.37 2.36 2.35 2.34 2.33 2.32 2.31 2.31 2.30 2.28 2.27 2.27 2.27 2.27 2.26 2.25 2.25 2.25 2.24 2.24 2.24 2.24 2.24 2.24 2.24
0.020 15.89 4.85 3.48 3.00 2.76 2.61 2.52 2.45 2.40 2.36 2.24 2.22 2.21 2.20 2.20 2.19 2.18 2.18 2.17 2.17 2.15 2.14 2.14 2.14 2.14 2.13 2.12 2.12 2.12 2.12 2.12 2.12 2.11 2.11 2.11 2.11
0.025 12.71 4.30 3.18 2.78 2.57 2.45 2.36 2.31 2.26 2.23 2.12 2.11 2.10 2.09 2.09 2.08 2.07 2.07 2.06 2.06 2.04 2.04 2.04 2.03 2.03 2.03 2.02 2.02 2.02 2.02 2.02 2.01 2.01 2.01 2.01 2.01
0.030 10.58 3.90 2.95 2.60 2.42 2.31 2.24 2.19 2.15 2.12 2.02 2.02 2.01 2.00 1.99 1.99 1.98 1.98 1.97 1.97 1.95 1.95 1.95 1.95 1.95 1.94 1.94 1.93 1.93 1.93 1.93 1.93 1.93 1.93 1.93 1.93
0.040 7.92 3.32 2.61 2.33 2.19 2.10 2.05 2.00 1.97 1.95 1.87 1.86 1.86 1.85 1.84 1.84 1.84 1.83 1.83 1.82 1.81 1.81 1.81 1.81 1.80 1.80 1.80 1.80 1.79 1.79 1.79 1.79 1.79 1.79 1.79 1.79
0.050 6.31 2.92 2.35 2.13 2.02 1.94 1.89 1.86 1.83 1.81 1.75 1.74 1.73 1.73 1.72 1.72 1.72 1.71 1.71 1.71 1.70 1.70 1.69 1.69 1.69 1.69 1.68 1.68 1.68 1.68 1.68 1.68 1.68 1.68 1.68 1.68
0.100 3.08 1.89 1.64 1.53 1.48 1.44 1.41 1.40 1.38 1.37 1.34 1.33 1.33 1.33 1.33 1.32 1.32 1.32 1.32 1.32 1.31 1.31 1.31 1.31 1.31 1.31 1.30 1.30 1.30 1.30 1.30 1.30 1.30 1.30 1.30 1.30
0.200 1.38 1.06 0.98 0.94 0.92 0.91 0.90 0.89 0.88 0.88 0.86 0.86 0.86 0.86 0.86 0.86 0.86 0.86 0.86 0.86 0.85 0.85 0.85 0.85 0.85 0.85 0.85 0.85 0.85 0.85 0.85 0.85 0.85 0.85 0.85 0.85
0.300 0.73 0.62 0.58 0.57 0.56 0.55 0.55 0.55 0.54 0.54 0.54 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53 0.53
0.400 0.32 0.29 0.28 0.27 0.27 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.26 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25 0.25
0.500 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
Live Exam Helper
Table of χ 2 critical values (right-tail) T h e table s h ows cdf, p = t h e 1 − p quantile of χ 2 (df ). In R notation cdf, p = qchisq(1-p, df). df\p
0.010
0.025
0.050
0.100
0.200
0.300
0.500
0.700
0.800
0.900
0.950
0.975
0.990
1 2 3 4 5 6 7 8 9 10 16 17 18 19 20 21 22 23 24 25 30 31 32 33 34 35 40 41 42 43 44 45 46 47 48 49
6.63 9.21 11.34 13.28 15.09 16.81 18.48 20.09 21.67 23.21 32.00 33.41 34.81 36.19 37.57 38.93 40.29 41.64 42.98 44.31 50.89 52.19 53.49 54.78 56.06 57.34 63.69 64.95 66.21 67.46 68.71 69.96 71.20 72.44 73.68 74.92
5.02 7.38 9.35 11.14 12.83 14.45 16.01 17.53 19.02 20.48 28.85 30.19 31.53 32.85 34.17 35.48 36.78 38.08 39.36 40.65 46.98 48.23 49.48 50.73 51.97 53.20 59.34 60.56 61.78 62.99 64.20 65.41 66.62 67.82 69.02 70.22
3.84 5.99 7.81 9.49 11.07 12.59 14.07 15.51 16.92 18.31 26.30 27.59 28.87 30.14 31.41 32.67 33.92 35.17 36.42 37.65 43.77 44.99 46.19 47.40 48.60 49.80 55.76 56.94 58.12 59.30 60.48 61.66 62.83 64.00 65.17 66.34
2.71 4.61 6.25 7.78 9.24 10.64 12.02 13.36 14.68 15.99 23.54 24.77 25.99 27.20 28.41 29.62 30.81 32.01 33.20 34.38 40.26 41.42 42.58 43.75 44.90 46.06 51.81 52.95 54.09 55.23 56.37 57.51 58.64 59.77 60.91 62.04
1.64 3.22 4.64 5.99 7.29 8.56 9.80 11.03 12.24 13.44 20.47 21.61 22.76 23.90 25.04 26.17 27.30 28.43 29.55 30.68 36.25 37.36 38.47 39.57 40.68 41.78 47.27 48.36 49.46 50.55 51.64 52.73 53.82 54.91 55.99 57.08
1.07 2.41 3.66 4.88 6.06 7.23 8.38 9.52 10.66 11.78 18.42 19.51 20.60 21.69 22.77 23.86 24.94 26.02 27.10 28.17 33.53 34.60 35.66 36.73 37.80 38.86 44.16 45.22 46.28 47.34 48.40 49.45 50.51 51.56 52.62 53.67
0.45 1.39 2.37 3.36 4.35 5.35 6.35 7.34 8.34 9.34 15.34 16.34 17.34 18.34 19.34 20.34 21.34 22.34 23.34 24.34 29.34 30.34 31.34 32.34 33.34 34.34 39.34 40.34 41.34 42.34 43.34 44.34 45.34 46.34 47.34 48.33
0.15 0.71 1.42 2.19 3.00 3.83 4.67 5.53 6.39 7.27 12.62 13.53 14.44 15.35 16.27 17.18 18.10 19.02 19.94 20.87 25.51 26.44 27.37 28.31 29.24 30.18 34.87 35.81 36.75 37.70 38.64 39.58 40.53 41.47 42.42 43.37
0.06 0.45 1.01 1.65 2.34 3.07 3.82 4.59 5.38 6.18 11.15 12.00 12.86 13.72 14.58 15.44 16.31 17.19 18.06 18.94 23.36 24.26 25.15 26.04 26.94 27.84 32.34 33.25 34.16 35.07 35.97 36.88 37.80 38.71 39.62 40.53
0.02 0.21 0.58 1.06 1.61 2.20 2.83 3.49 4.17 4.87 9.31 10.09 10.86 11.65 12.44 13.24 14.04 14.85 15.66 16.47 20.60 21.43 22.27 23.11 23.95 24.80 29.05 29.91 30.77 31.63 32.49 33.35 34.22 35.08 35.95 36.82
0.00 0.10 0.35 0.71 1.15 1.64 2.17 2.73 3.33 3.94 7.96 8.67 9.39 10.12 10.85 11.59 12.34 13.09 13.85 14.61 18.49 19.28 20.07 20.87 21.66 22.47 26.51 27.33 28.14 28.96 29.79 30.61 31.44 32.27 33.10 33.93
0.00 0.05 0.22 0.48 0.83 1.24 1.69 2.18 2.70 3.25 6.91 7.56 8.23 8.91 9.59 10.28 10.98 11.69 12.40 13.12 16.79 17.54 18.29 19.05 19.81 20.57 24.43 25.21 26.00 26.79 27.57 28.37 29.16 29.96 30.75 31.55
0.00 0.02 0.11 0.30 0.55 0.87 1.24 1.65 2.09 2.56 5.81 6.41 7.01 7.63 8.26 8.90 9.54 10.20 10.86 11.52 14.95 15.66 16.36 17.07 17.79 18.51 22.16 22.91 23.65 24.40 25.15 25.90 26.66 27.42 28.18 28.94
Live Exam Helper
Solutions 1 Confidence intervals To practice for the exam use the t and z-tables supplied at the end of this file. Be sure to learn to use these tables. Note t h e t and z-tables give left tail probabilities and t h e χ 2 -table gives right tail critical values. 1. (a) We c o m p u te t h e data mean and variance x¯ = 65, s 2 = 35.778. T h e number of de gre e s of freedom is 9. We look u p th e critical value t9,0.025 = 2.262 in t h e t-table T h e 95% confidence interval is √ √ t 9,0.025s t 9,0.025 s √ x¯ − √ n , x¯ + n = 65 − 2.262 3.5778, 65 + 2.262 3.5778 = [60.721, 69.279] On t h e exam you will b e ex p e c t e d to b e able to u s e t h e t-table. We won’t ask you to c om p u t e b y hand t h e mean and variance of 10 numbers. 95% confidence me ans t ha t in 95% of experiments t h e random interval will contain t h e true θ. It is not t h e probability t ha t θ is in t h e given interval. T h a t d e p e n d s on t h e prior distribution for θ, which we don’t know. ( b) We can look in t h e z-table or simply re membe r th at z0.025 = 1.96. T h e 95% confidence z σ z σ 1.96 · 5 1.96 · 5 interval x¯ is − 0.025 , x¯ + 0.025 = 65 − √ , 65 + = [61.901, 68.099] √ n √ n 10 10 Th is is a narrower interval√ than in part ( a ) . Th e re are two reasons for this, first t h e true variance 25 is smaller than t h e samp le variance 35.8 and second, t h e normal distribution h a s narrower tails than t h e t distribution. (c) We u s e t h e normal-normal u p d a t e formulas to find t h e posterior p d f for θ. 1 10 a60 + b65 1 = = 2.16. post a + b = 64.3, a + σb2post a = 16 , b = 25 , µ = T h e posterior p d f is f (θ|data) = N(64.3, 2.16). T h e posterior 95% probability interval for θ is √
√
64.3 − z 0.025 2.16, 64.3 + z 0.025 2.16 = [61.442, 67.206] (d) The re’s no one correct answer; e ach m e t ho d h a s its own advantages and 2. S u p p o s e we In have data . , xgive meananswers. x¯. T h e 95% confidence interval for disadvantages. thistaken m t hxe 1 ,y. .all n with σproble σsimilar t h e mean is x ± z0.025 √
n
. Thi s h a s width 2 z0.025 √
n
. Setting t h e width equal to 1 and
substitituting values z0.025 = 1.96 and σ5= 5 we g e t√ 2 · 1.96 √ = 1 ⇒ n = 19.6. n
Live Exam Helper 1
So, n = (19.6) 2 = 384. . √
If we u s e our rule of thum b t ha t z0.025 = 2 we have n/ 1 0 = 2 ⇒ n = 400. x¯ − µ We t ∼ t(n−1) t(48). So we u semean t h e m t== 48 line √ of 3. know We need to u s e= th e studentized .. t h e t table and find t 0.05 = 1.677. Thus, s / x¯ n−µ P (−1.677 < √ < 1.677 | µ) = 0.90. s/
n
Σ Σ Σ Σ Unwinding s this, we sg e t t h e 90% confidence 0.75 interval for µ is 0.75 · · 1.677, 92 + 1.677 = x¯ − √ · 1.677, x¯ + √ · 1.677 = 7 7 n n 92 − 4. (a) 1% we ne ed
[91.82, 92.18].
√
T h e rule-of-thumb is tha t a 95% confidence interval is x¯ ± 1 / n . To b e within 1 √ = 0.01 ⇒ n = 10000. n
Using z0.025 = 1.96 instead t h e 95% confidence interval is z √ . x¯ ± 0.025 To b e within 1% we need
2 n
z0.025 √ = 0.01 ⇒ n = 9604. 2 n
Note, we are still using t h e standard Bernoulli approximation σ ≤ 1/2. ( b) T h e 90% confidence interval is x ± z0.05 ·. Since z0.05 = 1.64 and n = 400 our 2√n1 confidence interval 1 is x ± 1.64 · = x ± 0.041 40 If this is entirely above 0.5 we have x − 0.041 > 0.5, so x > 0.541. Let T b e t h e number out of 400 who prefer A. We have x = T400 > 0.541, so T > 216 . 5. A 95% confidence me ans ab out 5% = 1/20 will b e wrong. You’d ex p e c t ab ou t 2 to b e wrong. With a probability p = 0.05 of being wrong, t h e number wrong gfollows a Binomial(40, p) distribution. Thi s h a s e x p e c t e d value 2, and standard deviation 40(0.05)(0.95) = 1.38. 10 wrong is (10-2)/1.38 = 5.8 standard deviations from t h e mean. Thi s would b e surprising.
2
χ 2 confidence interval
6.
( n − 1)s 2 2 ∼hχyp n − 2 We have n = 27 and s 2 = 5.86 2 . If we fix a o1 th e s i s for σ 2 we know σ
Live Exam Helper
We u se d R to find t h e critical values. (Or u s e t h e χ 2 table at t h e end of this file.) c025 = qchisq(0.975,26) = 41.923 c975 = qchisq(0.025,26) = 13.844 T h e 95% confidence interval Σ for Σσ 2 is Σ 2 ( n − 1) · s ( n − 1) · s 2 , =
Σ 26 · 5.86226 · 5.862 , = [21.2968, 64.4926] 41.923 13.844 c0.025 c0.975 We can take square roots to find t h e 95% confidence interval for σ [4.6148, 8.0307] On t h e exa m we will give you e nough of a table to c om p u t e t h e critical values you need for χ 2 distributions.
3
Bootstrapping
7. (a) S t e p 1. We have t h e point e stimate p ≈ pˆ = 0.30303. S t e p 2. Use t h e c ompute r to generate many ( s a y 10000) size 100 samples. ( T h e s e are called t h e b oots tr ap sampl e s.) S t e p 3. For e ach sampl e c om p u te p∗ = 1/x¯∗ and δ∗ = p∗ − pˆ. S t e p 4. Sort t h e δ∗ and find t h e critical values δ0.95 and δ0.05. ( Re m e m b e r δ0.95 is t h e 5th percentile e t c .) S t e p 5. T h e 90% b oots tr ap confidence interval for p is [pˆ − δ0.05, pˆ − δ0.95] ( b) It’s tricky to ke e p t h e si des straight here. We work slowly and carefully: T h e 5th and 95th percentiles for x¯∗are t h e 10th and 190th entries 2.89, 3.72 (Here again the re is s o m e ambiguity on which entries to use. We will ac c e p t using t h e 11th or t h e 191st entries or so m e interpolation between t h e s e entries.) So t h e 5th and 95th percentiles for p∗ are −0.034213, 0.042990 1/3.72 = 0.26882, 1/2.89 = 0.34602 T h e s e are also t h e 0.95 and 0.05 critical e 90% CI for p is for δ∗ = p∗ − pˆ are So values. t h e 5th So andt h95th percentiles [0.30303 − 0.042990, 0.30303 + 0.034213] = [0.26004, 0.33724] 8. (a) T h e s t e p s are t h e s a m e as in t h e previous proble m exc e p t t h e b oots tr ap sa m pl e s are ge ne rated in different ways.
Live Exam Helper
Step Step Step Step e t c .) Step
1. 2. 3. 4.
We have t h e point e stimate q0.5 ≈ qˆ0.5 = 3.3. Use t h e com pute r to generate many ( s a y 10000) size 100 re sampl e s of t h e original data. For eac h sam ple c o m p u te t h e median q0∗.5 and δ∗ = q0∗.5 − qˆ0.5. Sort t h e δ∗ and find t h e critical values δ0.95 and δ0.05. ( Re m e m be r δ0.95 is t h e 5th percentile
5. T h e 90% b oots tr ap confidence interval for q0.5 is [qˆ0.5 − δ0.05, qˆ0.5 − δ0.95]
( b) Thi s is very similar to t h e previous problem. We p roc e e d slowly and carefully to g e t te rms on t h e correct side of t h e inequalities. T h e 5th and 95th percentiles for q0∗.5 are 2.89, 3.72 S o t h e 5th and 95th percentiles for δ∗ = q0∗.5 − qˆ0.5 are [2.89 − 3.3,
3.72 − 3.3] = [−0.41,
0.42]
T h e s e are also t h e 0.95 and 0.05 critical values. So t h e 90% CI for p is [3.3 − 0.42, 3.3 + 0.41] = [2.91, 3.71]
4 9.
Linear regression/Least squares (a)
1 e− f (y f|ε ia,for b, xt ,hσe) normal = f (y − ax − b) = √is known. T h e density distribution σ 2π i
i
ε
i
i
i
(y − i a x −ib ) 2σ 2
2
.
(b) (i ) T h e y values are 8, 2, 1. T h e likelihood function is a produc t of t h e densities found in part ( a ) f (y-data | a, b, σ, x -data) =
1
3
√
σ 2π l n ( f (y-data | a, b, σ, x - dat a)) = −3 ln (σ) −
2
e−((8−a−b) 3 ln(2π) −
2 2 +(2−3a−b) +(1−5a−b) )/2σ
2
2
(8 − a − b)2 + (2 − 3a − b)2 + (1 − 5a − b)2 2σ 2
(ii) We j us t c o py our answer in part ( i ) replacing t h e explicit values of x i and y i b y their sym bol s n � 2 1 − (y − aj x −b) /22 σ nj =1 j √ f (y 1 , . . . , y n | a, b, σ, x 1 , . . . , x n ) = σ 2π e nn n 2 l n ( f (8, 3, 2 | a, b, σ ) ) = −n l n( σ) − ln(2π) − (y −j ax − jb) / 2 σ 2 2 j =1
Live Exam Helper
Post-exam 2 practice solutions, Spring 2014
5
(c) We s e t partial derivatives to 0 to try and find t h e MLE. (Don’t forget th at σ is a contstant.) ∂ l n ( f (8, 3, 2 | a, b, σ ) ) −2(8 = − − a − b) − 6(2 − 3a − b) −2 10(1 − 5a − b) 2σ ∂a −70a − 18b + 38 =
2σ 2 = 0 a − b) − 2(2 − 3a − b) − 2(1 − 5a − b) ∂ l n ( f (8, 3, 2 | a, b, σ⇒ + −2(8 18b =−38 ) ) 70a = − 2σ 2 ∂b −18a − 6b + 22 =
2σ 2 = 0 ⇒ 18a + 6b = 22
y
x = c(1,3,5) y = c(8,2,1) a = -7/4 b = 107/12 plot(x,y,pch=19,col="blue") abline(a=b,b=a, col="magenta")
Here’s the
1 2 34 5 6 7 8
7 + 18b 107 We have two simultaneous equations: 70a = 38, 18a + 6b = a = − b = b and solve for a. We 22. T h e s e are e a s y to solve, e.g. first eliminate 4 12 You g e t can u s e R to plot t h e data and t h e regression line you found in part ( c ) . R c o d e I u s e d to make t h e plot
1
2
3
4
5
x
10. T h e correlation betwe en x and y is t h e s a m e as t h e coefficient b1 of t h e b e s t fit to t h e standardized line x i − x¯ y − y¯ u i= , v i= i data √ √ s xx
11.
s yy
T h e total squared error is S(a) = n
.
yi −
Taking t h e derivative and se tting it to 0 gives. n 2 S /( a) = − y xi
i
Σ
a
2
.
x
i
−
a Σ = 0 xi
Live Exam Helper
This implies
a
n
1 = n
x 2i
yi y i/ x x i ⇒ aˆ = _1/x 2
i i
.
12. (a) We’re given ε i ∼ N(0, σ 2 ). Since ax i + b is a constant, Y i is simply a shift of ε i . Thus E ( Y i ) = ax i + b + E ( ε i ) = ax i + b Var(Y i ) = Var(ε i ) = σ 2 . Since a shifted normal random variable is still normal2 (you should b e able to 1 e− (y i− a x −i2b ) . show this by transforming cdf’s) we have Yi i 2σ f (y ) = √ 2π σ Y i ∼ N(ax i + b, σ 2 ). (c) (b) T he density for a normal distribution is known f (data | σ, a, b) = f Y 1 (y 1 )f Y 2 (y 2 ) ·� · · fY n (yn ) � n 1 nn 2 − 2 −n = (2π) σ ex p 2σ 2 i=1 (y i − ax i − b) . − (d) T h e log likelihood is 1 nn n 2 ln(f (data | σ, a, b)) = − log 2π − n (y i − ax i − b) 2 2 2σ i=1 log σ − If σ is constant then the only part of the log likelihood that varies is the sum in the last term. So, the maximum likelihood is found by maximizing this sum: nn 2 − (y − i ax − i b) . i=1
Notice the minus sign out front. This is exactly the same as nn minimizing (y i − ax i − b) . 2 i=1
This last expression is the expression minimized by least squares. Therefore, under our normality assumptions, the values of a and b are the same for ML E and least squares.
Live Exam Helper