Not logged in
Talk
Contributions
Create account
Log in
Navigation
Main page
About
People
Publications
Teaching
Resources
Research Blog
Wiki Functions
Recent changes
Help
Licensing
Page
Discussion
Edit
View history
Editing
Statistics and Statistical Programming (Spring 2019)/Problem Set: Week 5
(section)
From CommunityData
Jump to:
navigation
,
search
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
== Programming Challenges == This week we'll work with the full dataset from which I drew the 20 group samples you analyzed in Weeks 2 and 3. : '''PC0.''' The dataset is available as a TSV file in the directory <code>week_05</code> in the [https://communitydata.cc/~ads/teaching/2019/stats/data data repository for the course]. Note that a TSV file is ''tab delimited'', not comma delimited (it is otherwise similar to a CSV file). Go ahead and inspect the data and load it into R (''Hint:'' You'll want to use the <code>read.delim()</code> function). : '''PC1.''' Calculate the mean of the variable <code>x</code> in the full dataset. Go back to your Week 3 problem set and revisit the mean you calculated for <code>x</code>. Be prepared to discuss the ''conceptual'' relationship of these two means to each other. : '''PC2.''' Again, using the variable <code>x</code> from your Week 3 data, compute the 95% confidence interval for the mean of this vector "by hand" (in R) using the normal formula for standard error <math>(\frac{\sigma}{\sqrt{n}})</math>. (''Bonus:'' Do this by writing a function.) <!--- :* (b) Using an appropriate built-in R function (see this week's R lecture materials for a relevant example). :* (c) Bonus: The results from (a) and (b) should be the same or very close. After reading ''OpenIntro'' Β§5, can you explain why they might not be exactly the same? ---> : '''PC3.''' Compare the mean of <code>x</code> from your Week 3 sample β and your confidence interval β to the population mean (the version of <code>x</code> in the Week 5 dataset). Is the true mean inside your confidence interval? Should you find this surprising? Why or why not? Be prepared to discuss the relationship of these values to each other. : '''PC4.''' Let's look beyond the mean. Compare the distribution from your sample of <code>x</code> to the true population of <code>x</code>. Draw histograms and compute other descriptive and summary statistics. What do you notice? Be prepared to discuss and explain any differences. : '''PC5.''' Calculate the conditional mean of <code>x</code> for each of the groups in the population and the standard deviation of this distribution of conditional means. Compare this standard deviation to the standard error of the mean you calculated in PC2 above. Explain the relationship between these values. : '''PC6.''' I want you to run a simple simulation that demonstrates a fundamental insight of statistics. Please see the R lecture materials from Week 4 for ideas about how to do this (but note that there are some differences between that example and this programming challenge). :* (a) Create a vector of 10,000 randomly generated numbers that are uniformly distributed between 0 and 9. :* (b) Calculate the mean of that vector. Draw a histogram of the distribution. :* (c) Create 100 random samples of 2 items each from your randomly generated data and take the mean of each sample. Create a new vector that contains those means. Describe/display the distribution of those means. :* (d) Do (c) except make the items 10 items in each sample instead of 2. Then do (c) again except with 100 items. Be ready to describe how the histogram changes as the sample size increases. (''Bonus challenge:'' Write a function to complete this part.) : '''PC7.''' Compare the results from PC6 with those in the example simulation from the Week 4 R lecture materials. What fundamental statistical principle is illustrated by these simulations? Why is this an important simulation for thinking about hypothesis testing?
Summary:
Please note that all contributions to CommunityData are considered to be released under the Attribution-Share Alike 3.0 Unported (see
CommunityData:Copyrights
for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource.
Do not submit copyrighted work without permission!
To protect the wiki against automated edit spam, we kindly ask you to solve the following CAPTCHA:
Cancel
Editing help
(opens in new window)
Tools
What links here
Related changes
Special pages
Page information