#OK to post homeowork #William Wang, 10/6/2020, Assignment 17a #1. L2000 := [3 $ 8, 4 $ 6, 5 $ 4, 6 $ 2, 7 $ 3, 8 $ 6, 9 $ 2, 10 $ 2, 11 $ 4, 12 $ 2, 13 $ 2, 14, 15, 18, 21, 22, 23, 25, 32, 33, 54]: L2004 := [3 $ 8, 4 $ 5, 5 $ 5, 6 $ 3, 7 $ 4, 8 $ 2, 9 $ 3, 10 $ 4, 11 $ 4, 12, 13, 15 $ 3, 17, 20, 21 $ 2, 27, 31, 34, 55]: L2008 := [3 $ 8, 4 $ 5, 5 $ 5, 6 $ 3, 7 $ 4, 8 $ 2, 9 $ 3, 10 $ 4, 11 $ 4, 12, 13, 15 $ 3, 17, 20, 21 $ 2, 27, 31, 34, 55]: L2012 := [3 $ 8, 4 $ 5, 5 $ 3, 6 $ 6, 7 $ 3, 8 $ 2, 9 $ 3, 10 $ 4, 11 $ 4, 12, 13, 14, 15, 16 $ 2, 18, 20 $ 2, 29 $ 2, 38, 55]: #The above lists are of the US states' electoral votes. Maine and Nebraska allow for their electoral votes to be split between candidates, which is not reflected in the L2000 through L2016. L2016 := [1 $ 6, 2 $ 3, 3 $ 9, 4 $ 4, 5 $ 2, 6 $ 6, 7 $ 3, 8 $ 3, 9 $ 3, 10 $ 4, 11 $ 4, 13, 14, 15, 16 $ 2, 18, 20 $ 2, 29 $ 2, 36, 55]: #The above list for the 2016 presidential election reflects the split of all of the electoral votes within each state for different candidates. Some states like Texas had faithless electors, which did not vote for the candidates they pledged to vote for. This is why the second-to-last element is 36, instead of 38 (total number of electoral votes for Texas) coeff(GFv(L2000, x), x, 271); 17138906152296 coeff(GFv(L2004, x), x, 286); 16270287085726 coeff(GFv(L2008, x), x, 365); 3129970155515 coeff(GFv(L2012, x), x, 332); 8628577597686 coeff(GFv(L2016, x), x, 304); 3577280662999687 #2. #i. Estimated probability of winning with exactly 270 electoral votes, assuming probability of either candidate winning a state is the same for each state i.e. p = 0.5 L2020 := [1 $ 5, 2 $ 2, 3 $ 8, 4 $ 4, 5 $ 2, 6 $ 6, 7 $ 3, 8 $ 2, 9 $ 3, 10 $ 4, 11 $ 4, 12, 13, 14, 15, 16 $ 2, 18, 20 $ 2, 29 $ 2, 38, 55] evalf(coeff(GFvp(L2020, 1/2, x), x, 270)); 0.007546429241 #ii. Estimated probability of winning (candidate has >=270 electoral votes), assuming probability of either candidate winning a state is the same for each state i.e. p = 0.5 evalf(sum(coeff(GFvp(L2020, 1/2, x), x, i), i = 270 .. 538)); 0.4962261720 #Close to 0.5 #3. sc1 := SimuCount(USEC(), 3/10, 2000, 4); sc1 := [160.8295000, 45.98730727, 0.2752214152, 2.909366212], 0.4390000000 sc2 := SimuCount(USEC(), 2/5, 2000, 4); sc2 := [215.4845000, 50.86209550, 0.1528024414, 2.815584301], 0.2615000000 sc3 := SimuCount(USEC(), 1/2, 2000, 4); sc3 := [268.7240000, 50.88636187, 0.03764924683, 2.670955864], 0.1535000000 sc4 := SimuCount(USEC(), 3/5, 2000, 4); sc4 := [323.3530000, 49.76104291, -0.1217813307, 2.823037530], 0.2370000000 #The estimated consistency for each p (second output) is not very similar. For p=3/10, it is about 0.439, for p=2/5, it is about 0.2615, for p=1/2, it is about 0.1535, and for p=3/5, it is about 0.237 sa1 := evalf(StatAnal(GFvp(USEC(), 3/10, x), x, 4)); sa1 := [161.4000000, 46.65683230, 0.2695069204, 2.844567676] sa2 := evalf(StatAnal(GFvp(USEC(), 2/5, x), x, 4)); sa2 := [215.2000000, 49.87825176, 0.1260503198, 2.769840597] sa3 := evalf(StatAnal(GFvp(USEC(), 1/2, x), x, 4)); sa3 := [269., 50.90677755, 0., 2.748917015] sa4 := evalf(StatAnal(GFvp(USEC(), 3/5, x), x, 4)); sa4 := [322.8000000, 49.87825176, -0.1260503198, 2.769840597] #SimuCount(USEC(),7/5,2000,4) and evalf(StatAnal(GFvp(USEC(),7/5,x),x,4)) are invalid, since p = 7/5 is greater than 1 sa1 - sc1[1]; [0.5705000, 0.66952503, -0.0057144948, -0.064798536] sa2 - sc2[1]; [-0.2845000, -0.98384374, -0.0267521216, -0.045743704] sa3 - sc3[1]; [0.2760000, 0.02041568, -0.03764924683, 0.077961151] sa4 - sc4[1]; [-0.5530000, 0.11720885, -0.0042689891, -0.053196933] #The kth moment values evaluated by SimuCount and StatAnal(GFvp) for each p are very, very close!