* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project
Download Assignment Instructions for the Distribution of Sample Means.
Survey
Document related concepts
Transcript
Math 15 March 30, 2017 Distribution of Sample Means Name: Instructions. Use an R Markdown file to perform each of the tasks in this activity. The expected end result should be in essay form, with paragraphs of prose introducing the goal at the beginning of the activity, followed by intermittent paragraphs of prose explaining the code, and final paragraphs of prose describing the conclusions learned from the activity. 1. Use the following R commands to generate 500 random numbers from the Chi-squared distribution. x = rchisq(500,1) The theoretical mean and standard deviation of this Chi-squared distribution are √ µ=1 and σ = 2, and you can find approximations (remember, you are taking a random sample) for your distribution using the following commands: mean(x) sd(x) Create a histogram of the data stored in the variable X, then use proper statistical vocabulary to describe the shape of this Chi-squared distribution. 2. You can select n = 5 random numbers from this distribution and determine the mean of this sample with the following commands. n = 5 x = rchisq(n,1) mean(x) You can now replicate this action 500 times, creating a set of 500 sample means. The following command will let you view the resulting 500 sample means. replicate(500,mean(rchisq(n,1))) However, this will waste paper in your report, so after viewing the 500 sample means, remove this command from your RMarkdown file. Next, repeat the replication, this time storing the result in the variable xbar5. n = 5 xbar5 = replicate(500,mean(rchisq(n,1))) Calculate the mean and sample deviation, rounding both answers to the nearest hundredth (2 decimal places). mu5 = round(mean(xbar5),2) sd5 = round(sd(xbar5),2) Create a histogram of the sample means, including a title with the mean and sample deviation. hist(xbar5, prob=TRUE, breaks=12, xlim=c(0,6), main=paste("Mean = ", mu5, ", Sample Deviation = ", sd5)) Math 15/Distribution of Sample Means – Page 2 of 2 – Name: 3. Repeat the activity of exercise #2 five more times, drawing samples of size n = 10, 20, 30, 40, and 50, storing the results in the variables xbar10, xbar20, xbar30, xbar40, and xbar50, then creating a histogram of each collection, including a title containing the mean and sample deviation. Arrange the six histograms for xbar5, xbar10, xbar20, xbar30, xbar40, and xbar50 in one plot, beginning with the command par(mfrow=c(3,2)). Note that all the code used to produce the six histograms must be inserted in a a single chunk. Don’t forget to end your chunk with the command par(mfrow=c(1,1)) so your graphing window is returned to its default use. Use the options prob=TRUE, breaks=12, and xlim=c(0,6) in each histogram command so that you can compare the distributions based on equal scales on the horizontal axis. 4. Write several paragraphs describing what you have learned in this activity. Be sure to address each of the following issues. • Describe the shape of the distribution for X, the original Chi-squared distribution. Include its mean and standard deviation in your description. • Describe what happens to the shape of the distributions of xbar5, xbar10, xbar20, xbar30, xbar40, and xbar50 (distributions of sample means of Chi-squared distribution) as the sample size n increases. • What appears to be the mean of each of the distributions of sample means? That is, what appears to be the mean of each of the distributions for xbar5, xbar10, xbar20, xbar30, xbar40, and xbar50 ? How does it relate to the mean of the parent distribution X, the original Chi-squared distribution? • Describe what happens to the sample deviations of the distribution of sample means as n increases. That is, what appears to happen to the sample deviation of each of the distributions for xbar5, xbar10, xbar20, xbar30, xbar40, and xbar50 as n increases?