Question 2 among games with a spread between 35 and

• Homework Help
• 25
• 90% (252) 228 out of 252 people found this document helpful

This preview shows page 16 - 20 out of 25 pages.

Question 2 Among games with a spread between 3.5 and 6.5 (including both 3.5 and 6.5), what was the average outcome? Hint: Read the documentation for the predicate are.between_or_equal_to here () . ,
11/8/2018 hw10 In : _ = ok . grade( 'q3_2' ) _ = ok . backup() Question 3 If the average outcome for games with any given spread turned out to be exactly equal to that spread, what would the slope and intercept of the linear regression line be, in original units? Hint: If you're stuck, try drawing a picture! ) _ = ok . backup() ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Running tests --------------------------------------------------------------------- Test summary Passed: 1 Failed: 0 [ooooooooook] 100.0% passed Saving notebook... Saved 'hw10.ipynb'. Backup... 100% complete Backup successful for user: [email protected] URL: NOTE: this is only a backup. To submit your assignment, use: python3 ok --submit
17/25 python3 ok --submit
11/8/2018 hw10 18/25 Question 4 Fix the standard_units function below. It should take an array of numbers as its argument and return an array of those numbers in standard units. In : def standard_units (arr): return (arr - np . average(arr)) / np . std(arr) In : def standard_units (nums): """Return an array where every value in nums is converted to standar d units.""" return (nums - np . average(nums)) / np . std(nums) In : _ = ok . grade( 'q3_4' _ = ok . backup() Running tests --------------------------------------------------------------------- Test summary Passed: 1 Failed: 0 [ooooooooook] 100.0% passed Saving notebook... Saved 'hw10.ipynb'. Backup... 100% complete Backup successful for user: [email protected] URL: NOTE: this is only a backup. To submit your assignment, use: ) Question 5 Compute the correlation coeﬃcient between outcomes and spreads. Note: It might be helpful to use the standard_units function. ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Running tests --------------------------------------------------------------------- Test summary Passed: 1 Failed: 0 [ooooooooook] 100.0% passed Saving notebook... Saved 'hw10.ipynb'. Backup... 100% complete Backup successful for user: [email protected] URL: NOTE: this is only a backup. To submit your assignment, use: python3 ok --submit
11/8/2018 hw10 19/25 In : just_outcome = spreads . column( "Outcome" ) just_spread = spreads . column( "Spread" ) outcome_and_spread = Table() . with_column( "Outcome" , just_outcome) . with_c olumn( "Spread" , just_spread) outcome_and_spread In : def correlation (t, x, y): x_standard = standard_units(t . column(x)) y_standard = standard_units(t . column(y)) return np . average(x_standard *
• • • 