## Description

## EE381 Project 1 Random Number Experiments

The objective of this project is to first understand the Python “histogram” function and

duplicate the results of the example of generating a histogram (“stem” plot as shown) of

the probability of the sum of two dice for a user definable number of rolls. The second

objective is to submit the four problems at the end of this handout.

First consider the following two programs, which determining the number of heads and

tails after flipping a coin 10000 times. Both programs provide the same results, but they

differ in the way the models are coded.

• The first model is programmed in Python using “for loops”.

• The second model makes use of the arrays, and it is computationally more

efficient.

MODEL 1 MODEL 2

import random

total_flips=10000

heads=0

tails=0

for i in range(total_flips):

coin=round(random.random())

if coin==0:

heads=heads+1

else:

tails=tails+1

print(“number of heads: ” ,heads, “.”)

print(“number of tails: ” ,tails, “.”)

import numpy as np

import random

total_flips=10000

heads=np.zeros((total_flips,1))

for i in range(total_flips):

heads[i,:]=round(random.random())

print(“number of heads: “,sum(sum(heads)))

print(“number of tails: “,sum(total_flips-sum(heads)))

Next, experiment with the “histogram” function by making modifications to the simple

program listing below; noting the different outcomes when defining the bin limits

differently.

import matplotlib.pyplot as plt

import numpy as np

import random

N = 50000

x=np.zeros((N,1))

for i in range(N):

x[i,:] = random.random()

bins = np.arange(-1, 1, 0.1)

#or bins = np.arange(-0.95, 0.95, 0.1)

plt.hist(x, bins)

plt.show()

Now, let experiment the roll of a pair of fair dice. This experiment models the roll of a pair of dice

for N times. The sum of each roll is recorded, and stored in vector “s”. The probability of each

possible outcome is calculated and plotted in a “probability Mass Function” (PMF) plot. To create

the plots, the simulation has been run for N=100000 times.

import numpy as np

import matplotlib.pyplot as plt

import random

#

N=100000

d1=np.zeros((N, 1))

d2=np.zeros((N, 1))

for i in range(N):

d1[i,:]=random.randint(1, 6)

for i in range(N):

d2[i,:]=random.randint(1, 6)

s=d1+d2

b=range(1,15) ; sb=np.size(b)

h1, bin_edges = np.histogram(s,bins=b)

b1=bin_edges[0:sb-1]

#

fig1=plt.figure(1)

plt.stem(b1,h1)

plt.title(‘Stem plot – Sum of two dice’)

plt.xlabel(‘Sum of two dice’)

plt.ylabel(‘Number of occurrences’)

fig1.savefig(‘Sum of two dice.jpg’)

#

fig2=plt.figure(2)

p1=h1/N

plt.stem(b1,p1)

plt.title(‘Stem plot – Sum of two dice: Probability mass function’)

plt.xlabel(‘Sum of two dice’)

plt.ylabel(‘Probability’)

fig2.savefig(‘PMF of sum of two dice.jpg’)

Finally, turn in the required graphical or numerical results for simulation problems

1) through 4).

1) Generate a probability histogram of the number of rolls required of two dice

before a sum of “7” appears (graphical answer followed by Python code). Note:

Don’t plot experiment that took more than 60 rolls.

2) Generate an unfair six-sided die. The die has sixe sides [1, 2, 3, 4, 5, 6] with

probabilities: [𝑝1, 𝑝2, 𝑝3, 𝑝4, 𝑝5, 𝑝6

] = [0.1, 0.15. 0.3, 0.25, 0.05, 0.15]. Simulating

the roll of the die for N = 10,000 times, and plot the PMF of your unfair die as

stem plot.

The stem plot should verify that the six sides of your unfair die follow the

required probabilities.

3) When 100 coins are tossed find the probability that exactly 35 will be heads

(numerical answer followed by Python code), assuming the number of

experiments is 100000.

4) Determine the probability of “4 of a kind” in a 6-card poker draw (numerical

answer followed by Python code).

## EE380 Project 2 Binomial Coefficient

Question 1)

A certain population consists of N=1000 people. 500 of them support party A; 300 of them

support party B; and 200 support party C. A group of 4 people is chosen at random from the

population. What is the probability that all persons in the group support

a) party A

b) party B

c) party C

Question 2)

A class of 4n children contains 2n boys and 2n girl. A group of 2n children is chosen at random.

What is the probability that the group contains an equal number of boys and girls?

For:

a) n=10

b) n=50

Question 3)

In a lottery game, the player picks 4 numbers from a sequence of 1 through 20. At lottery

drawing, 4 balls are drawn at random from a box containing 20 balls numbered 1 through 20.

What is the probability that the player will win the lottery (i.e. getting 4 matches in any order)?

## EE380 Project 3 Uniform Distribution

Question 1)

Perhaps one of the most important distribution is the uniform distribution for continuos random

variable. The uniform (0, 1) distribution is used as the basis for simulating most random variables.

A random variable that is uniformly distributed over the interval (a, b) follows the probability density

function (pdf) given by:

𝑓(𝑥; 𝑎, 𝑏) =

1

𝑏−𝑎

; 𝑎 < 𝑥 < 𝑏 (1)

The cumulative distribution function (cdf) for a uniform random variable is:

𝐹(𝑥) = {

0 𝑥 ≤ 𝑎

𝑥−𝑎

𝑏−𝑎

𝑎 < 𝑥 < 𝑏

1 𝑥 ≥ 𝑏

(2)

The uniform probability density function and cumulative distribution function over interval (a, b) can be

defined using function stats.uniform.pdf and stats.uniform.cdf in Python (Scipy package), respectively.

a) Now with (a, b) = (1, 10), write a Python code to compute pdf and cdf using equation (1) & (2),

then plot them using subplot function.

b) Repeat question (a) using stats.uniform.pdf and stats.uniform.cdf functions. Then compare

plots from (a) and (b).

(Defining the domain x over which you will evaluate the function by yourself)

Question 2)

Three points #1, #2, and #3 are selected at random from the circumference of a circle (see figure). Write

Python code to find the probability that the three points lie on the same semicircle.

Notice: The solution for each answer should be the Python code, followed by the plots. Answer which

has no Python code will not get any credit.

## EE381 Project 4 Normal (Gaussian) Distribution

Question 1) Normal Distribution

We say x is a normal or Gaussian random variable with parameter 𝜇 and 𝜎

2

if its density

function is given by:

𝑓(𝑥; 𝜇, 𝜎

2

) =

1

√2𝜋𝜎

2

𝑒

−(𝑥−𝜇)

2/2𝜎

2

and its distribution function is given by:

𝐹(𝑥; 𝜇, 𝜎

2

) = ∫ 𝑓(𝑦; 𝜇, 𝜎

2

)𝑑𝑦

𝑥

−∞

We can express 𝐹(𝑥; 𝜇, 𝜎

2

) in term of the error function (erf) as follows:

𝐹(𝑥; 𝜇, 𝜎

2

) =

1

2

erf (

𝑥 − 𝜇

√2𝜎

2

) +

1

2

The probability density function (pdf) and cumulative distribution function (cdf) of normal

distribution can also be calculated using two built-in functions norm.pdf and norm.cdf from the

scipy.stats package in Python.

a) Write two Python function on your own based on above equations, one for calculating

normal pdf and one for calculating normal cdf. (treating 𝑥, 𝜇, 𝜎

2

as inputs of the

functions)

b) With x=[-6, 6], calculate the pdf and cdf using the functions you wrote above, and plot

them for the following pairs of (𝜇, 𝜎

2

): (0, 1), (0,10−1

), (0, 10−2

), (-3, 1), (-3, 10−1

), (-3,

10−2

). (Please plot them in two figures: one contains all the pdf curves, and one

contains all the cdf curves)

c) What can you observe about the affect of 𝜇 𝑎𝑛𝑑 𝜎

2 on normal pdf and cdf curves?

Question 2) Central Limit Theorem

Assuming 𝑋1,𝑋2, … , 𝑋𝑛 are independent random variables having the same probability

distribution with mean 𝜇 and standard deviation 𝜎, consider the sum 𝑆𝑛 = 𝑋1 + 𝑋2 + ⋯ + 𝑋𝑛.

This sum 𝑆𝑛 is a random variable with mean 𝜇𝑆𝑛 = 𝑛𝜇 and standard deviation 𝜎𝑆𝑛 = 𝜎√𝑛.

The Central Limit Theorem states that as the probability distribution of the random variable 𝑆𝑛

will approach a normal distribution with mean 𝜇𝑆𝑛

and standard deviation 𝜎𝑆𝑛

, regardless of the

original distribution of the random variables 𝑋1,𝑋2, … , 𝑋𝑛.

It is noted that the PDF of the normally distributed random variable 𝑆𝑛 is given by:

𝑓(𝑆𝑛

) =

1

𝜎𝑆𝑛√2𝜋

𝑒

−

(𝑥−𝜇𝑆𝑛

)

2

2𝜎𝑆𝑛

2

This problem will help you get more understanding about the Central Limit Theorem. After

plotting the required plots, you can see that even if the individual distributions of a RV do not

look anything like Gaussian, when you add enough of the identical RVs together, the result is a

Gaussian with a mean equal to the sum of the individual means of the RVs, and a standard

deviation equal to the square root of the sum times the individual RV’s standard deviation.

Below is the question:

Consider a collection of books, each of which has thickness W. The thickness W is a random

variable, uniformly distributed between a minimum of a=1 and a maximum of b=3 cm. use the

values of a and b that were provided to you, and calculate the mean and standard deviation of

the thickness.

Use the following table to report the results:

Mean thickness of a single book (cm) Standard deviation of thickness (cm)

𝜇𝑊 = 𝜎𝑊 =

The books are piled in stacks of n=1, 5, 10, or 15 books. The width 𝑆𝑛 of a stack of n books is a

random variable (the sum of the widths of the n books). This random variable has a mean 𝜇𝑆𝑛 =

𝑛𝜇 and a standard deviation of 𝜎𝑆𝑛 = 𝜎√𝑛.

Calculate the mean and standard deviation of the stacked books, for the different values of n=1,

5, 10, or 15. Use the following table to report the results:

Number of books n Mean thickness of a stack of

n books (cm)

Standard deviation of the

thickness for n books

n=1 𝜇𝑆𝑛

= 𝜎𝑆𝑛

=

n=5 𝜇𝑆𝑛

= 𝜎𝑆𝑛

=

n=15 𝜇𝑆𝑛

= 𝜎𝑆𝑛

=

Perform the following simulation experiments, and plot the results.

a) Make n=1 and run N=10,000 experiments, simulating the random variable 𝑆 = 𝑊1.

b) After the N experiments are completed, create and plot a probability histogram of the

random variable S.

c) On the same figure, plot the normal distribution probability function f(x), and compare

the probability histogram with the plot of f(x)

𝑓(𝑆𝑛

) =

1

𝜎𝑆𝑛√2𝜋

𝑒

−

(𝑥−𝜇𝑆𝑛

)

2

2𝜎𝑆𝑛

2

d) Make n=5 and repeat steps (a)-(c)

e) Make n=15 and repeat steps (a)-(c)

Notice: For question 2, you need to submit:

The above tables

The histogram for n={1,5,15} and the overlapping normal probability distribution plots.

Make sure that the graphs are properly labeled.

An example of creating the PDF graph for n=2 is shown below. The code below provides a

suggestion on how to generate a bar graph for a continuous random variable X, which

represents the total bookwidth for n=2, a=1, b=3.

Note that the value of ”barwidth” is adjusted as the number of bins changes, to

provide a clear and understandable bar graph.

Also note that the ”density=True” parameter is needed to ensure that the total area of the

bargraph is equal to 1.0.

import numpy as np

import matplotlib

import matplotlib.pyplot as plt

# Generate the values of the RV X

N=100000; nbooks=2; a=1; b=3;

mu_x=(a+b)/2 ; sig_x=np.sqrt((b-a)**2/12)

X=np.zeros((N,1))

for k in range(0,N):

x=np.random.uniform(a,b,nbooks)

w=np.sum(x)

X[k]=w

# Create bins and histogram

nbins=30; # Number of bins

edgecolor=’w’; # Color separating bars in the bargraph

#

bins=[float(x) for x in np.linspace(nbooks*a, nbooks*b,nbins+1)]

h1, bin_edges = np.histogram(X,bins,density=True)

# Define points on the horizontal axis

be1=bin_edges[0:np.size(bin_edges)-1]

be2=bin_edges[1:np.size(bin_edges)]

b1=(be1+be2)/2

barwidth=b1[1]-b1[0] # Width of bars in the bargraph

plt.close(‘all’)

# PLOT THE BAR GRAPH

fig1=plt.figure(1)

plt.bar(b1,h1, width=barwidth, edgecolor=edgecolor)

#PLOT THE GAUSSIAN FUNCTION

def gaussian(mu,sig,z):

f=np.exp(-(z-mu)**2/(2*sig**2))/(sig*np.sqrt(2*np.pi))

return f

f=gaussian(mu_x*nbooks,sig_x*np.sqrt(nbooks),b1)

plt.plot(b1,f,’r’)

plt.show()

Question 3) Distribution of the sum of exponential random variables

This problem involves a battery-operated critical medical monitor. The lifetime (T) of the battery is a

random variable with an exponentially distributed lifetime. A battery lasts an average of 𝛽 = 45 𝑑𝑎𝑦𝑠.

Under these conditions, the PDF of the battery lifetime is given by:

The mean and variance of the random variable T are:

𝜇𝑇 = 𝛽 𝜎𝑇 = 𝛽

When a battery fails it is replaced immediately by a new one. Batteries are purchased in a carton of 24.

The objective is to simulate the RV representing the lifetime of a carton of 24 batteries, and create a

histogram. To do this, follow the steps below.

a) Create a vector of 24 elements that represents a carton. Each one of the 24 elements

in the vector is an exponentially distributed random variable (T) as shown above,

with mean lifetime equal to β. Use the same procedure as in the previous problem to

generate the exponentially distributed random variable T.

Use the Python function “numpy.random.exponential(beta,n)” to generate n values

of the random variable T with exponential probability distribution. Its mean and

variance are given by:

b) The sum of the elements of this vector is a random variable (C), representing the life

of the carton, i.e.

𝐶 = 𝑇1 + 𝑇2 + ⋯ + 𝑇24

where 𝑇𝑗

, j=1,2,…,24 each is an exponentially distributed random variable. Create the

random variable C, i.e simulate one carton of batteries. This is considered one experiment.

c) Repeat this experiment for a total of N=10,000 times, i.e. for N cartons. Use the

values from the N=10,000 experiments to create the experimental PDF of the

lifetime of a carton, f(c).

d) According to the Central Limit Theorem the PDF for one carton of 24 batteries can

be approximated by a normal distribution with mean and standard deviation given

by:

Plot the graph of normal distribution with mean 𝜇𝐶 and standard deviation 𝜎𝐶 over plot of

the experimental PDF on the same figure, and compare the results.

e) Create and plot the CDF of the lifetime of a carton, F(c) . To do this use the Python

“numpy.cumsum” function on the values you calculated for the experimental PDF.

Since the CDF is the integral of the PDF, you must multiply the PDF values by the

barwidth to calculate the areas, i.e. the integral of the PDF.

If your code is correct the CDF should be a nondecreasing graph, starting at 0.0 and

ending at 1.0.

Answer the following questions:

1. Find the probability that the carton will last longer than three years, i.e. 𝑃(𝑆 > 3 ∗ 365) =

1 − 𝑃(𝑆 ≤ 3 ∗ 365) = 1 − 𝐹(1095). Use the graph of the CDF F(t) to estimate this

probability.

2. Find the probability that the carton will last between 2.0 and 2.5 years (i.e between 730 and

912 days): 𝑃(730 < 𝑆 < 912) = 𝐹(912) − 𝐹(730) .Use the graph of the CDF F(t) to

estimate this probability.

## EE381 Project 5 Confidence Intervals

## I. Introduction and Background Material

Sample size and confidence intervals

Assume that you are measuring a statistic in a large population of size N. The statistic has mean

𝜇 and standard deviation 𝜎.

Drawing a sample of size n from the population, produces a

distribution for the sample mean (𝑋̅) with:

In this project we will explore the relation of 𝑋̅ to the population mean 𝜇.

• As a first example consider a barrel of a million ball bearings (i.e. population size

N=1,000,000 ) where someone has actually weighed all one million of them and found

the exact mean to be 𝜇 = 100 grams and the exact standard deviation to be 𝜎 = 12

grams. This is obviously an unrealistic assumption, but assume for the time being that

these parameters have been measured exactly.

• Now pick a sample of size n (for example n=5 ) of bearings from the barrel, weigh them

and find the mean of the sample, 𝑋̅ =

𝑋1+𝑋2+𝑋3+𝑋4+𝑋5

5

• Next take a larger sample (for example n=10 ) and find the new mean

• Continue this process for larger and larger n, until n=100.

• Plot the points (𝑛, 𝑋̅

𝑛) using a point marker (for example a blue ‘x’) as shown in Figure

1.

• Next for each value of n, calculate the standard deviation of the sample from 𝜎𝑋̅𝑛 =

𝜎

√𝑛

and plot:

i. The values of 𝜇 ± 1.96 𝜎

√𝑛

as a function of n, shown as the red curves in Figure

1a. These curves define the 95% confidence interval, which means that

approximately 95% of the sample means will fall within the two red curves in

Figure 1a. This can also be visually confirmed by looking at how many of the

sample means fall outside of the red curves (approx. 5%).

ii. The values of 𝜇 ± 2.58 𝜎

√𝑛

as a function of n, shown as the red curves in Figure

1b. These curves define the 99% confidence interval, which means that

approximately 99% of the sample means will fall within the two green curves in

Figure 1b.

Figure 1: Sample mean as a function of the sample size

Using the sample mean to estimate the population mean

In reference to the previous section, it is obviously unrealistic to think that anyone actually

measured the exact mean and standard deviation of all one million ball bearings. More

realistically, you would not have any idea what the mean or standard deviation was, and you

would need to weigh random samples of different sizes (for example n=5, 35, or 100 bearings)

and then draw reasonable conclusions about the weight distribution of all one million bearings.

To simulate this problem, generate a barrel of a million ball bearings with weights normally

distributed, with a mean μ and a standard deviation σ.

As an example, take a sample of n bearings from the population of N=1,000,000. Then calculate

the mean of the sample:

The standard deviation of the sample mean can be calculated by:

The question is: Can the value of 𝑋̅, which is calculated for a sample of size n , be used to

estimate the mean μ of the population of N=1,000,000 bearings?

The answer is given in terms of confidence intervals, typically the 95% and 99% confidence

intervals.

Large samples (𝒏 ≥ 𝟑𝟎)

Consider the standardized variable 𝑧 =

𝑋̅−μ

𝜎𝑛

. Based on the Central Limit Theorem, it is known

that for large samples the standardized variable will approach the normal distribution.

The 95% confidence interval for large samples. The 95% confidence interval is determined by

the critical values [−𝑧𝑐

, 𝑧𝑐

] such that

From the tables of the normal distribution it is seen that these critical values correspond to 𝑧𝑐 =

1.96 and −𝑧𝑐 = −1.96.

Hence:

which is written as

If you define 𝜇𝑙𝑜𝑤𝑒𝑟 = 𝑋̅ − 1.96 𝑆̂

√𝑛

and 𝜇𝑢𝑝𝑝𝑒𝑟 = 𝑋̅ + 1.96 𝑆̂

√𝑛

, then the above equation is written

as:

This equation can be interpreted as follows: Based on a sample of size , we are 95% confident

that the mean μ of the population lies in the interval [𝜇𝑙𝑜𝑤𝑒𝑟, 𝜇𝑢𝑝𝑝𝑒𝑟].

Another way to interpret this statement is:

i. Obtain a large number of different samples, of size n each

ii. For each of these samples calculate 𝑋̅ and 𝜎𝑛 =

𝑆̂

√𝑛

iii. For each of these samples generate the corresponding intervals [𝜇𝑙𝑜𝑤𝑒𝑟, 𝜇𝑢𝑝𝑝𝑒𝑟].

iv. Then the mean μ of the population will be contained in 95% of these intervals.

For example if you obtain 500 samples of size each, and you create the corresponding 500

intervals [𝜇𝑙𝑜𝑤𝑒𝑟, 𝜇𝑢𝑝𝑝𝑒𝑟], then 475 of these intervals (95% of 500) will contain the population

mean μ.

The 99% confidence interval for large samples. Similarly, the 99% confidence interval is

determined by the critical values [−𝑧𝑐

, 𝑧𝑐

] such that

From the tables of the normal distribution it is seen that these critical values correspond to 𝑧𝑐 =

2.58 and −𝑧𝑐 = −2.58.

Hence, if you define: 𝜇𝑙𝑜𝑤𝑒𝑟 = 𝑋̅ − 2.58 𝑆̂

√𝑛

and 𝜇𝑢𝑝𝑝𝑒𝑟 = 𝑋̅ + 2.58 𝑆̂

√𝑛

, then you can write:

Which can be interpreted as follows: Based on a sample of size , we are 99% confident that the

mean μ of the population lies in the interval [𝜇𝑙𝑜𝑤𝑒𝑟, 𝜇𝑢𝑝𝑝𝑒𝑟].

Small sample (n<30)

When the sample size is small, the standardized variable 𝑋̅−μ

𝜎𝑛

does not approach the normal

distribution, since the Central Limit Theorem does not hold for small n.

In this case the standardized variable 𝑇 =

𝑋̅−μ

𝜎𝑛

follows the Student’s t distribution with v=n-1

degrees of freedom.

The 95% confidence interval for small samples. The 95% confidence interval is determined by

the critical values [−𝑡𝑐

,𝑡𝑐

] such that

Note that the critical values [−𝑡𝑐

,𝑡𝑐

] depend on two values: (i) the probability value (0.95) and

(ii) the degrees of freedom (v)

Example: sample size n=5. In that case v=n-1=4 degrees of freedom. For the 95% confidence

interval, the critical value is: 𝑡𝑐 = 𝑡0.975 = 2.78, as seen from the Student’s t distribution tables.

Hence, if you define 𝜇𝑙𝑜𝑤𝑒𝑟 = 𝑋̅ − 2.78 𝑆̂

√𝑛

and 𝜇𝑢𝑝𝑝𝑒𝑟 = 𝑋̅ + 2.78 𝑆̂

√𝑛

, then the above equation is

written as:

which can be interpreted as follows: Based on a sample of size , we are 95% confident that the

mean μ of the population lies in the interval [𝜇𝑙𝑜𝑤𝑒𝑟, 𝜇𝑢𝑝𝑝𝑒𝑟].

The 99% confidence interval for large samples. Similarly, the 99% confidence interval is

determined by the critical values [−𝑡𝑐

,𝑡𝑐

] such that

Example: sample size n=5. In that case v=n-1=4 degrees of freedom. For the 99% confidence

interval, the critical value is: 𝑡𝑐 = 𝑡0.995 = 4.60, as seen from the Student’s t distribution tables.

Hence, if you define 𝜇𝑙𝑜𝑤𝑒𝑟 = 𝑋̅ − 4.60 𝑆̂

√𝑛

and 𝜇𝑢𝑝𝑝𝑒𝑟 = 𝑋̅ + 4.60 𝑆̂

√𝑛

, then the above equation is

written as:

which can be interpreted as follows: Based on a sample of size , we are 99% confident that the

mean μ of the population lies in the interval [𝜇𝑙𝑜𝑤𝑒𝑟, 𝜇𝑢𝑝𝑝𝑒𝑟].

II. Questions for Lab 5:

1) Create two plots as in Figure 1a and Figure 1b, showing the effect on sample size on the

confidence intervals.

• Use the following parameters:

• Total number of bearings: N=1,000,000

• Population mean: 100 grams

• Population standard deviation: 12 grams

• Sample sizes: n=1, 2, 3, 4,…,200

2) Part A

Perform the following simulation experiment. Use Table 1 below to tabulate the results.

Table 1: Success rate (percentage) for different sample sizes

i. Step 1: Choose a random sample of n=5 bearings from the N bearings you created

in the previous problem. Calculate the sample mean and the sample standard

deviation:

ii. Step 2: Create the 95% confidence interval using the normal distribution to fill in

the first two entries in the top row. You realize, however, that this is not an

appropriate distribution to use because you have a small sample n=5<30.

iii. Step 3: Check if the confidence interval includes the actual mean μ of the

population of N bearings. If it does, then Step 2 is considered a success.

iv. Step 4: The appropriate distribution for small samples (n<30) is the t-distribution.

Create the 95% confidence interval using the t-distribution with v=n-1=4

At the 95% confidence level with v=4 degrees of freedom, the value of 𝑡0.975 can

be found from the tables, and it is seen to be 𝑡0.975 = 2.78.

This is the value that

will be used to determine the 95% confidence interval:

For a different sample size, the values of will be different than the ones above.

You should find these values from the t-distribution tables, and you should

modify the confidence intervals accordingly.

v. Step 5: Check if the confidence interval includes the actual means μ of the

population. If it does, then Step 4 is considered a success.

vi. Step 6: Repeat the experiment for M=10,000 times and count the number of

successes.

vii. Step 7: Enter the percentage of successful outcomes in Table 1.

viii. Step 8: Repeat steps 1-7 above with n=5 and 99% confidence interval.

ix. Step 9: After completing all of the above steps you have to fill out the first row of

the table.

Part B:

Repeat part (A) with n=40 using the normal distribution and the t-distribution to complete the

second row of the table.

Part C:

Repeat part (A) with n=120 using the normal distribution and the t-distribution to complete the

third row of the table. You realize, however, that for a large sample (n>30) the t-distribution will

be very close to normal, so the differences between Student’s -t and Normal will be minimal.