Lab 4 The Central Limit Theorem and A Monte Carlo Simulation
Experiment 1. The Central Limit Theorem
The Central Limit Theorem says that the sampling distribution of means, of samples of size n
from a population with a mean of ? and a standard deviation of ?, is approximately a normal
distribution with mean ?? ?X and standard deviation n
X
? ? ? , if sample size 30n ? .
Please start R, then open a new script file File ? New script and save it as Lab4_tutorial by going to File ? Save As and saving it to your M or One Drive. Note: You will need all the graphs from this tutorial for the Lab Assignment at the end. Please make sure you save them as you go.
We consider a population that has an exponential distribution with parameter 1.0??
(therefore, 10?? and 10?? ). This distribution is very much skewed to the right. In this experiment, we will demonstrate the Central Limit Theorem by showing that the sampling distribution of sample means, of samples from this exponential population, approaches a
normal distribution with mean of 10????X and standard deviation of nn
X
10 ??
? ? , as
sample size n gets sufficiently large.
1. Generate samples from the population with an Exponential Distribution (?= 0.1)
Simulate 100 random values from the Exponential Distribution (?= 0.1) for each of 60 columns as follows: #Start by defining a matrix of all zeros and specify the number of rows
#with nrow and number of columns with ncol.
#Label the columns using the dimnames function which takes a list
#list(rownames, columnnames)
samples<-matrix(0,nrow=100,ncol=60, dimnames=list(NULL, paste("Sample", 1:60, sep=" "))) #use a for loop to fill each of the columns of the matrix with a random #sample of 100 values from a Exp(0.1) distn for (i in 1:60){ samples[,i]<-rexp(100,0.1) } 2 2. Explore the population distribution by examining the distribution of a random sample: We can examine a distribution of data set by displaying its mean and standard deviation. The following is a mean and standard deviation of a random sample of size 100 (Sample 1) from the population with Exponential distribution (? = 0.1). #Subset the first column from the matrix and call it sample1R script file to write the progess and use word file to write the answer only 3 questions
Recent Comments