2017 Stats Midterm Solutions ------------------------------- ### Question 1 #1.1 33 #1.2 11 #1.3 123.5 #1.4 41 #1.5 > 33 + 11*c(-2,2) [1] 11 55 ### Question 2 #2.1 .6 #2.2 2.6 > x1=14;y1=20 > x2=26;y2=55 > (y2-y1)/(x2-x1) [1] 2.916667 #2.3 -18 > 35-2.6*20 [1] -17 #2.4 2.5 #2.5 16.9 > .6*2.5*11 [1] 16.5 #2.6 -18 + 2.6*18 [1] 28.8 ### Question 3 #3.1 .8 #3.2 > 1*.2+2*.5+3*.3 [1] 2.1 #3.3 .2*(1-2.1)^2 + .5*(2-2.1)^2 + .3*(3-2.1)^2 [1] 0.49 > pv = c(.2,.5,.3) > tv = 1:3 > sum(pv*tv) [1] 2.1 > sum(pv*(tv-2.1)^2) [1] 0.49 #3.4 > sqrt(.49) [1] 0.7 #3.5 > 10+5*2.1 [1] 20.5 #3.6 > 5^2 * .49 [1] 12.25 #3.7 > sqrt(12.25) [1] 3.5 > 5*.7 [1] 3.5 ### Question 4 #4.1 .2 #4.2 .68 #4.3 > .56/(.56+.2) [1] 0.7368421 #4.4 No. P(Y=1) != P(Y=1 | X=1). #4.5 X ~ Bernoulli(.76) #4.6 .76 #4.7 > .76*(1-.76) [1] 0.1824 #4.8 No, they are not independent. #4.9 given X=0, Y~Bernoulli(.5) #4.10 Var(Y|X=0)=.25. #4.11 Given X=0, var of a Bernoulli is maxed at p=.5. #4.12 When you learn X=1 p is .74 but when you learn X=0, p=.5 so you can lean towards Y=1 when X=1 but when X=0 is is literally a coin toss. ### Question 5 #5.1 .5 #5.2 .95 #5.3 .68 #5.4 .975 #5.5 .63 #5.6 > 1-.63 [1] 0.37 ### Question 6 #6.1 There is no obvious pattern over time so IID Bern is plausible. #6.2 > .3^3 [1] 0.027 #6.3 > .7^3 [1] 0.343 #6.4 same as #6.2 .027 #6.5 The D sequences such that T=1 are 1,0,0 0,1,0 0,0,1 each has prob .3*.7^2 = 0.147 So the prob is 3*.147 = 0.441 Note, T3 is the number of 1's out of 3 ``trials''. Tn is the number of 1's out of n trials. If we let p be the probability of a 1, then the number of 1's out of n trials is called a binomial random variable. > dbinom(3,3,.3) #chance of the 3 1's out of 3 trials, p=.3 [1] 0.027 > dbinom(1,3,.3) #change of 1 1 out of 3 trials, p=.3 [1] 0.441 e.g suppose we toss a coin 10 times, what is the distribution of the number of heads: > x = 0:10 > px = dbinom(x,10,.5) > cbind(x,px) x px [1,] 0 0.0009765625 [2,] 1 0.0097656250 [3,] 2 0.0439453125 [4,] 3 0.1171875000 [5,] 4 0.2050781250 [6,] 5 0.2460937500 [7,] 6 0.2050781250 [8,] 7 0.1171875000 [9,] 8 0.0439453125 [10,] 9 0.0097656250 [11,] 10 0.0009765625 e.g. > .5^10 [1] 0.0009765625 ### Question 7 #7.1 Assume I decide based on the expected value of my monetary payout, if I promote I get 98 with prob .03 and -2 with prob .97. > .03*98 + .97*(-2) = 1 So I promote. #7.2 > .03*.53 [1] 0.0159 #7.3 > .97*.87 [1] 0.8439 #7.4 > .0159+.8439 [1] 0.8598 #7.5 > .0159/.8598 [1] 0.01849267 lower than the marginal prob of .03 which makes sense. #7.6 > 100*.0185-2 [1] -0.15 > .0185*98 + (1-.0185)*(-2) [1] -0.15 #7.7 > .03*.33 [1] 0.0099 > .97*.08 [1] 0.0776 > 0.0099/(0.0099+0.0776) [1] 0.1131429 or just .03*.33/(.03*.33 + .97*.08) [1] 0.1131429 E(A) = 0.1131429*98 + (1-0.1131429)*(-2) [1] 9.31429 should promote.