To answer this question presenting your data in a new

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

To answer this question, presenting your data in a new visualization called a tree diagram is the best thing to do.Today we've filled in this tree for you, but connect it back to the pivot table you made above.Hint:The variable names followed by...have hard statistical definitions. If you are wondering how thesedefinitions help you calculate the answer to our question, the first cell in this notebook links you to the relevanttextbook section.4. Sampling Basketball DataWe will now introduce the topic of sampling, which we’ll be discussing in more depth in this week’s lectures.We’ll guide you through this code, but if you wish to read more about different kinds of samples beforeIn [68]:all_combos=...all_combosIn [ ]:ok.grade("q31");In [71]:declared_given_second=...In [ ]:ok.grade("q32");In [74]:prob_of_third_year=...likelihood_declared_given_third=...total_probability_declared=...# Just run this line, it was defined for you.# If you're interested, we came up with this equation using Bayes' Rule.prob_third_given_declared=(prob_of_third_year*likelihood_declared_given_third)\/total_probability_declaredIn [ ]:ok.grade("q33");
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.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 11 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Fall
Professor
N/A
Tags
Pride and Prejudice, Simple random sample

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture