# Chapter 1: Statistics - Radford University Chapter 3: Descriptive Analysis and Presentation of Bivariate Data Regression Plot Y = -2.31464 + 1.28722X R-Sq = 0.559 60 Weight 50 40 30 20 10 10 20 30 Height 40

50 Chapter Goals To be able to present bivariate data in tabular and graphic form. To gain an understanding of the distinction between the basic purposes of correlation analysis and regression analysis. To become familiar with the ideas of descriptive presentation. 3.1: Bivariate Data Bivariate Data: Consists of the values of two different response variables that are obtained from the same population of interest. Three combinations of variable types: 1. Both variables are qualitative (attribute). 2. One variable is qualitative (attribute) and the other is quantitative (numerical). 3. Both variables are quantitative (both numerical). Two Qualitative Variables: When bivariate data results from two qualitative (attribute or categorical) variables, the data is often arranged on a crosstabulation or contingency table. Example: A survey was conducted to investigate the relationship between preferences for television, radio, or newspaper for national news, and gender. The results are

given in the table below. Male Female TV 280 115 Radio 175 275 NP 305 170 This table may be extended to display the marginal totals (or marginals). The total of the marginal totals is the grand total. TV Radio NP Row Totals Male 280 175 305 760 Female

115 275 170 560 Col. Totals 395 450 475 1320 Contingency tables often show percentages (relative frequencies). These percentages are based on the entire sample or on the subsample (row or column) classifications. Percentages based on the grand total (entire sample): The previous contingency table may be converted to percentages of the grand total by dividing each frequency by the grand total and multiplying by 100. For example, 175 becomes 13.3% 175 100 13.3 1320 Male Female Col. Totals

TV 21.2 8.7 29.9 Radio 13.3 20.8 34.1 NP Row Totals 23.1 57.6 12.9 42.4 36.0 100.0 These same statistics (numerical values describing sample results) can be shown in a (side-by-side) bar graph. Percentages Based on Grand Total 25.0 Percentage 20.0 15.0

Male 10.0 Female 5.0 0.0 TV Radio Media NP Percentages based on row (column) totals: The entries in a contingency table may also be expressed as percentages of the row (column) totals by dividing each row (column) entry by that rows (columns) total and multiplying by 100. The entries in the contingency table below are expressed as percentages of the column totals. Male Female Col. Totals TV

70.9 29.1 100.0 Radio 38.9 61.1 100.0 NP Row Totals 64.2 57.6 35.8 42.4 100.0 100.0 These statistics may also be displayed in a side-by-side bar graph. One Qualitative and One Quantitative Variable: 1. When bivariate data results from one qualitative and one quantitative variable, the quantitative values are viewed as separate samples. 2. Each set is identified by levels of the qualitative variable. 3. Each sample is described using summary statistics, and the results are displayed for side-by-side comparison. 4. Statistics for comparison: measures of central tendency,

measures of variation, 5-number summary. 5. Graphs for comparison: dotplot, boxplot. Example: A random sample of households from three different parts of the country was obtained and their electric bill for June was recorded. The data is given in the table below. Northeast 23.75 40.50 33.65 31.25 42.55 50.60 37.70 31.55 38.85 21.25 Midwest 34.38 34.35 39.15 37.12 36.71 34.39 35.12 35.80

37.24 40.01 West 54.54 59.78 60.35 52.79 59.64 65.60 45.12 61.53 47.37 37.40 The part of the country is a qualitative variable with three levels of response. The electric bill is a quantitative variable. The electric bills may be compared with numerical and graphical techniques. Comparison using dotplots: . . : . . . . . . ---+---------+---------+---------+---------+---------+---Northeast .

:..:. .. ---+---------+---------+---------+---------+---------+---Midwest . . . . . . : . . ---+---------+---------+---------+---------+---------+---West 24.0 32.0 40.0 48.0 56.0 64.0 The electric bills in the Northeast tend to be more spread out than those in the Midwest. The bills in the West tend to be higher than both those in the Northeast and Midwest. Comparison using Box-and-Whisker plots: 70 Electric Bill 60 50

40 30 20 Northeast Midwest West Two Quantitative Variables: 1. Expressed as ordered pairs: (x, y) 2. x: input variable, independent variable. y: output variable, dependent variable. Scatter Diagram: A plot of all the ordered pairs of bivariate data on a coordinate axis system. The input variable x is plotted on the horizontal axis, and the output variable y is plotted on the vertical axis. Note: Use scales so that the range of the y-values is equal to or slightly less than the range of the x-values. This creates a window that is approximately square. Example: In a study involving childrens fear related to being hospitalized, the age and the score each child made on the Child Medical Fear Scale (CMFS) are given in the table below. Age (x ) CMFS (y )

8 9 9 10 11 9 8 9 8 11 31 25 40 27 35 29 25 34 44 19 Age (x ) CMFS (y ) 7 6 6 8 9 12 15 28 47 42 37 35 16 12 Construct a scatter diagram for this data. 13 10 10 23 26 36 Scatter diagram: age = input variable, CMFS = output variable Child Medical Fear Scale

50 CMFS 40 30 20 10 6 7 8 9 10 11 Age 12 13

14 15 3.2: Linear Correlation Measure the strength of a linear relationship between two variables. As x increases, no definite shift in y: no correlation. As x increase, a definite shift in y: correlation. Positive correlation: x increases, y increases. Negative correlation: x increases, y decreases. If the ordered pairs follow a straight-line path: linear correlation. Example: no correlation. As x increases, there is no definite shift in y. Output 55 45 35 10 20

Input 30 Example: positive correlation. As x increases, y also increases. 60 Output 50 40 30 20 10 15 20 25 30

35 Input 40 45 50 55 Example: negative correlation. As x increases, y decreases. 95 Output 85 75 65 55 10 15

20 25 30 35 Input 40 45 50 55 Note: 1. Perfect positive correlation: all the points lie along a line with positive slope. 2. Perfect negative correlation: all the points lie along a line with negative slope. 3. If the points lie along a horizontal or vertical line: no correlation. 4. If the points exhibit some other nonlinear pattern: no linear relationship, no correlation.

5. Need some way to measure correlation. Coefficient of linear correlation: r, measures the strength of the linear relationship between two variables. Pearsons product moment formula: (x r x )( y y ) (n 1) sx s y Note: 1. 1 r 1 2. r = +1: perfect positive correlation 3. r = -1 : perfect negative correlation Alternate formula for r: r SS( xy ) SS( x )SS( y ) SS( x ) sum of squares for x 2 x

x 2 n SS( y ) sum of squares for y y 2 y 2 n SS( xy ) sum of squares for xy x y

xy n Example: The table below presents the weight (in thousands of pounds) x and the gasoline mileage (miles per gallon) y for ten different automobiles. Find the linear correlation coefficient. y y2 xy x2 x 2.5 40 6.25 1600 100.0 3.0 43 9.00 1849 129.0 4.0 30 16.00 900 120.0

3.5 35 12.25 1225 122.5 2.7 42 7.29 1764 113.4 4.5 19 20.25 361 85.5 3.8 32 14.44 1024 121.6 2.9 39 8.41 1521 113.1 5.0 15 25.00

225 75.0 2.2 14 4.84 196 30.8 Sum 34.1 309 123.73 10665 1010.9 2 2 y y x x xy To complete the calculation for r: SS( x ) x

2 x 2 y 2 SS( y ) y n 2 SS( xy ) xy n (34.1) 2 123.73 7.449 10 (309) 2

10665 1116.9 10 x y 1010.9 (34.1)(309) 42.79 n 10 SS( xy ) 42.79 r .47 SS( x )SS( y ) ( 7.449)(1116.9) Note: 1. r is usually rounded to the nearest hundredth. 2. r close to 0: little or no linear correlation. 3. As the magnitude of r increases, towards -1 or +1, there is an increasingly stronger linear correlation between the two variables. 4. Method of estimating r based on the scatter diagram. Window should be approximately square. Useful for checking calculations. 3.3: Linear Regression

Regression analysis finds the equation of the line that best describes the relationship between two variables. One use of this equation: to make predictions. Models or prediction equations: Some examples of various possible relationships. Linear: y b0 b1 x Quadratic: y a bx cx 2 Exponential: y a (b x ) Logarithmic: y a logb x Note: What would a scatter diagram look like to suggest each relationship? Method of least squares:

Equation of the best-fitting line: y b0 b1 x Predicted value: y Least squares criterion: Find the constants b0 and b1 such that the sum 2 2 ( y y ) ( y ( b b x )) 0 1

is as small as possible. Observed and predicted values of y: y y b0 b1 x ( x, y) y y ( x , y) y y x The equation of the line of best fit: Determined by b0: slope b1: y-intercept Values that satisfy the least squares criterion: ( x x )( y y ) SS( xy ) b1 2

SS( x ) ( x x) y b1 x b0 y (b1 x) n Example: A recent article measured the job satisfaction of subjects with a 14-question survey. The data below represents the job satisfaction scores, y, and the salaries, x, for a sample of similar individuals. x y 31 17 33 20 22 13 24 15 35

18 1. Draw a scatter diagram for this data. 2. Find the equation of the line of best fit. 29 17 23 12 37 21 Preliminary calculations needed to find b1 and b0: x y x2 xy 23 31 33 22 24

35 29 37 234 12 17 20 13 15 18 17 21 133 529 961 1089 484 576 1225 841 1369 7074 276 527 660

286 360 630 493 777 4009 x y 2 x xy Finding b1 and b0: SS( x ) x 2 x n SS( xy )

2 234 2 7074 229.5 8 x y (234)(133) xy 4009 118.75 n 8 SS( xy ) 118.75 b1 .5174 SS( x )

229.5 b0 y b1 x 133 (.5174)(234) 14902 . n Equation of the line of best fit: y 149 . .517 x 8 Scatter diagram: 22 21 20 Job Satisfaction 19 18 17 16

15 14 13 12 21 23 25 27 29 Salary 31 33 35 37 Note: 1. Keep at least three extra decimal places while doing the calculations to ensure an accurate answer. 2. When rounding off the calculated values of b0 and b1,

always keep at least two significant digits in the final answer. 3. The slope b1 represents the predicted change in y per unit increase in x. 4. The y-intercept is the value of y where the line of best fit intersects the y-axis. 5. The line of best fit will always pass through the point ( x, y) Making predictions: 1. One of the main purposes for obtaining a regression equation is for making predictions. 2. For a given value of x, we can predict a value of y, ( y) 3. The regression equation should be used to make predictions only about the population from which the sample was drawn. 4. The regression equation should be used only to cover the sample domain on the input variable. You can estimate values outside the domain interval, but use caution and use values close to the domain interval. 5. Use current data. A sample taken in 1987 should not be used to make predictions in 1999.