Compare Linear Regression Lines for the HP-67

Similar documents
Compare Linear Regression Lines for the HP-41C

ST512. Fall Quarter, Exam 1. Directions: Answer questions as directed. Please show work. For true/false questions, circle either true or false.

HP-67 Quick Reference

Week 4: Simple Linear Regression III

Week 5: Multiple Linear Regression II

Example 1 of panel data : Data for 6 airlines (groups) over 15 years (time periods) Example 1

Bluman & Mayer, Elementary Statistics, A Step by Step Approach, Canadian Edition

CDAA No. 4 - Part Two - Multiple Regression - Initial Data Screening

Bivariate (Simple) Regression Analysis

THE UNIVERSITY OF BRITISH COLUMBIA FORESTRY 430 and 533. Time: 50 minutes 40 Marks FRST Marks FRST 533 (extra questions)

Week 4: Simple Linear Regression II

5.5 Regression Estimation

Robust Linear Regression (Passing- Bablok Median-Slope)

THIS IS NOT REPRESNTATIVE OF CURRENT CLASS MATERIAL. STOR 455 Midterm 1 September 28, 2010

Model Selection and Inference

2.830J / 6.780J / ESD.63J Control of Manufacturing Processes (SMA 6303) Spring 2008

Subset Selection in Multiple Regression

Long Live the HP-15C!

One Factor Experiments

Resources for statistical assistance. Quantitative covariates and regression analysis. Methods for predicting continuous outcomes.

PSY 9556B (Feb 5) Latent Growth Modeling

STAT 2607 REVIEW PROBLEMS Word problems must be answered in words of the problem.

HP-32S Quick Reference

Regression Analysis and Linear Regression Models

14.2 The Regression Equation

Two-Stage Least Squares

6:1 LAB RESULTS -WITHIN-S ANOVA

IQR = number. summary: largest. = 2. Upper half: Q3 =

HP-32SII Quick Reference

Spatial Patterns Point Pattern Analysis Geographic Patterns in Areal Data

For our example, we will look at the following factors and factor levels.

Multiple Regression White paper

Section 2.2: Covariance, Correlation, and Least Squares

Centering and Interactions: The Training Data

The Solution to the Factorial Analysis of Variance

See the course website for important information about collaboration and late policies, as well as where and when to turn in assignments.

Exercise: Graphing and Least Squares Fitting in Quattro Pro

Nonparametric Testing

range: [1,20] units: 1 unique values: 20 missing.: 0/20 percentiles: 10% 25% 50% 75% 90%

Regression on the trees data with R

Stat 401 B Lecture 26

Repeated Measures Part 4: Blood Flow data

. predict mod1. graph mod1 ed, connect(l) xlabel ylabel l1(model1 predicted income) b1(years of education)

Laboratory for Two-Way ANOVA: Interactions

Recall the expression for the minimum significant difference (w) used in the Tukey fixed-range method for means separation:

Week 11: Interpretation plus

Sta$s$cs & Experimental Design with R. Barbara Kitchenham Keele University

1. What specialist uses information obtained from bones to help police solve crimes?

Introductory Applied Statistics: A Variable Approach TI Manual

Section 2.1: Intro to Simple Linear Regression & Least Squares

HP12-C CFALA REVIEW MATERIALS USING THE HP-12C CALCULATOR

STATS PAD USER MANUAL

Data Mining. ❷Chapter 2 Basic Statistics. Asso.Prof.Dr. Xiao-dong Zhu. Business School, University of Shanghai for Science & Technology

Experiment 1 CH Fall 2004 INTRODUCTION TO SPREADSHEETS

Introduction to Hierarchical Linear Model. Hsueh-Sheng Wu CFDR Workshop Series January 30, 2017

Stat 5303 (Oehlert): Unbalanced Factorial Examples 1

HP-33S Calculator Program TM 1

1. Answer: x or x. Explanation Set up the two equations, then solve each equation. x. Check

CFALA REVIEW MATERIALS USING THE HP-12C CALCULATOR

Factorial ANOVA with SAS

Laboratory Topics 1 & 2

Evaluating the Numerical Accuracy of Analyse-it for Microsoft Excel

CHAPTER 3 AN OVERVIEW OF DESIGN OF EXPERIMENTS AND RESPONSE SURFACE METHODOLOGY

Concept of Curve Fitting Difference with Interpolation

SLStats.notebook. January 12, Statistics:

Lab #13 - Resampling Methods Econ 224 October 23rd, 2018

Table Of Contents. Table Of Contents

Knowledge Discovery and Data Mining

Correlation and Regression

Statistical Good Practice Guidelines. 1. Introduction. Contents. SSC home Using Excel for Statistics - Tips and Warnings

Statistics Lab #7 ANOVA Part 2 & ANCOVA

TI-83 Users Guide. to accompany. Statistics: Unlocking the Power of Data by Lock, Lock, Lock, Lock, and Lock

Box-Cox Transformation for Simple Linear Regression

Introduction to R. Introduction to Econometrics W

5:2 LAB RESULTS - FOLLOW-UP ANALYSES FOR FACTORIAL

General Factorial Models

CSC 328/428 Summer Session I 2002 Data Analysis for the Experimenter FINAL EXAM

Excel Primer CH141 Fall, 2017

CH5: CORR & SIMPLE LINEAR REFRESSION =======================================

Fitting to a set of data. Lecture on fitting

Using Computator page F or t or means or r -> d. Effect Sizes (ES) & Meta-Analyses. Using Computator page F or t or means or r -> d

Conditional and Unconditional Regression with No Measurement Error

1 Lab 1. Graphics and Checking Residuals

8.1 R Computational Toolbox Tutorial 3

Introduction to Statistical Analyses in SAS

Section 1.5: Point-Slope Form

610 R12 Prof Colleen F. Moore Analysis of variance for Unbalanced Between Groups designs in R For Psychology 610 University of Wisconsin--Madison

SAS data statements and data: /*Factor A: angle Factor B: geometry Factor C: speed*/

Quantitative - One Population

DS Machine Learning and Data Mining I. Alina Oprea Associate Professor, CCIS Northeastern University

For Additional Information...

Fathom Dynamic Data TM Version 2 Specifications

Module 25.1: nag lin reg Regression Analysis. Contents

Math 263 Excel Assignment 3

Chapter 6: Linear Model Selection and Regularization

- 1 - Fig. A5.1 Missing value analysis dialog box

Introduction to Excel Workshop

Selected Introductory Statistical and Data Manipulation Procedures. Gordon & Johnson 2002 Minitab version 13.

Validation of a Direct Analysis in Real Time Mass Spectrometry (DART-MS) Method for the Quantitation of Six Carbon Sugar in Saccharification Matrix

Instruction on JMP IN of Chapter 19

Transcription:

Compare Linear Regression Lines for the HP-67 by Namir Shammas This article presents an HP-67 program that calculates the linear regression statistics for two data sets and then compares their slopes and intercept. Usage CLREG Clear the registers to initialize the program. A Add a data point for set 1. [f] A Delete a data point from set 1. B Add a data point for set 2. [f] B Delete a data point from set 2. C D E Calculate the slope, intercept, R 2 value, SSE, and standard error for the slope, for data set1. Calculate the slope, intercept, R 2 value, SSE, and standard error for the slope, for data set2. Calculate the student-t values for differences between the slopes and between the intercepts. Example Consider the following data for set 1: And the data for set 2: X1 Y1 1 1 2 8 3 9 4 16 5 25

X2 Y2 1 1.1 2 8 3 9 4 16 5 25 Using the above data, first calculate the regression coefficients for set 1 and set 2. The way the program is written, you should not disturb the stack when viewing intermediate results as they are needed for subsequent calculations. Wait until each set of calculations finishes before you can recall values from different registers into the stack. The Steps involved are (using a DSP 5 and FIX mode). Step Task Command/Input Output 1 Initialize the program. [CL REG] READY 2 Add the first data point for set 1. 1 [ENTER] 1 [A] 1.00000 3 Enter the second data point for set 1. 8 [ENTER] 2 [A] 2.00000 4 Repeat step 3 to enter the remaining 25 [ENTER] 5 [A] 5.00000 data points in data set 1. 5 Add the first data point for set 2. 1.1 [ENTER] 1 [B] 1.00000 6 Enter the second data point for set 2. 4 [ENTER] 2 [B] 2.00000 7 Repeat step 6 to enter the remaining 25 [ENTER] 5 [B] 5.00000 data points in data set 2. 8 Calculate the regression coefficients [C] 5.60000 and other statistics for set 1. Calculate the slope. 9 Calculate the intercept [R/S] 5.00000 10 Calculate the coefficient of [R/S] 0.94800 determination. 11 Calculate the SSE value. [R/S] 17.20000 12 Calculate the standard error for the [R/S] 0.75719 slope 13 Complete the calculation run. [R/S] Blinking 0.00000 14 Calculate the regression coefficients [D] 5.98000 and other statistics for set 2. Calculate the slope. 15 Calculate the intercept [R/S] 6.92000 16 Calculate the coefficient of [R/S] 0.96128 determination. 17 Calculate the SSE value. [R/S] 14.40400

Step Task Command/Input Output 18 Calculate the standard error for the [R/S] 0.69292 slope 19 Complete the calculation run. [R/S] Blinking 0.00000 Next, calculate the student-t for the differences in the slope and the intercept: Step Task Command/Input Output 1 Calculate the student-t for the [E] 0.37023 difference in slopes. 2 Calculate the student-t for the [R/S] 0.56402 difference in intercepts. 3 Complete the calculation run. [R/S] Blinking 0.00000 The (absolute) values for the two calculated t statistics of 0.37023 and 0.56402 should be compared with t 0.05,6 = 2.447. As such, we cannot reject the hypothesis that the slopes of the two data sets are statistically different. Likewise, we cannot reject the hypothesis that the intercepts of the two data sets are statistically different.

Here are the regression results in tabular form (generated using Excel): Regression Results for Data Set 1 N 5 R-Sqr 0.962566845 ANOVA Table Source of variation SS DF MS F Regression 360 1 360 77.14285714 Residual 14 3 4.666666667 Total 374 4 Coefficient StdErr 95% Low Limit 95% Upper Limit Intercept -7 2.265686062-14.21042424 0.210424237 Slope 6 0.683130051 3.825975293 8.174024707 Regression Results for Data Set 2 N 5 R-Sqr 0.961280403 ANOVA Table Source of variation SS DF MS F Regression 357.604 1 357.604 74.4801444 Residual 14.404 3 4.801333333 Total 372.008 4 Coefficient StdErr 95% Low Limit 95% Upper Limit Intercept -6.92 2.298144179-14.23372045 0.39372045 Slope 5.98 0.692916541 3.774830313 8.185169687 Algorithms Statistical Summations x = sum of x x 2 = sum of x 2 y 2 = sum of y y 2 = sum of y 2 xy = sum of x y n = number of observations Regression Coefficients x m = x / n

y m = y / n S xx = x 2 ( x) 2 / n = x 2 n (x m ) 2 S yy = y 2 ( y) 2 / n = y 2 n (y m ) 2 S xy = xy ( x)( y)/ n = xy n x m y m Slope B = S xy / S xx = ( xy n x m y m ) / ( x 2 n (x m ) 2 ) Intercept A = y m B x m R 2 = B (Sxy / Syy) For line: y = A B x ANOVA Table Source of Variation Sum of Squares Degrees of Freedom Mean Square F 0 Regression SS R = B S xy 1 MS R MS R / MS E Residual/Error SS E = S yy B S xy n 2 MS E Total SS T = S yy n 1 Comparing Slopes Sy.x 2 = (SSE 1 SSE 2 ) / (n 1 n 2-4) SE slope.diff = [Sy.x 2 (1/ SSE 1 1/SSE 2 )] t slope = (slope 1 - slope 2 ) / SE slope.diff Comparing Intercepts SE intercept.diff = [Sy.x 2 (1/n 1 1/n 2 M1 2 /SSE 1 M2 2 /SSE 2 )] t intercept = (intercept 1 - intercept 2 ) / SE intercept.diff The Inverse Student-t Table Here is the table for the inverse two-tailed Student-t probability distribution function. The last row of the table contains values for the inverse normal probability distribution function. Degrees of Freedom α = 0.100 α = 0.050 α = 0.025 α = 0.010 1 6.314 12.706 25.452 63.657 2 2.920 4.303 6.205 9.925 3 2.353 3.182 4.177 5.841 4 2.132 2.776 3.495 4.604 5 2.015 2.571 3.163 4.032

Degrees of Freedom α = 0.100 α = 0.050 α = 0.025 α = 0.010 6 1.943 2.447 2.969 3.707 7 1.895 2.365 2.841 3.499 8 1.860 2.306 2.752 3.355 9 1.833 2.262 2.685 3.250 10 1.812 2.228 2.634 3.169 11 1.796 2.201 2.593 3.106 12 1.782 2.179 2.560 3.055 13 1.771 2.160 2.533 3.012 14 1.761 2.145 2.510 2.977 15 1.753 2.131 2.490 2.947 16 1.746 2.120 2.473 2.921 17 1.740 2.110 2.458 2.898 18 1.734 2.101 2.445 2.878 19 1.729 2.093 2.433 2.861 20 1.725 2.086 2.423 2.845 21 1.721 2.080 2.414 2.831 22 1.717 2.074 2.405 2.819 23 1.714 2.069 2.398 2.807 24 1.711 2.064 2.391 2.797 25 1.708 2.060 2.385 2.787 26 1.706 2.056 2.379 2.779 27 1.703 2.052 2.373 2.771 28 1.701 2.048 2.368 2.763 29 1.699 2.045 2.364 2.756 30 1.697 2.042 2.360 2.750 31 1.696 2.040 2.356 2.744 32 1.694 2.037 2.352 2.738 33 1.692 2.035 2.348 2.733 34 1.691 2.032 2.345 2.728 35 1.690 2.030 2.342 2.724 36 1.688 2.028 2.339 2.719 37 1.687 2.026 2.336 2.715 38 1.686 2.024 2.334 2.712 39 1.685 2.023 2.331 2.708 40 1.684 2.021 2.329 2.704 50 1.676 2.009 2.311 2.678 60 1.671 2.000 2.299 2.660 70 1.667 1.994 2.291 2.648 80 1.664 1.990 2.284 2.639 90 1.662 1.987 2.280 2.632

Degrees of Freedom α = 0.100 α = 0.050 α = 0.025 α = 0.010 100 1.660 1.984 2.276 2.626 Infinity 1.645 1.960 2.241 2.576 Memory Map R0= Intercept2 R1= Slope2 R2= SE slope2 R3= SSE1 R4= sum of x2 R5= sum of x2 squared R6= sum of y2 R7= sum of y2 squared R8= sum of x2 y2 R9= n2 SR0= Intercept1 SR1= Slope1 SR2= SE slope1 SR3= SSE1 SR4= sum of x1 SR5= sum of x1 squared SR6= sum of y1 SR7= sum of y1 squared SR8= sum of x1 y1 SR9= n1 RA= x mean, Sy.x RB= y mean, Sxx1 RC= Sxx, Sxx2 RD= Syy, std err of the difference between slopes RE= Sxy, used RI= used Source Code The source code for the program appears below. Please note the following: The blank lines are intentionally inserted to separate logical blocks of commands: Program Step LBL A Σ Comment add a data point from the first data set

Program Step LBL a Σ LBL B Σ LBL b Σ LBL 0 X^2 RCL 9 1 - LBL 1 MEAN X^2 STO E SDEV GSB 0 1/X RCL E RCL 9 1/X Comment remove a data point from the first data set add a data point from the second data set remove a data point from the second data set helper subroutine to calculate Sxx and Syy helper subroutine to calculate x.mean^2 / Sxx 1/n for either data set

Program Step LBL C MEAN STO A X<>Y STO B SDEV GSB 0 STO C X<>Y GSB 0 STO D MEAN RCL 9 CHS RCL 8 STO E RCL C / STO 1 R/S RCL A CHS RCL B STO 0 R/S RCL 1 RCL E RCL D / R/S RCL D Comment calculate linear regression coeffcients for 1st data sets calculate and store x mean calculate and store y mean calculate and store Sxx calculate and store Syy calculate and store Sxy calculate and store slope display slope calculate and store intercept display intercept display R-Sqr (value is not stored!)

Program Step RCL E RCL 1 STO 3 calculate and store SSE R/S display SSE RCL 9 2 / calculate MSE RCL C / SQRT STO 2 calculate and store SE slope R/S 0 -x- signal end of regression Comment LBL D GSB C LBL E RCL 3 RCL 3 RCL 9 RCL 9 4 / STO A SDEV GSB 0 calculate linear regression coeffcients for 2nd data sets compare slopes and intercepts get SSE2 get SSE1 get n1 get n2 calculate and store (Sy.x)^2

Program Step Comment STO B calculate and store Sxx1 SDEV GSB 0 STO C calculate and store Sxx2 RCL B 1/X RCL C 1/X RCL A SQRT STO D calculate and store std err of the difference between slopes 1/X RCL 1 get slope2 RCL 1 get slope1 R/S display student-t statistic for slope difference GSB 1 calculate x1.mean^2 / Sxx1 1/n1 ST I Store intermediate result in register I (using it as a regular register) GSB 1 calculate x2.mean^2 / Sxx2 1/n2 RC I Recall intermediate result from register I RCL A SQRT calculate pooled std dev for slopes 1/X RCL 0 get Intercept1 RCL 0 get Intercept2 calculate difference in slops multiply by 1/s<intercept1 - intercept2> R/S calculate and display student-t for slope difference

Program Step 0 -x- Comment Note: You can insert additional code in labels A, a, B, and b to transform the X and Y values before the Σ or Σ- command. Keep in mind that in such case, the regression results and other statistics are related to the transformed variables and not the original data.