33851 - Correlation & Regression Dr. Moataza Mahmoud...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Correlation & Regression Dr. Moataza Mahmoud Abdel Wahab Lecturer of Biostatistics High Institute of Public Health University of Alexandria Correlation Finding the relationship between two quantitative variables without being able to infer causal relationships Correlation is a statistical technique used to determine the degree to which two variables are related Scatter diagram Rectangular coordinate Two quantitative variables One variable is called independent (X) and the second is called dependent (Y) Points are not joined No frequency table Example SBP(mmHg) 220 200 180 160 140 120 100 80 60 70 80 90 100 110 120 wt (kg) Scatter diagram of weight and systolic blood pressure SBP (mmHg) 220 200 180 160 140 120 100 80 60 70 80 90 100 110 Wt (kg) 120 Scatter diagram of weight and systolic blood pressure Scatter plots The pattern of data is indicative of the type of relationship between your two variables: positive relationship negative relationship no relationship Positive relationship 18 16 14 12 Height in CM 10 8 6 4 2 0 0 10 20 30 40 50 60 70 80 90 Age in Weeks Negative relationship Reliability Age of Car No relation Correlation Coefficient Statistic showing the degree of relation between two variables Simple Correlation coefficient (r) It is also called Pearson's correlation or product moment correlation coefficient. It measures the nature and strength between two variables of the quantitative type. The sign of r denotes the nature of association while the value of r denotes the strength of association. If the sign is +ve this means the relation is direct (an increase in one variable is associated with an increase in the other variable and a decrease in one variable is associated with a decrease in the other variable). While if the sign is -ve this means an inverse or indirect relationship (which means an increase in one variable is associated with a decrease in the other). The value of r ranges between ( -1) and ( +1) The value of r denotes the strength of the association as illustrated by the following diagram. strong intermediate weak weak intermediate strong 1perfect correlation -0.75 -0.25 0 0.25 0.75 1 perfect correlation indirect no relation Direct If r = Zero this means no association or correlation between the two variables. If 0 < r < 0.25 = weak correlation. If 0.25 r < 0.75 = intermediate correlation. If 0.75 r < 1 = strong correlation. If r = l = perfect correlation. How to compute the simple correlation )coefficient (r r= x y xy - 2 2 ( x) ( y) 2 2 x - . y - n n n :Example A sample of 6 children was selected, data about their age in years and weight in kilograms was recorded as shown in the following table . It is required to find the correlation between age and weight. serial No 1 2 3 4 5 6 Age )(years 7 6 8 5 6 9 Weight )(Kg 12 8 12 10 11 13 These 2 variables are of the quantitative type, one variable (Age) is called the independent and denoted as (X) variable and the other (weight) is called the dependent and denoted as (Y) variables to find the relation between age and weight compute the simple correlation coefficient using the following formula: xy - ( 2 x) 2 - x n x y ( 2 y) 2 . - y n n r = Serial .n 1 2 3 4 5 6 Total Age )(years (x) 7 6 8 5 6 9 =x 41 Weight )(Kg (y) 12 8 12 10 11 13 =y 66 xy 84 48 96 50 66 117 xy= 461 X2 49 36 64 25 36 81 =x2 291 Y2 144 64 144 100 121 169 =y2 742 r= 41 66 461 - 6 (41) 2 (66) 2 291 - .742 - 6 6 r = 0.759 strong direct correlation EXAMPLE: Relationship between Anxiety and Test Scores Anxiety )X( Test )score (Y X2 Y2 XY 10 8 2 1 5 6 X = 32 2 100 4 20 3 64 9 24 9 4 81 18 7 1 49 7 6 25 36 30 5 36 25 30 Y = 32 X2 = 230 Y2 = 204 XY=129 Calculating Correlation Coefficient r= (6(230) - 32 )(6(204) - 32 ) 2 2 (6)(129) - (32)(32) 774 -1024 = = -.94 (356)(200) r = - 0.94 Indirect strong correlation Spearman Rank Correlation Coefficient (rs) It is a non-parametric measure of correlation. This procedure makes use of the two sets of ranks that may be assigned to the sample values of x and Y. Spearman Rank correlation coefficient could be computed in the following cases: Both variables are quantitative. Both variables are qualitative ordinal. One variable is quantitative and the other is qualitative ordinal. :Procedure 1. 2. 3. 4. Rank the values of X from 1 to n where n is the numbers of pairs of values of X and Y in the sample. Rank the values of Y from 1 to n. Compute the value of di for each pair of observation by subtracting the rank of Yi from the rank of Xi Square each di and compute di2 which is the sum of the squared values. 5. Apply the following formula 6(di) rs = 1 - n(n 2 - 1) 2 The value of rs denotes the magnitude and nature of association giving the same interpretation as simple r. Example In a study of the relationship between level education and income the following data was obtained. Find the relationship between them and comment. sample numbers A B C D E F G level education )(X Preparatory. Primary. University. secondary secondary illiterate University. Income )(Y 25 10 8 10 15 50 60 Answer: (X) A B C D E F G Preparatory Primary. University. secondary secondary illiterate university. (Y) 25 10 8 10 15 50 60 Rank X 5 6 1.5 3.5 3.5 7 1.5 Rank Y 3 5.5 7 5.5 4 2 1 di 2 0.5 -5.5 -2 -0.5 5 0.5 di2 4 0.25 30.25 4 0.25 25 0.25 di2=64 6 64 rs = 1 - = -0.1 7(48) Comment: There is an indirect weak correlation between level of education and income. exercise Regression Analyses Regression: technique concerned with predicting some variables by knowing others The process of predicting variable Y using variable X Regression Uses a variable (x) to predict some outcome variable (y) Tells you how values in y change as a function of changes in values of x Correlation and Regression Correlation describes the strength of a linear relationship between two variables Linear means "straight line" Regression tells us how to draw the straight line described by the correlation Regression Calculates the "best-fit" line for a certain set of data The regression line makes the sum of the squares of the residuals smaller than for any other line Regression minimizes residuals SBP(mmHg) 220 200 180 160 140 120 100 80 60 70 80 90 100 110 Wt (kg) 120 By using the least squares method (a procedure that minimizes the vertical deviations of plotted points surrounding a straight line) we are able to construct a best fitting straight line to the scatter diagram points and then formulate a regression equation in the form of: ^ y = a + bX ^ y = y + b(x - x) b1 = b x y xy - n x2 ( 2 x) - n Regression Equation Regression equation describes the regression line mathematically Intercept Slope SBP(mmHg) 220 200 180 160 140 120 100 80 60 70 80 90 100 110 Wt (kg) 120 Linear Equations Y ^ y == baX ++ bX Y a b = S lo p e C h a n g e in X a = Y -in te r c e p t Change in Y X Hours studying and grades Regressing grades on hours Linear Regression Final grade in course 90.00 Final grade in co urse = 5 9.9 5 + 3.17 * st udy R-Square = 0.8 8 8 0.00 7 0.00 2.00 4.00 6.00 8 .00 10.00 Number of hours spent st udying Predicted final grade in class = 59.95 + 3.17*(number of hours you study per week) Predicted final grade in class = 59.95 + 3.17*(hours of study) ...Predict the final grade of Someone who studies for 12 hours Final grade = 59.95 + (3.17*12) Final grade = 97.99 Someone who studies for 1 hour: Final grade = 59.95 + (3.17*1) Final grade = 63.12 Exercise A sample of 6 persons was selected the value of their age ( x variable) and their weight is demonstrated in the following table. Find the regression equation and what is the predicted weight when age is 8.5 years. .Serial no 1 2 3 4 5 6 )Age (x 7 6 8 5 6 9 )Weight (y 12 8 12 10 11 13 Answer .Serial no )Age (x )Weight (y 1 2 3 4 5 6 Total 7 6 8 5 6 9 41 12 8 12 10 11 13 66 xy 84 48 96 50 66 117 461 X2 49 36 64 25 36 81 291 Y2 144 64 144 100 121 169 742 41 x= = 6.83 6 41 66 461 - 6 b= = 0.92 2 (41) 291 - 6 Regression equation 66 y= = 11 6 ^ y (x) = 11 + 0.9(x - 6.83) ^ y (x) = 4.675 + 0.92x ^ y (8.5) = 4.675 + 0.92 * 8.5 = 12.50Kg ^ y (7.5) = 4.675 + 0.92 * 7.5 = 11.58Kg 12.6 12.4 12.2 12 11.8 11.6 11.4 7 7.5 8 Age (in years) 8.5 9 we create a regression line by plotting two estimated values for y against their X component, then extending the line right and left. Weight (in Kg) Exercise 2 Age B.P Age B.P )(x )(y )(x )(y 20 43 63 26 53 31 58 46 58 70 120 128 141 126 134 128 136 132 140 144 46 53 60 20 63 43 26 19 31 23 128 136 146 124 143 130 124 121 126 123 The following are the age (in years) and systolic blood pressure of 20 apparently healthy adults. Find the correlation between age and blood pressure using simple and Spearman's correlation coefficients, and comment. Find the regression equation? What is the predicted blood pressure for a man aging 25 years? Serial 1 2 3 4 5 6 7 8 9 10 x 20 43 63 26 53 31 58 46 58 70 y 120 128 141 126 134 128 136 132 140 144 xy 2400 5504 8883 3276 7102 3968 7888 6072 8120 10080 x2 400 1849 3969 676 2809 961 3364 2116 3364 4900 Serial 11 12 13 14 15 16 17 18 19 20 Total x 46 53 60 20 63 43 26 19 31 23 852 y 128 136 146 124 143 130 124 121 126 123 2630 xy 5888 7208 8760 2480 9009 5590 3224 2299 3906 2829 114486 x2 2116 2809 3600 400 3969 1849 676 361 961 529 41678 b1 = n ( x) 2 x2 - n x y xy - = 852 2630 114486 - 20 = 0.4547 2 852 41678 - 20 ^ y for age 25 =112.13 + 0.4547 x B.P = 112.13 + 0.4547 * 25=123.49 = 123.5 mm hg Multiple Regression Multiple regression analysis is a straightforward extension of simple regression analysis which allows more than one independent variable. ...
View Full Document

This note was uploaded on 02/23/2012 for the course STAT 312 taught by Professor Staff during the Fall '11 term at Rutgers.

Ask a homework question - tutors are online