Download MathCAD Computer lab 2

Survey
yes no Was this document useful for you?
   Thank you for your participation!

* Your assessment is very important for improving the workof artificial intelligence, which forms the content of this project

Document related concepts

Central limit theorem wikipedia , lookup

Transcript
APPLIED QUANTITATIVE REASONING 601
COMPUTER LAB#2:
The Normal Distribution
We will compute and graph basic statistics.
Perhaps the most important probability distribution function is the normal.
MathCAD provides this function, which it calls dnorm(x,µ,σ) where:
x is the variable whose values are normally distributed;
µ is the population mean;
σ is the population standard deviation.
We graph here the normal distribution function with mean µ=-2 and standard
deviation σ=3, denoted dnorm(x, -2, 3), then two more distributions differing in
mean and standard deviation:
•
•
•
Click on the graph palette. Then click on the X-Y Plot button.
On the x-axis placeholder type x and on the y-axis placeholder type
dnorm(x,-2,3). Then select the whole name of the function by hitting the
spacebar.
Hit , (coma). A new placeholder appears, where you type dnorm (x,0,3).
Repeat this process and type dnorm(x,1,3).
NORMAL DISTRIBUTION DENSITY
dnorm ( x , − 2 , 3)
0.1
dnorm ( x , 0 , 3)
dnorm ( x , 1 , 3)
0.05
10
5
0
5
10
x
The normal distribution function is highest at the mean, and is symetrical about
the mean.
Next, we graph several normal distributions of same mean (0) and different
standard deviations (5, 1 and 2):
© M&S Kaufman, 2004
1
NORMAL DISTRIBUTION DENSITY
1
dnorm ( x , 0 , 0.5)
dnorm ( x , 0 , 1)
0.5
dnorm ( x , 0 , 2)
10
5
0
5
10
x
From these three curves centered on µ=0 (that differ only in standard deviation
σ), we note that as the standard deviation increases, the normal distribution
becomes wider and flatter.
•
Try out a function of your own, by choosing the mean and standard deviation
values (you see my choices below -- change them as you wish):
NORMAL DISTRIBUTION DENSITY
− 0.5
5
0.1
dnorm ( x , 2.5 , 3)
0.05
10
5
0
5
10
x
© M&S Kaufman, 2004
2
Next we examine the cumulative probability distribution of the probability that the
variable x is less than, or equal to, a specified value X.
pnorm(X,µ,σ) gives this cumulative probability value for any normal distribution
with mean µ and standard deviation σ. Geometrically, it is the area under the
normal curve to the left of X in the graph below:
For example, given that x is normally distributed with mean 2.5 and standard
deviation 3, the probability that the variable x is less than -0.5 is:
pnorm ( −0.5 , 2.5 , 3) = 0.159
For the same distribution, the probability that x is less than 5 is:
pnorm ( 5 , 2.5 , 3) = 0.798
CUMULATIVE NORMAL DISTRIBUTION
1
pnorm ( X , 2.5 , 3)
0.5
10
5
0
5
10
X
© M&S Kaufman, 2004
3
We graphed above the cumulative normal distribution of mean 2.5 and
standard deviation 3, pnorm(X,2.5,3) against values of X.
The result is an S-shaped curve.
For small values of X, the probability of finding variable values below X is low,
close to 0; for large X values, the probability of finding variable values below X
becomes large, close to 1.
FOOD FOR T HOUGHT
We used the "canned" dnorm function to graph several normal curves and
observe their properties and the effects of changing means and standard
deviations.
We computed and graphed the cumulative normal distribution function, which is
useful for calculating various probabilities.
•
•
•
•
Try changing means, standard deviations or both and see what happens to
the shape of the resulting curve.
Try to compute the cumulative probabilties for a few X values of your own.
Note how the result is always betwen 0 and 1.
Can you find values of X for which you obtain cumulative probabilities of
exactly 0 or exactly 1?
Think about some of the homework problems regarding the normal curve
(especially those asking for the probability of a variable less or more than
a giuven value, or to be between certain values), and how you could use
MathCAD to answer them:
- can it be done? how?
- do you need to go through the transformation to z-scores?
Notes:
•
•
•
•
•
The graphs you produced during this lab session used "canned" formulae
(buitl in MathCAD). For other graphs, you will need to enter your own
formulae, which you have to define before you beign the graph. It is very
important to make sure that on your page the definitions of variables and
their values and of various functions come before you use them in
formulae and graphs (or else MathCAD returns an error message in red).
Remember not to mix text and formula boxes.
It is often easier to rewrite a formula than to fix it, if you get a stubborn
error message.
Save your work often, especially when something worked out. Do not
proceed very far without cheking that everything works, to minimize
backtracking and rewriting.
If you get a red error message, you need to attend to it right away - it won't
cure itself or go away, and will continue to cause problems.
© M&S Kaufman, 2004
4