This preview shows pages 1–2. 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: data = rnorm(10000, 30, 5) The new function that you'll need to use is the sample() function. This function simply takes a random sample, of a size you specify, from a variable. To take a sample of size 8 from data (we'll label this S1), you'd do this: S1 = sample(data, 8) (a) Take 10 samples of size 8 from data; you can call them S1, S2, and so on. Find the mean of each one, using the mean() command. (E.g., to get the mean of sample1, you'd just type m1 = mean(S1).) Put these means together into a new variable, called sample_means, as follows: sample_means = c(m1, m2, . ...) Finally, make a histogram of sample_means. Show it in your assignment. (b) Do exactly the same thing again, but now use samples of size 25. What's different about your histogram? (c) Do it again with samples of size 8, but now take 25 samples rather than 10. What's different about your histogram? (d) Explain, in words, what general principles are illustrated by problems 1-3....
View Full Document
This note was uploaded on 12/08/2009 for the course PSYCH 240 taught by Professor Harvey during the Spring '08 term at UMass (Amherst).
- Spring '08