15 stats programs for TI-81. Some replace statistical tables, do statistical graphing. ----begin documentation---- TI-81 Statistical Programs Michael Lloyd (lloydm@holly.hsu.edu) April 1995 Henderson State University This software is freeware. I am in no responsible for any loss of money, data, or anything else from the use of these programs. documentation - table of contents ASCII - more detailed documentation and human-readable code Program Description ======= =========== CHI2.........Area under a chi-squared probability density function FRACTION.....Convert a decimal to a fraction GAMMA........Gamma function for half-integral values INTRPLT......Linear interpolation (for use in statistical tables) LSCI.........Compute and graph least squares confidence intervals MEDIAN.......Median of {x} data NORMAL.......Find the area under a standard normal probability density -----........Probability list operations QUART .......1st, 2nd, 3rd quartiles for {x} data T............Compute the critical value from a Student's t distribution TABLE........Table of X and Y_1 values ZVAL.........z value from normal distribution ----end documentation---- ----begin ASCII---- ====================================================================== CHI-SQUARED 16 Nov 1993 A = argument of gamma function, lower limit of integration B = x value C = used D = used G = gamma function GAMMA program J = used P = used R = degrees of freedom SIMPson's rule program T = used U = used W = variable of integration Y_1 = integrand Assume the random variable X is has the Chi squared distribution. Given the degrees of freedom r and x>0, then P[X < x] is approximated. Prgm:CHI Disp "DF" Input R Disp "X" Input B R/2 -> C C -> A Prgm GAMMA 0 -> A 10 -> N "x^(C + 4)*e^ - (x/2)" -> Y_1 Prgm SIMP C -> D C -> P C^(-1) -> T T -> U 1 -> J Lbl 0 D + 1 -> D PD -> P TX/2D -> T U + T -> U IS>(J,4) Goto 0 (B^C*e^-(B/2)*U + S/32P)/2^C/G -> T Disp T =========================================================================== FRACTION D = denominator N = decimal, numerator Prgm:FRACTION Input N 0 -> D Lbl l D + 1 -> D If FPart Round(ND, 7) Goto l ND -> N Disp N Disp D =========================================================================== GAMMA FUNCTION 15 Nov 1993 A = half-integral positive number G = the gamma function evaluated at A X = counter Prgm:GAMMA If FPart A = 0 Goto 0 sqrt pi -> G If A = .5 End .5 -> x Lbl l XG -> G IS>(X,A-.5) Goto l End Lbl 0 (A-1)! -> G ====================================================================== LEAST SQUARES CONFIDENCE INTERVALS 2 May 1994 1. Enter the statistical data 2. Select prgmLSCI 3. SE is the standard error. 4. C is the confidence level. 5. X is the x value for prediction. 6. To exit program, hit 2nd quit. 7. Set window and graph to see confidence band. C = confidence level D = standard error K = degrees of freedom T program X = x value V = SS_x W = SS_y Y_1 = radius of confidence band Y_2 = lower limit of confidence band Y_3 = upper limit of confidence band Y_4 = least squares line Prgm:LSCI LinReg "a + bX" -> Y_4 sigma_x^2n -> V sigma_x^2n -> W sqrt((W - b^2V) / (n - 2)) -> D Disp "SE=" Disp D Prgm T DT sqrt (1 + n^(-1) + (x - xbar)^2 / V)" -> Y_1 "Y_4 - Y_1" -> Y_2 "Y_4 + Y_1" -> Y_3 Lbl 1 Disp "X" Input X Disp "Y VALUES FROM" Disp Y_2 Disp "TO" Disp Y_3 Disp "PREDICTED Y = " Disp Y_4 Goto 1 ====================================================================== LINEAR INTERPOLATION 21 Feb 1994 Linearly interpolates between (A,B) and (C,D). M = slope T = test value X = x Y = y Prgm:INTRPLT Disp "X1" Input A Disp "X2" Input B Disp "Y1" Input C Disp "Y2" Input D (D-C)/(B-A) -> M Lbl 0 Disp "X" Input X Disp "Y is" C + M (X - A) -> Y Disp Y Pause Disp "0 To Quit" Input T If T Goto 0 =========================================================================== MEDIAN 31 Aug 1994 Find the median of the x data. F = midway point in data M = median n = number of points N = n/2 Prgm:MEDIAN xSort 1-Var n/2 -> N FPart N -> F If F<>0 {x}(I Part N + 1) -> M If F=0 ({x}(N)+{x}(N+1))/2 -> M Disp "MEDIAN=" Disp M =========================================================================== NORMAL DISTRIBUTION 15 Nov 1995 Find the area from -infinity to z under the standard normal probability density function. I.e., if Z is a standard normally distributed random variable, then P[-infint=ity < Z < z] is approximated. Prgm:NORMAL Input B 0 -> A 10 -> N "e^-(x^2/2)/sqrt 2 pi" -> Y_1 Prgm SIMP S + .5 -> S Disp S =========================================================================== PROBABILITY LIST OPERATIONS 28 Oct 1994 A = START B = END I = counter X = counter, used Y_1 = function Y_2 = function Y_3 = function ==================== Sum Y_2(x) from x = START to END. Prgm:SUMY2 Disp "START" Input X Disp "END" Input B 0 Lbl 0 Ans + Y_2 IS > (X,B) Goto 0 Disp "Sum Y_2=" Disp Ans ==================== Sum Y_1(x)*Y_2(x) from x = START to END. Prgm:SUMY1Y2 Disp "START" Input X Disp "END" Input B 0 Lbl 0 Ans + Y_1Y_2 IS > (X,B) Goto 0 Disp "Sum Y_1Y_2=" Disp Ans ==================== {x} = {Y_1(START) ... Y_1(END)} {y} = (Y_1(START) ... Y_2(END) } Prgm:Y1Y2TOXY ClrStat Disp "START" Input A Disp "END" Input B A -> X Lbl 0 Y_1 -> {x}(X - A + 1) Y_2 -> {y}(X - A + 1) IS (X,B) Goto 0 Disp "Y_1 -> {x}( )" Disp "Y_2 -> {y}( )" ==================== Sum Y_3({x}(i))*{y}(i) over data. Prgm:SUMY3XY 0 -> S 1 -> I Lbl 0 {x}(I) -> X Y_3{y}(I) + S -> S IS(I, Dim {x}) Goto 0 Disp "Sum Y_3(X)Y=" Disp S =========================================================================== QUARTILES 3 Sep 1994 J = used M = median n = size of data P = 1st quartile, or lower fourth Q = 2nd quartile, or upper fourth {x} = data set Y_1 = formula Prgm:QUART xSort 1-Var "({x}(Rand(J,0)) + {x}(Int J + 1)) /2" -> Y_1 n/2 -> J Y_1 -> M J/2 -> J Y_1 -> P 3J + 1/4 -> J Y_1 -> Q Disp "Q1=" Disp P Disp "MEDIAN=" Disp M Disp "Q2=" Disp Q =========================================================================== SIMPSON'S RULE 15 Nov 1993 Used only as a subroutine. A = lower limit of integration B = upper limit of integration E = even terms H = delta x J = counter N = number of intervals O = odd terms S = approximate integral X = x Y_1 = integrand Prgm:SIMP 0 -> O 0 -> E (B-A)/N -> H 1 -> J Lbl 0 A +(2J-1)H -> X O + Y_1 -> O IS>(J,N/2) Goto 0 1 -> J Lbl 1 A + 2JH -> X E + Y_1 -> E IS>(J,N/2-1) Goto 1 A -> X Y_1 -> S B -> X H(S + 4O + 2E + Y_1)/3 -> S =========================================================================== STUDENT t DISTRIBUTION 17 Mar 1994 Given the degrees of freedom and the confidence level c, the critical value t is found. I.e, if T has Student's dustribution, then P[-t < T < t} = c. A,B,C = used GAMMA program I = old integral N = number of steps in Simpson's rule S = new integral SIMPson's rule program X = variable of integration Prgm:T Disp "STUDENTS DISTR." Disp "1.1-TAIL Test" Disp "2.2-TAIL TEST" Disp "3. C.I." Input A If A=1 Goto 3 If A = 2 Goto 4 If A = 3 Goto 2 Lbl 5 Disp"DF" Input K K/2 -> A Prgm GAMMA GC sqrt K pi -> C (K + 1)/2 -> A Prgm GAMMA C/2G -> C -A -> P 0 -> B 0 -> S 20 -> N "(1 + x^2/K)^P" -> Y_1 Lbl 1 B -> A B + 1 -> B S -> I Prgm SIMP S + I -> S If S < C Goto 1 B - (S - C) / (S - I) -> T Lbl 0 B -> A T -> B S -> I Prgm SIMP S + I -> S B - (S - C) / Y_1 -> T If abs (T - B) > .0001 Goto 0 Disp T Stop Lbl2 Disp "C" Input C Goto 5 Lbl 3 Disp "A^" Input C 1 - 2C -> C Goto 5 Lbl 4 Disp "A^^" Input C 1 - C -> C Goto 5 =========================================================================== TABLE 28 Sep 1994 D = delta x T = test to control program X = x Y_1 = function y Prgm:TABLE ClrHome Disp"FUNCTION IN Y_1" Disp "START AT" Input X Disp "INCREMENT" Input D Lbl 1 Disp "X=" Disp X Disp "Y=" Disp Y_1 X + D -> X Disp "1 = CONTINUE" Disp "2 = REVERSE" Disp "3 = QUIT" Input T If T = 2 -D -> D If T = 3 End Goto 1 =========================================================================== Z-VALUE 21 Feb 1994 Given alpha, find z so that P[0 < Z < z] = alpha. A = lower limit of integration B = old z value F = alpha or alpha*sqrt(2pi) N = number of steps in Simpson's rule S = chi^2 cdf evaluated at B X = integration variable Z = new z value Y_1 = e^-(x^2/2) Prgm:ZVAL Disp "Z VALUE" Disp "1.INPUT A" Disp "2.INPUT C" Input I If I = 1 Goto 4 Goto 6 Lbl 5 If F <= .341 Goto 1 If F <= .477 Goto 2 46.73F - 20.3 -> T Lbl 3 F sqrt 2 pi -> F "e^ - (x^2/2)" -> Y_1 0 -> A 10 -> N Lbl 0 T -> B Prgm SIMP B - (S - F)/Y_1 -> T If abs (T - B) > .0001 Goto 0 Disp T Stop Lbl 1 2.93F -> T Goto 3 Lbl 2 7.36 F - 1.51 -> T Goto 3 Lbl 4 Disp "A" Input F Goto 5 Lbl 6 Disp "C" Input F F/2 -> F Goto 5 ----end ASCII----