boxes<-c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,9,12,4,5,12,8,4,4,16,4,5,10,4,5,4,10,16,16,8,6,4,5,9,10,3,12,4,10,12,10,6,16,16,8,4,5,18,4,3,9,12,16,3,6,8,4,2,5,18,4,12,4,12,8,3,16,5,9,6,10,3,18,8,10,16,6,15,8,4,18,10,4,2,5,8,16,6,9,12,4,9,18,8,8,8)
The Questions in This Section Use r.
1) Here is some neat code:
samplebox<-c()
for(i in 1:1000){samplebox<-c(samplebox,mean(sample(boxes,10)))}
what this does is create a list and inside that list will be place the average of 1000 different samples from our boxes. These are samples of 10 (as shown from the ten at the end of the equation).
a) create a histogram, get the summary, and describe this data.
try:
hist(samplebox)
b) create a new set of 1000 means from the sample of 10. Repeat a) with this. MAKE SURE TO CREATE A NEW LIST HERE. THIS WILL BE TRICKY (or at least has a high probability of being so). CALL ME OVER.
c) create a set of 1000 means from sample size 20. Repeat a) with this.
d) create a set of 1000 means from a sample size 5. Repeat a) with this.
e) compare the summaries and histograms for each of these different groups. What generalizations can you make about these samples? What similarities and differences are there?
f) EXTRA CREDIT. make a graph that shows all three distributions on one graph.
2)
coinflip<-c()
for(i in 1:10){coinflip<-c(coinflip,mean(sample(0:1,1)))}
a) look at the code above. think about it and try to explain to me what it does (hint: you might call up the information it stores and see what it is. also consider what I called things). ONCE THIS SECTION IS DONE CALL ME OVER SO WE CAN TALK ABOUT IT.
b) use the code:
mean(coinflip)
what information does this give you? If you were to extract this information and explain it to others, what would you say?
c) Say you wanted to flip a coin 1000 times and figure out the percentages of heads. What would you do in r?
d) EXTRA CREDIT Say you wanted to flip 1000 coins 1000 times and record the percentages. What would you type into r?
The questions in this section do not use r. They are not extra credit.
3.84
3.110
3.114
3.126
3.135
3.136