Probability Distributions not on the TI 83/84 (Preliminary

advertisement
1
Probability Distributions not on the TI 83/84 (Preliminary Version)
Floyd Vest, June 2014
If you look on page 13-29 under 2nd Distr of the TI 83 manual you will see for probability
distribution functions: normal, t,  2 , F, binomial, poisson, and geometric . Using the TI 83
statistical functions, you can calculate Critical Values (CV) for left and right tailed areas under
the curve, conduct statistical tests (page 13-9), and calculate confidence intervals. But what if
your probability distribution is not in the above list?
If your probability distribution has a closed form formula (and some don’t), you can write
it into Y= and set a Window and graph it. With the TI 83 there are several ways to calculate left
and right tail areas and their CVs.
We will do an example with the lognormal probability distribution
 1
(1)
f ( x) 

2
1
  (lnx) 
e  2  , x>0 whose parent function is the standard normal distribution
x 2
(  =0,  =1) . (See the article in this course “The Lognormal Probability Distribution.”)
For Formula 1,
(1.1) Y2 = (1/(x* (2 ) )* e  (-(1/2)(ln(x))  2) . x > 0. The Y2 approached the x-axis
from above to the right very slowly, and rises very sharply from about zero. (The letter x on the
TI 83 is not italicized.)
You Try It #1.
Graph Y2 for Window x: 0, 3, 1; y: 0, .7, .1. Then graph for x: 0, 6, 1. Then graph for
x: 0, 12, 1. As the graphs develop, sketch them, put on units, label, and discuss. Evaluate
Y2(12) = .0015.
One way to calculate CVs for left and right tails is to use
(2)
Y9 = f n Int( expression, variable, lower limit, upper limit) which calculates the area
under the curve for expression from lower limit to upper limit (page 2-7). For an example we
use the lognormal distribution Y2 in Formula 1.1,
(3)
Y9 = f n Int( Y2, x, 0, x) which gives the cumulative area (cdf) under Y2 starting near 0
and tops out at Area = 1, out around x = 12. The area under a probability distribution should
be 1. The TI 83 graphs Y9 very slowly since it is recalculating Reimann sums (See the Side Bar
Notes.) To speed up the graph of Y9, in Window, set x res to a higher value but the TI 83 will
set it back to 4. Since Y9 moves so slowly use Window: x: 0, 5, 1; y: 0, 1, .1.
You Try It #2
Graph Y2 and Y9 on the same axes. Set Window x: 0, 6, 1; y: 0, .1, 1. Sketch the curves and
label them on the same axes, put on units. Discuss each and their relationship.
2
For example, with only Y9 on the graph, to find a left tail area of .05 and its CV, use
Trace. Set the calculator on Float (Mode, Float). Make a guess, write in .25, Enter and read for
area y = .083 . Keep moving around until you get area close enough to .05 and report your CV
for the 5% left tail. Trace and move the cursor works fairly well in the left tail but is very slow
in the right tail.
For a right tail area of .05, one could go up to where area = y = .95, experiment by
calculating Y9( ) with values for x, and report your estimate for CV for the 5% right tail. To find
the area from x1 to x2 , simply calculate the area up to x2 and subtract the area up to x1 , or put
x1 as lower limit and x2 as upper limit in Formula 2 for f n Int( . For a 1% right tail, you will
have to go all the way out to Y9(10) = .989 .99.
You Try It #3
Do the calculation for 5% left and right tails as described above. You can use Trace, or evaluate
Y9( on the home screen. For example Y9(.2) is close to area = .05. For the right tail, Y9(5.2) =
.950389, giving a right tail close to area = .05 for a 5% right tail.
You Try It #4.
Go to Wikipedia.org, lognormal distribution, page 1, with the graph of the lognormal probability
distribution f x (0,.25) ,  = 0,  = .25, and the graph of its cumulative distribution function
(cdf). Enlarge the graphs and print them out. For this distribution, graph f x (0,.25) and its cdf.
1
 1


(lnx   )2 
 2 2

e
called f(  ,  ), x>0, where 
x 2
and  are from the parent normal distribution . Find CVs for a left 5% tail and a right 5% tail.
(4)
The lognormal distribution: f x ( x ) 
You Try It #5.
Make up your own probability distribution and do the above calculations. For example,
for y = - x 2 +1, find a lb and a ub which gives a total area of one. You could use
Y? = f n Int( - x 2 +1, lower bound, upper bound) until you get area = 1.
You Try It #6. From Wikipedia.org, lognormal distribution, give the formula for Mode, and


1
e 2 . Calculate Mode and f(Mode) for lognormal (0,.25).
show that f ( Mode) 
 2
2
Summary. Following the above approach, we have simulated the TI 83 functions pdf(,
cdf(, and inv(function)( . See Exercises #8 and #10 for another approach. For numerous
applications of areas and tails for probability distributions, see Chapter 13 of the TI 83/84
manuals, statistics textbooks, and Wikipedia.org.
3
Side Bar Notes:
The TI 83 function Y9 = f n Int( Y2,x,0,20) calculates the cumulated area with a
20
(5)
Reimann sum for a definite integral
 Y 2( x )dx
=
0
limit as n   , x  0
n
 Y 2(c )x
i
i 1
i
where 0 is the lower limit of the interval and 20 is the
upper limit of the interval and the interval is partitioned into n subintervals and as n   ,
x  0 . The sum is repeatedly calculated for finite increasing values of n until the sequence of
estimates of the area has converged (The recent estimates are all close together.). Some finance
books say that this is a guess and check process, but there is a well-known theorem that says
there is no guess, the sequence converges to the correct value. It is just a matter of how accurate
you want to be. You could do this with a program. You would have to go out to x = 10 to get a
1% right tail. Beyond x = 10, the function continues to approach the x-axis from above. You
check Y2(20) and see that Y2 is still approaching the x-axis from above. The approach to the
x-axis is so slow, and the calculations of the Reimann sums so slow, that you wouldn’t want to
graph Y9 out to 20.
Using a Solver. You could try to use fn Int( in a Solver on the TI 83. For example for
the standard normal distribution, the area from -4 to 0 should be .5 . Try to put in the Solver:
0 = .5 – fn Int( Y1,x,-4,x) and solve for x, where Y1 is normal for  = 0,  = 1, which is
1 2x
e
(6)
Y1= f N (x) 
. See if this works. It is very, very slow! Does it give the
2
correct answer which should be x = 0 where the area from -4 to 0 is .5.
2
When you use Trace, the TI 83 may change the Window and in a sense it may be wrong.
A stock screener starts with 1,122 stocks. It eliminates those that don’t have market
capitalization of $4 billion. It requires sales growth per share of 5%, and per-share-profit growth
of 10%, 77 stocks left. A price-to-earnings ratio below average is required, 63 stocks left. It
requires a total return higher than average, 44 stocks left. There is a lot left out of this summary
and requirements are not clearly stated. See the internet, Search: YHOO:YAHOO INC, and you
will see a stock screener. Look around the site for information and go to Stock Scouter Report.
Look up the terms on Wikipedia.org, investopedia.com, and other sources.
Rent vs Buy calculator. On the internet, Search New York Times Rent vs Buy. Click on
Is it Better to Rent or Buy – NYTimes.com. You will see a form to be filled out including
factors such as Home Price, How Long Do You Plan to Stay?. The calculator returns figures
such as Initial Costs, and Net Proceeds. The program is not transparent. It doesn’t show the
calculations.
Rent or Buy Heat Map. Go to marketwatch.com. Put in a site search for national heat
map. Click on Easy Heat Map Generation. It requires registration.
4
Growth stocks and value stocks. A growth stock is a stock of a company that generates
substantial positive cash flow, and whose revenues and earnings are expected to increase faster
than the average company within the industry. They usually pay no dividends or pay smaller
dividends, reinvesting retained earnings in capital projects. Value stocks, for example could
trade at discount to book value, have high dividend yields, have low price to earnings multiples
or low price to book ratios. They can be bought for less than their intrinsic value which is the
discounted value of all expected future distributions. (From Wikipedia.org) For examples,
consider the Russell 3000 growth index, and the Russell 3000 value index. Book value is the
key factor in the distinction. See articles in this course for definitions of these terms; see
investopedia.com; Wikipedia.org; and other sources.
Paying $9 verses $128 for managing your $10,000. Large-cap domestic index funds have
outperformed managed funds 90% of the time for decades. The ETF SPDR S&P 500 (SPY, 190)
charges only .09%. The average managed fund charges 1.28%. The S&P 500 is currently
trading at 16 times current year’s estimates of earnings, which is close to the average for the last
100 years (Forbes, June 16, 2014, page 62).
Thirty year treasurys. For people who bought 30-year treasurys twenty-five years ago,
what is their coupon rate? How does it compare with current rates? What is their $1000 bond
worth now?
Bank of America stocks lost about 94% of its price. It is one of the biggest banks in the
US. What percentage would it have to gain, to get back? Where is the stock (BAC) now? What
was the former high and low? What are the analysts saying? See finance.yahoo.com. What
caused the collapse? Whose fault was it? Were there some financial mathematicians that kept
their banks out of trouble?
Exercises: Show your work. Label answers, variables, and numbers. When appropriate answer
in complete sentences. Sketch, label graphs and put on units. Give code when useful, name your
calculating device, and give page numbers from manuals. The lognormal distribution is on
excel. It doesn’t seem to be on the TI 86 and the TI Nspire.
#1.
For the standard normal distribution (0,1) do examples to Graph: invNorm(, fnInt(,
Shade(, normalpdf(, and normalcdf(, (page 13-29). Give your Y= function, Window, sketch
each graph, label axes, put on units, give the meaning of the x and y. Graph the normalpdf( and
normalcdf( on the same axes and sketch, label, and discuss. What does the graph of invNorm(
look like? Label and explain the axes? What does each function do and what is the code? Name
your calculating device and manual. Give page numbers from the manual.
#2.
(a) For the lognormal (0, .25) on Wikipedia.org, (a) )On the calculator, graph it, and its
parent normal  = 0,  = .25 on the same axes. Sketch the graphs and discuss.
(7)

1
e
The normal distribution is f N (x) 
 2
(x   )2
2 2
often called normal (  ,  ).
5
(b) Notice that the lognormal (0, .25) has a strong right tail. If you prefer a strong left

2
1
(ln(  x )) 

2
1

tail, use Y4 =
and graph with Window x: -2.29, -.383, .5; y: 0, 1.7, .1.
e  2(.25)
.25(  x ) 2
You see a curve with a strong left tail. You could check the area under the curve with
Y9 = f n Int (Y 4, x, -2.29, -.383) and get an area of one. Xiong claims that for stocks, there is a
strong left tail. See the references. On a calculator, Graph Y4. Estimate Mode of Y4 and
Y4(Mode). How was Y4 made from lognormal (0, .25)? Are Mode (Y4) and Mode(lognormal
(0, .25)) equal distance from the y-axis? Are the left tail of lognormal (0, .25) and the right tail
of Y4 the same distance from the y-axis. Is this true for the other tails? Do the two curves
match except for 180 degree rotation about the y-axis? Is one curve a reflection of the other in
the y-axis? Is there a way to see if the two curves match? Sketch by hand the two curves, label,
and discuss. Put on units, label axes.
(c) On the calculator, graph the cdf for lognormal (0, .25) and the cdf for normal (0, .25)
on the same axes. Sketch, label, put on units and discuss.
#3.
Explain why Graph on Y9 = f n Int( is so slow.
#4.
(a) Notice in Wikipedia.org, lognormal distribution, the cdf for lognormal with  =0
and  = 10 graphed in red. This one is really strange. Put lognormal (0,10) in Y3 and
experiment with it,
 1 
2
1

  200 (ln x )
Y3 = f ( x)  
. On the TI 83, calculate Y3 for x = .01, .00001,
e

10 x 2 
.0000001. Then calculate for x = .1 then x = 1, then 10. From formulas calculate Mode and
f(Mode). Describe what you think the curve Y3 looks like. What does the cdf tell you about
Y3 for larger values
(8)
of x. Notice that it seems to take the cdf forever to reach 1. Perhaps the curve of Y3 looks like
y = 1/x. As x approaches 0, the front factor increases much faster than the second factor declines.
Graph Y3 on Window x: 0, 109 , 108 ; y: 0, 108 , 107 . Sketch the graph with units and discuss.
(b)
But if there is a Mode = 3.720076  1044 and f( Mode) = 2.0647  1020 , then there
must be a turn down toward (0,0). Perhaps this could be proven with calculus. The first factor
in Y3 obviously is like y = 1/x. Investigate the second factor for values of x approaching 0 and
for larger values of x.
(c) To see Y3 close to x=0, with Mode = 3.720076E-44 on the TI 83, evaluate
Y3(3.70076E-44). You should get Y3(Mode) = 2.0647E20. to graph Y3 in this neighborhood,
use Window: x: 0, 4E-44, 4E-45; y: 0, 2E21, 2E22. You will see a localized horizontal line.
Press Trace and you will see coordinates for a point in this neighborhood. To evaluate Y3 closer
to zero, evaluate
Y3(3.72E-80) and get Y3 = 248,242. This is closer to zero. To get Y3 closer to zero, evaluate
Y3 at 4E-86 to get 1.09. What do you think is the shape of the curve as it approaches (0, 0)?
You could try ZOOM. Graph using Window: x: 0, 4E-83, 4E-84; y: 0, 1000, 100. Calculate
6
the slope of the line. Press Trace and read the coordinates of some of the points on the line.
Using basic formulas, calculate the slopes for different intervals. See Exercise #8 for another
method of calculating slope.
On a calculator, graph Y3 = lognormal (0, 10) near [Mode, Y3(Mode)] and see if there is
a relative maximum at this point. Use Window: x: 2E-44, 6E-44, .5E-45; y: 2.05E20, 2.08E20,
.03E19. Sketch the graph, put on units, label axes, and discuss.
#5.
Notice in Wikipedia.org, lognormal distribution, that the cdf’s with  = 0 go through
x = 1, cdf = .5. On the TI 83 try this on Y9. Perhaps you could use integral calculus to prove
this. Also, note that Median = e and if  = 0, this gives x = Median = e0 =1. At the Median,
the cdf = .5 .
#6.
Check normalcdf( in , 2nd Dist, against f n Int( from -1 to 0 for the standard normal (0,1).
The defaults for  and  are 0 and 1. (Page 13-30) You should get .341344741 from both.
To do this put the standard normal in Y1, and use Y9 = f n Int( Y1, lb, ub). The TI 83 manual
says that normalcdf( computes the normal distribution probability between lb and ub. Give
several meanings of this statement.
#7.
Read the articles on confidence intervals in this course in the References to review the
topic of left and right tails and their applications.
#8.
(a) On the TI 83, use under 2nd Calc the
 f ( x)dx to find a 5% left tail and a 5% right
tail for lognormal (0, .25) in Wikipedia.org, lognormal distribution. Put up a fresh graph. See
Formula 4 for the lognormal. Follow page 3-28 for  f ( x )dx and page 3-26 for entering for
each integral the Left Bound? Give a number then Enter, and the Right Bound?, Give a number
then Enter. Use the cursor which comes up after 2nd Calc 7 or write in the numbers. For
example for a 5% left tail, for Left Bound?, write in 0, Enter. For Right Bound?, write in .665,
Enter. Then  f ( x )dx appears with the area value. Refine the Right Bound for area = .05.
For the right 5% tail, do 2nd Calc 7 and for Left Bound? write 1.48, Enter, and for Right
Bound? write 2.5, Enter. Then
get close to area = .05. The
 f ( x)dx appears with an area value.
 f ( x)dx employs the fnInt( used above.
Refine the Left Bound? to
This process is faster than
using the cdf = f n Int( .
(b) Try 2nd Calc 6 for dy / dx = slope at a point. Start with a fresh graph. Put the cursor
on the point then Enter and read the slope. See page 3-27. Try 2nd Calc 4 for maximum. See
page 3-27 for instructions which involves a Left Bound?, Enter; Right Bound?, Enter; and in
response to Guess, put the cursor on the maximum point and Enter and read the coordinates of
the maximum point. Check this maximum against the formulas for Mode and f(Mode).
(c) Give an interval under this lognormal distribution containing 90% of the values
distributed by this lognormal distribution. Using formulas, calculate the Mean of this
distribution. Calculate the percent of the values falling below the Mean. Where is a 90%
7
interval with Mean as the center? Find a general formula for Median in wikipidea.org,
lognormal distribution. From the formula calculate the Median. Mark on the graph the
numerical values of the Mode, Median, and Mean.
#9.
Use the infinite Binomial Theorem formula from one of your textbooks to calculate
1
(1 + .033 ) 4 for the interest rate of 3.3% . Expanding to five terms should be good enough. This
may be the way your calculator does the calculation. Check you answer against the calculator’s
calculation. What are some of the conditions for convergence of the series? When is the series
finite?

#10.
For the lognormal distribution, Mean is defined Mean =  xf ( x )dx where f(x) is the
0
lognormal distribution. Use this definition and a numerical area function on the TI83 to estimate
the numerical value of Mean of lognormal (0, .25) on Wikipedia.org, lognormal distribution. Use
0 as the lower bound since lognormal is defined for x > 0. Calculate Mean from a formula on
Wikipedia.org, lognormal distribution.
References in this course:
“The Lognormal Distribution.”
“Standard Deviation as a Measure of Risk for a Mutual Fund.”
“Confidence Intervals and Hypothesis Testing for Variance.”
For a free copy of the TI 84 manual, see TI.com. For related topics, see TI.com.
Other References:
Xiong, James X., “Nailing Down Risk,” Ibbotson,com, Feb. 2010, Published Research.
For a free course in financial mathematics, with emphasis on personal finance, for upper high
school and college, see COMAP.com. Register and they will e-mail you a password. Simply
click on an article in the annotated bibliography, download it, and teach it.
Unit 1: The Basics of Mathematics of Finance Unit 2: Managing Your Money
Unit 3: Long-Term Financial Planning Unit 4: Investing in Bonds and Stocks
Unit 5: Investing in Real Estate Unit 6: Solving Financial Formulas for i. Unit 7: More
Advanced or Technical. For about thirteen more advanced or technical articles see the UMAP
Journal at COMAP.com.
8
Download