On a card putting the cards in an urn and shuffling

This preview shows page 21 - 27 out of 33 pages.

on a card, putting the cards in an urn, and shuffling the urn. Then, pull out cards one by one andset them aside, stopping when the specifiedsample sizeis reached.We’veproducedtwosamplesofthesalary_datatableinthisway:small_srswor_salary.csvandlarge_srswor_salary.csvcontain,respectively,asampleof size 44 (the same as the convenience sample) and a larger sample of size 100.Theload_datafunction below loads a salary table and joins it withplayer_data.
Question 3.6Run the same analyses on the small and large samples that you previously ran onthe full dataset and on the convenience sample. Which is more accurate, the estimate of populationstatistics that we get from the convenience sample, the estimate from the small simple randomsample, or the estimate from the large simple random sample? (Just notice this for yourself -- theautograder will check your sample statistics but will not validate whatever you do to compare.)
21
22
23
In [42]:_=ok.grade('q3_6')~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Running tests---------------------------------------------------------------------Test summaryPassed: 4Failed: 0[ooooooooook] 100.0% passed1.3.3Producing simple random samplesOften it’s useful to take random samples even when we have a larger dataset available. Anotheris to help us understand how inaccurate other samples are.Tables provide the methodsample()for producing random samples.Note that its defaultis to sample with replacement. To see how to callsample(), search the documentation on thedatascience documentationof the course website, or enterfull_data.sample?into a code celland press Shift + Enter.Question 3.7Produce a simple random sample of size 44 fromfull_data. (You don’t needto bother with a join this time -- just usefull_data.sample(...)directly. That will have thesame result as sampling fromsalary_dataand joining withplayer_data.) Run your analysis onit again.- Are your results roughly similar to those in the small sample we provided you? Run your codeseveral times to get new samples.- How much does the average age change across samples? - What about average salary?
Out[43]:array([2.69318182e+01, 4.42913811e+06])24
25
Although the results are similar, they are not the same as the sample we were given.Theaverage age tends to stay around the same value since there is a limited range of ages for NBAplayers, but the salary changes by a significant factor due to larger variability in salary.

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 33 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, Test Summary

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture