This preview shows pages 1–3. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 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 Rfunction 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%. (f) Increase the sample size (g) 62.74% (R commander: Statistics–Summaries–active data set)(g) 62....
View
Full
Document
This note was uploaded on 01/17/2012 for the course STAT 100 taught by Professor drake during the Fall '10 term at UC Davis.
 Fall '10
 DRAKE

Click to edit the document details