A Statistical Analysis Example of A Full Functional Utilization of An Engineering Calculator Li-Fei Huang (lhuang@mcu.edu.tw) Dept. of App. Statistics & Info. Sci. Ming Chuan University, TAIWAN Outline • • • • • • • Introduction Steps of simple linear regression analysis Commands for programming Regression test program Execution result Conclusions References Introduction • The functions and commands of statistical software which is installed in the computer are quite COMPLICATED. • The engineering calculator is EASIER to manipulate and CHEAPER to possess. Today even the PROGRAMMING can be done. • This paper will use CASIO fx-7400G PLUS to do the simple linear regression analysis. CASIO fx-7400G PLUS • The slope, the intercept and the coefficient of correlation are shown directly. • There are NO further results about hypothesis testing. • Lots of basic statistics such as n, x, y, x 2 , y 2 , xy can be extracted from the memory of the calculator to create the program about hypothesis testing. Simple linear regression (Step 1) n • The sum of squares for X: SSX ( x • The slope for the regression line: i 1 i b1 x ) 2 n( x xy nx y SSX The intercept for the regression line: b0 y b1 x n) 2 Simple linear regression (Step 2) • The sum of squares for regression: n SSR yˆ i y b12 SSX 2 i 1 • The sum of squares for Y or the sum of squares for total: SSY SST ( y y ) n( yn) • The sum of squares for error: SSE SST SSR • The mean squares for error: MSE nSSE 2 • The regression F test value: F SSR 1 SSR n 2 i 1 2 i SSE (n 2) MSE Simple linear regression (Step 3) SSR SST • The coefficient of determination: • The coefficient of correlation: R if X and Y are positively correlated, R if X and Y are negatively correlated. R2 2 2 Simple linear regression (Step 4) • The t tests for the slope and the intercept: t b1 1 t b0 0 MSE MSE x 2 SSX nSSX • The confidence interval and the prediction interval for a given value of X: Yˆ t 2 1 ( X x)2 MSE n SSX Yˆ t 2 1 ( X x)2 MSE 1 n SSX Commands for programming • Parts of commands from CASIO fx-7400G PLUS manual: Basic operation ? Key-in a value. Show calculation result. Connect 2 commands. : Program command Jump command Display command If Then Else IfEnd Goto Lbl " " Connect 2 commands. Store result in A to Z. An if-then-else loop. Go to the label. Show words in quotes. Regression test program (Step1) R E G 2 V a r i a b l e s t 1 , L i s t ( x n y x n 2 ) B B x A L i s s t L i L T E y n x t S T 1 B Name the program. L i Compute 2 , 1 variables. y ) ( Use basic statistics to find the slope Store the intercept in A. A L i 2 L i s t 4 statistics of 2 and store it in B. 3 s t i s t basic 3 Store Y hats in List 3. Store residuals in List 4. Regression test program (Step2) B 2 " S n T " S " S n x S R " : y n 2 R E S E " : S T " : E " M ( S R E F " " F D n 2 R R T E T n 2 ) E E " : E " : F F 1 , " : n 2 Store sum of squares for regression in R and show it. Store SST in T. Store SSE in E. Show SSE. Show SST. Store mean squares for error in E and show it. Store the F test value in F and show it. Show 2 degrees of freedom. Regression test program (Step3) R T R " R I f R " : E l s e f E n d " : R 2 B 0 h e n " R " R " : I T R Store and show the coefficient of determination. Find the coefficient of correlation and show it. Regression test program (Step4) • The t tests for the slope and the intercept: L b l " ? ( B 0 : " B S S E T ) ( ( E 2 x n ) ) T " S L O P E T T E : T " B E ( A 2 Put label 0 here. A 1 n Show the slope t test value. S " Ask for an intercept to test. T A 0 " ? I I ) ( ( E x n I T N T 2 x n E E 2 Ask for a slope to test. Store the slope t test value in T. Store the intercept t test value in ) ) T T. " : R C P T T " Show the intercept t test value. Regression test program (Step4) • The SE parts of the confidence interval and the prediction interval for a given value of X: " n " G N ( S ( S E W X " ? X 1 n ( X x ) 2 x n 2 ) G E ( Y H A T ) " : E E " G o t o E ( 1 G ( P R E 0 Ask for a new X value. Compute and show the standard error for Y hat. 2 ) ) H D ) " : H Compute and show the standard error for the prediction interval. Go to label 0 and test another slope. Execution result • One data set in the book of Berenson, Levine, & Krehbiel No. 1 2 3 4 5 6 7 8 9 10 11 12 X 5 5 5 10 10 10 15 15 15 20 20 20 Y 160 220 140 190 240 260 230 270 280 260 290 310 Execution result (Step 2) S S S M F S S S S R E T E 2 0 5 3 5 Press EXE to move on. 9 4 9 0 Press EXE to move on. 3 0 0 2 5 Press EXE to move on. 9 4 9 Press EXE to move on. D F 2 1 . 6 3 8 5 6 6 9 1 1 , 1 0 Press EXE to move on. Press EXE to move on. Execution result (Step 3) 0 . 6 8 3 9 3 0 0 5 8 3 R 0 . 8 2 7 0 0 0 6 3 9 8 R 2 Press EXE to move on. Press EXE to move on. Execution result (Step 4) B E T A 1 ? 0 S L O P E T T E S T 4 . 6 5 1 7 2 7 3 0 4 B E T A 0 ? 0 I N T E R C E P T T 6 . 6 5 6 5 6 0 6 5 8 N E W X ? 2 S S 5 E E Key-in the number. Press EXE to move on. Key-in the number. Press EXE to move on. Key-in the number. ( 2 Y H A T ) 1 . 7 8 3 0 2 0 9 1 ( P R E D ) 3 7 . 7 2 9 2 9 8 9 6 D i s p Press EXE to move on. Press EXE to move on or press AC to stop program. Conclusion 1 • This particular calculator can produce some built in graphs such as histogram, bar chart, pie chart, line chart, box-and-whisker plot, standard normal probability density function, linear regression line, quadratic regression line, log regression line, exponential regression line and power regression line. Conclusion 2 • Using List 4 in previous example, residual plots can be produced to check whether this data set is suitable for regression analysis or not. Conclusion 3 • Using basic statistics, the following tests besides the regression test can also be fulfilled: z test, one-sample t test, two-sample t test, paired t test, chi-square test for single variance and F test for two variances. Conclusion 4 • Using the built in permutation and combination functions, the probability mass function and cumulative mass function for the following discrete probability distributions can be found: binomial distribution, hypergeometric distribution, geometric distribution, Poisson distribution and negative binomial distribution. Conclusion 5 • The built in list function can help doing many other analyses such as one way ANOVA, randomized block design, chi-square test for K╳1 table, chi-square test for R╳C table, Wilcoxon rank sum test, etc. • Generally speaking, this particular engineering calculator can accomplish lots of interesting statistical analyses if it’s fully utilized. References • CASIO fx-7400G PLUS manual. • Berenson, Levine, & Krehbiel. Basic Business Statistics—Concepts and applications. Pearson International (Edition 11). The End • Thank you for your watching!