{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Homework_02_Solutions

# Homework_02_Solutions - 1 Simple Random Samples(a Step 1...

This preview shows pages 1–3. Sign up to view the full content.

1. Simple Random Samples (a) Step 1: give each pet an identification number, i.e. 1, 2, ..., 1000. Step 2: choose a random sample of 10 numbers from these 1000 numbers. Step 3: pick those pets with the id numbers that correspond to Step 2. (b) Use R code: > mysample <- sample(1:10000,10) > mysample [1] 3539 4789 9286 7808 7219 8911 5620 8184 9627 4058 > obesity[mysample, 4] # or obesity[mysample, ’name’] [1] Nicole I. Lacey S. Jamie O. Jamie X. Ana J. Jamie C. [7] Cara O. Valerie U. Jon Q. Julian I. Note: obesity is the name for the data set; variable name is the 4th column of the data set so obesity[mysample, 4] is to choose those entries of specified rows and the 4th column. (c) > obesity[mysample, 5] # or: obesity[mysample, ’obese’] ) [1] YES YES YES YES YES NO YES YES YES NO The percentage of obesity for this sample=8/10=80%. We could also use the R-function table() : > table(obesity[mysample, 5]) (d) the population percentage of obesity is estimated to be 80%. (e) It is not accurate due to a small sample size so the variability of the estimate is large. (though it is a random sample). (Later we will learn that the sample size affects the ‘accuracy’ of the estimates. . . ). Try another sample: > mysample2 <- sample(1:10000,10) > mysample2 [1] 2779 9359 9103 7160 1684 7024 2201 6633 2855 1405 > obesity[mysample2, 5] [1] YES NO NO NO YES NO YES YES NO YES in this case, the sample percentage=5/10=50%.

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
(f) Increase the sample size (g) 62.74% (R commander: Statistics–Summaries–active data set)
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern