Chrs Pech Fal Practce CS09 Dec 5, 08 Practce Fal Examato Solutos. Aswer: 4/5 8/7. There are multle ways to obta ths aswer; here are two: The frst commo method s to sum over all ossbltes for the rak of the frst card draw multled by the robablty that the secod card has greater rak, gve the rak of the frst card. The frst card draw ca be of ay of the 3 raks wth equal robablty /3. Let be the rak of the frst card. After the frst card s chose, 5 cards rema, of whch 43 have a rak greater tha. 3 Rak of frst card Rak of secod card > Rak of 3 3 æ ö ç 3 43 4 4 3 3 3 5 35 35 è ø frst card 4 æ ç3 35 è 34 ö ø 4 5 3 7 4 5 8 7 The secod method s to solve ths roblem usg symmetry. After the frst card s draw, there are 5 cards remag. Of those 5 cards there are 48 5 3 that have a rak dfferet rak tha the frst card draw. For a radomly chose rak for the frst card, by symmetry, half of the remag cards 4 48/ wll have a rak hgher tha the frst card, gvg us 4/5.
. a. I order to sell the share of HCI exactly 4 days after buyg t, t meas that the frst two days after buyg t must have cluded oe day of creasg rce deote that as U ad oe day of decreasg rce deoted that by D, the followed by two cosecutve days of creasg or decreasg rce. Thus the ossble outcomes are: Sell o day 4 UDUU DUUU UDDD DUDD 3 3 b. There are two commo ways to comute ths. The frst s to defe a recurrece relato. Namely, the robablty you evetually sell for a ga s the robablty that you ether have two U days a row, or that you have a U day ad a D day so the stock s aga at the startg rce of $0, multled by the robablty that you evetually sell for a ga. Formally, ths ca be wrtte as: sell for $ UU sell for $ ad UD sell for $ ad DU sell for $UD sell for $DU sell for $ sell for $ sell for $ Let sell for $, ad solve for yeldg: / / / / So, sell for $ A secod smler way to comute ths s usg the odds that whe we sell, we are sellg for a ga. Here we essetally gore cacel out ars comosed of a U ad a D before the sale, ad smly focus o whether the two days that determe the sale are Us or Ds. Formally, we have the followg whch mmedately gves us the aswer: sell for $ Us/ Us Ds
3 3. Let A umber of tye W maches o "watch lst" Let B umber of tye maches o "watch lst" Note that A ~ B0, 0. ad B ~ B0, 0.. Thus, we have: E[A] 00. ad E[B] 00. a. Sce A ad W are deedet ad B ad are deedet: E[Y] E[A]E[W] E[B]E[] 4 5 8 0 8 b. We ca defe radom varable C Wa Wb Wc. Notg that all W are deedet, we have that: C ~ Po4 Po4 Po4 Po Here, Y C, so we have: Y ³ 0 C ³ 0 0 e! c. We ca defe radom varable D a b c. Notg that all are deedet, we have that: D ~ N5, 3 N5, 3 N5, 3 N5, 9 Sce the are Normally dstrbuted to beg wth, they are cotuous varables ad so s ther sum. So, comutg a robablty volvg the sum, there s o eed to aroxmate a dscrete quatty usg a cotuty correcto. Here, Y D, so we have: 0 5 Y ³ 0 D ³ 0 D < 0 Z < Z <.67 9 f.67» 0.955 0.0475 Here s what you would have gotte f you had used the cotuty correcto whch ths artcular case, we gave full credt for whe gradg the roblem: 9.5 5 Y ³ 0 D ³ 9.5 D < 9.5 Z < Z <.5 9 f.5» 0.933 0.0668
4 4. Let dcator varable f the th teger geerated s a, ad 0 otherwse. Let dcator varable Y f the th teger geerated s a 5, ad 0 otherwse. Note that ad lkewse Y Y a. Note: E[] /5 ad lkewse E[Y] Y /5. Also ote: E[, Y] 0 wheever, sce a ad 5 caot both be the th teger. Cov, Y E[ Y] E[] E[Y] ì ï í ï î 5 0 whe, sce E[ Y otherwse whe ¹ ] 0 whe, by deedece So, Cov, Y Cov, Y Cov, Y Cov, Y 5 5 b. By defto: r, Y Cov, Y Var Var Y We ote that ~ Ber /5 ad lkewse Y ~ Ber /5 Thus, Var VarY /54/5 4/5 Sce ad all the are deedet: Var Var 4/5 Also, VarY Var 4/5 So, r, Y / 5 4 / 5 / 5 4 / 5 4
5 5. Let the umber of maches we urchase. Let Y the total umber of weeks we use that the th mache urchased utl t des. Note that: We wat to comute a exresso for, such that: Y > 000 > 000 ³ 0.95 Y ù Note that E[] ê é E Y ú E[Y] 00 ë û ù Smlarly, Var. Sce all Y ê é Var Y ú are deedet, we have: ë û ù ê é Var Y ú VarY 5. Thus, Var 5. ë û Now, we aly the Cetral Lmt Theorem: > 000 Y 00 000 00 400 0 > Z > 5 5 Y > 000 We wat to have: 400 0 400 0 400 0 Z > ³ 0.95 Þ Z ³ 0.95 Þ F ³ 0.95 Notg that F C F C, we obta: 0 400 0 400 F ³ 0.95 Þ ³.645, sce F.645» 0.95. Here we wat to determe the mmal value of satsfyg the equalty above. 00 400 Clearly, 0 s too small, sce 0. We cosder, gvg us: 0 0 400 40 400 0 0 0. We kow that 5, so ³ 4 ³. 645, so 5 maches s suffcet to gve us > 000 ³ 0.95.
6 6. Let value retured by Near. E[] So, E[] 0 /4 4 E[6 ] E[8 ] /4 4 6 E[] 8 E[] /40 E[] 5 /E[] E[ ] /4 4 E[6 ] E[8 ] /44 6 36 E[] E[ ] 64 6E[] E[ ] /40 8E[] E[ ] /40 80 E[ ] /4400 E[ ] 00 /E[ ] So, E[ ] 00 00 a. E[Y] So, E[Y] 9 /3 E[ ] E[4 Y] /3 E[] 4 E[Y] /38 E[] E[Y] /38 0 E[Y] 8/3 /3E[Y] b. E[Y ] /3 E[ ] E[4 Y ] /34 4 4E[] E[ ] 6 8E[Y] E[Y ] /34 40 E[ ] 89 E[Y ] /336 00 E[Y ] /3336 E[Y ] So, E[Y ] 336/ 68 VarY E[Y ] E[Y] 68 9 68 8 87
7 7. a. 0 /4 6/64 3 3/4/4 3/8 6/6 4/64 4 3/4/43/4 9/3 8/64 5 3/4/4/4 3/3 6/64 b. E[] 0 6/64 34/64 48/64 56/64 38/64 03/3 c. I the geeral case:, sce we eed to hash strgs wthout ay collsos, ad the get a collso o the last th strg hashed. Note that the roduct above could be wrtte wth ether a or as the to dex. Ether form s equvalet, sce the form wth as the to dex ust does a extra multlcato of the roduct by /. Usg the defto of exectato, we have: 5 P P or ø ö ç ç è æ Õ Õ ø ö ç ç è æ or ] [ P E!!
8 8. a. The mass fucto for the Geometrc dstrbuto wth gve arameter s, where 0. The lkelhood fucto to maxmze s: So, the loglkelhood fucto to maxmze s: Takg the dervatve of LL w.r.t., ad settg t to 0, yelds: Solvg for gves us: b. We have: f Õ L LL ] log [log 0 ] [ LL Þ MLE Þ ú û ù ê ë é 4 0 5 0 5 MLE
9 9. a. The lkelhood fucto s the robablty mass fucto of a Beroull wth robablty : b. Usg cha rule: Lkelhood S S Log Lkelhood S log S log @LL @a @LL @ @ @a Just lke a dee learg etwork: @ S S @a c. Usg cha rule: Starg wth the equato for @ @ a d @a @a You ca otoally reduce your equatos further. If you substtute ad cacel you wll get that: @ S @a @LL @d @LL @ @ @d Ths art s the same: @ S S @a Startg wth the equato for : @ @ a d @d @d You ca otoally reduce your equatos further. If you substtute ad cacel you wll get that: @ S @d
0 d. Use ca estmate the value of all arameters usg gradet ascet. Gradet ascet reeatedly takes a ste alog the gradet wth a fxed ste sze. Just lke whe we mlemeted logstc regresso, we ca rogram our closed form mathematcal soluto for gradets to effcetly calculate the gradet for ay values of our arameters.