• 11
• 57% (7) 4 out of 7 people found this document helpful

This preview shows page 7 - 9 out of 11 pages.

attempting this question, you can check outsection 10 of the textbook.Run the cell below to load player and salary data that we will use for our sampling.Rather than getting data on every player (as in the tables loaded above), imagine that we had gotten data ononly a smaller subset of the players. For 492 players, it's not so unreasonable to expect to see all the data, butusually we aren't so lucky.If we want to make estimates about a certain numerical property of the population (known as a statistic, e.g. themean or median), we may have to come up with these estimates based only on a smaller sample. Whetherthese estimates are useful or not often depends on how the sample was gathered. We have prepared someexample sample datasets to see how they compare to the full NBA dataset. Later we'll ask you to create yourown samples to see how they behave.To save typing and increase the clarity of your code, we will package the analysis code into a few functions. Thiswill be useful in the rest of the lab as we will repeatedly need to create histograms and collect summarystatistics from that data.We've defined thehistogramsfunction below, which takes a table with columnsAgeandSalaryanddraws a histogram for each one. It uses bin widths of 1 year forAgeand \$1,000,000 forSalary.Question 4.1. Create a function calledcompute_statisticsthat takes a table containing ages andsalaries and:Draws a histogram of agesDraws a histogram of salariesReturns a two-element array containing the average age and average salary (in that order)You can call thehistogramsfunction to draw the histograms!Note:More charts will be displayed when running the test cell. Please feel free to ignore the charts.

Course Hero member to access this document

Course Hero member to access this document

End of preview. Want to read all 11 pages?