420 likes | 643 Views
Correlation and Simple Linear Regression. Correlation Analysis. Correlation analysis is used to describe the degree to which one variable is linearly related to another. There are two measures for describing correlation: The Coefficient of Correlation The Coefficient of Determination.
E N D
Correlation and Simple Linear Regression
Correlation Analysis • Correlation analysis is used to describe • the degree to which one variable is • linearly related to another. • There are two measures for describing • correlation: • The Coefficient of Correlation • The Coefficient of Determination
Correlation The correlationbetween two random variables, X and Y, is a measure of the degree of linear associationbetween the two variables. The population correlation, denoted by, can take on any value from -1 to 1. indicates a perfect negative linear relationship -1 < < 0 indicates a negative linear relationship indicates no linear relationship 0 < < 1 indicates a positive linear relationship indicates a perfect positive linear relationship The absolute value of indicates the strength or exactness of the relationship.
Y Y Y = -1 = 0 = 1 X X X Y Y Y = -.8 = 0 = .8 X X X Illustrations of Correlation
The coefficient of correlation: Sample Coefficient of Determination
The Coefficient of Correlation or Karl Pearson’s Coefficient of Correlation The coefficient of correlation is the square root of the coefficient of determination. The sign of r indicates the direction of the relationship between the two variables X and Y.
Simple Linear Regression • Regressionrefers to the statistical technique of modeling the relationship between variables. • Insimple linearregression, we model the relationship between two variables. • One of the variables, denoted by Y, is called thedependent variable and the other, denoted by X, is called theindependent variable. • The model we will use to depict the relationship between X and Y will be astraight-line relationship. • Agraphical sketch of the pairs (X, Y) is called ascatter plot.
This scatterplotlocates pairs of observations of advertising expenditures on the x-axis and sales on the y-axis. We notice that: • Larger (smaller) values of sales tend to be associated with larger (smaller) values of advertising. S c a t t e r p l o t o f A d v e r t i s i n g E x p e n d i t u r e s ( X ) a n d S a l e s ( Y ) 1 4 0 1 2 0 1 0 0 s 8 0 e l a S 6 0 4 0 2 0 0 0 1 0 2 0 3 0 4 0 5 0 A d v e r t i s i n g • The scatter of points tends to be distributed around a positively sloped straight line. • The pairs of values of advertising expenditures and sales are not located exactly on a straight line. • The scatter plot reveals a more or less strong tendency rather than a precise linear relationship. • The line represents the nature of the relationship on average. Using Statistics
0 0 Y Y Y 0 0 0 X X Y Y Y X X X Examples of Other Scatterplots X
Simple Linear Regression Model • The equation that describes how y is related to x and • an error term is called the regression model. • The simple linear regression model is: y = a+ bx +e where: • a and b are called parameters of the model, • a is the intercept and b is the slope. • e is a random variable called the error term.
The relationship between X and Y is a straight-line relationship. The errors i are normally distributed with mean 0 and variance 2. The errors are uncorrelated (not related) in successive observations. That is: ~ N(0,2) Assumptions of the Simple Linear Regression Model Y E[Y]=0 + 1 X Identical normal distributions of errors, all centered on the regression line. X Assumptions of the Simple Linear Regression Model
Errors in Regression Y . { X Xi
SIMPLE REGRESSION AND CORRELATION Estimating Using the Regression Line First, lets look at the equation of a straight line is: Independent variable Dependent variable Slope of the line Y-intercept
SIMPLE REGRESSION AND CORRELATION The Method of Least Squares To estimate the straight line we have to use the least squares method. This method minimizes the sum of squares of error between the estimated points on the line and the actual observed points. The sign of r will be the same as the sign of the coefficient “b” in the regression equation Y = a + b X Alternate Formula (using Regression Coefficients)
SIMPLE REGRESSION AND CORRELATION The estimating line Slope of the best-fitting Regression Line Y-intercept of the Best-fitting Regression Line
SIMPLE REGRESSION - EXAMPLE Suppose an appliance store conducts a five-month experiment to determine the effect of advertising on sales revenue. The results are shown below. (File PPT_Regr_example.sav) Advertising Exp.($100s)Sales Rev.($1000S) 11 21 32 42 54
SIMPLE REGRESSION - EXAMPLE XYX2XY 11 11 2 1 4 2 3 29 6 4216 8 54 2520
SIMPLE REGRESSION - EXAMPLE b = 0.7
Sample Coefficient of Determination Interpretation: Percentage of total variation explained by the regression. We can conclude that 81.67 % of the variation in the sales revenues is explain by the variation in advertising expenditure.
SIMPLE REGRESSION AND CORRELATION :- r is the positive square root :- r is the negative square root If the slope of the estimating line is positive If the slope of the estimating line is negative The relationship between the two variables is direct
Steps in Hypothesis Testing using SPSS • State the null and alternative hypotheses • Define the level of significance (α) • Calculate the actual significance : p-value • Make decision : Reject null hypothesis, if p≤ α, for 2-tail test; and if p*≤ α, for 1-tail test.(p* is p/2 when p is obtained from 2-tail test) • Conclusion
H0: = 0 (No significant linear relationship) H1: 0 (Linear relationship is significant) Test Statistic: Hypothesis Tests for the Correlation Coefficient Use p-value for decision making.
Standard Error of Estimate The standard error of estimate is used to measure the reliability of the estimating equation. It measures the variability or scatter of the observed values around the regression line.
Standard Error of Estimate Standard Error of Estimate Alternately
Standard Error of Estimate Y2 1 1 4 4 16
Analysis-of-Variance Table and an F Test of the Regression Model H0 : The regression model is not significant H1 : The regression model is significant
Test Statistic Value of the test statistic: The p-value is 0.035 Conclusion: There is sufficient evidence to reject the null hypothesis in favor of the alternative hypothesis. b is not equal to zero. Thus, the independent variable is linearly related to y. This linear regression model is valid
Testing for the existence of linear relationship • We test the hypothesis: H0: b = 0 (the independent variable is not a significant predictor of the dependent variable) H1: b is not equal to zero (the independent variable is a significant predictor of the dependent variable). • If b is not equal to zero (if the null hypothesis is rejected), we can conclude that the Independent variable contributes significantly in predicting the Dependent variable. Test statistic, with n-2 degrees of freedom:
Test statistic, with n-2 degrees of freedom: Rejection Region Value of the test statistic: Conclusion: The calculated test statistic is 3.66 which is outside the acceptance region. Alternately, the actual significance is 0.035. Therefore we will reject the null hypothesis. The advertising expenses is a significant explanatory variable.
Example The sales and advertising data for brass door hinges, for the past five months, are given by the marketing manager in the table below. The marketing manager says that next month the company will spend $1,750 on advertising for the product. Use linear regression to develop an equation and a forecast for this product.
a = Y – bX Causal MethodsLinear Regression Sales (Y) Advertising (X) Month (000 units) (000 $) 1 264 2.5 2 116 1.3 3 165 1.4 4 101 1.0 5 209 2.0
Sales, Y Advertising, X Month (000 units) (000 $) XYX 2Y 2 1 264 2.5 660.0 6.25 69,696 2 116 1.3 150.8 1.69 13,456 3 165 1.4 231.0 1.96 27,225 4 101 1.0 101.0 1.00 10,201 5 209 2.0 418.0 4.00 43,681 Total 855 8.2 1560.8 14.90 164,259 Y = 171 X = 1.64 a = – 8.136 b = 109.229 Y = – 8.136 + 109.229(X) Causal MethodsLinear Regression
Sales, Y Advertising, X Month (000 units) (000 $) XYX 2Y 2 1 264 2.5 660.0 6.25 69,696 2 116 1.3 150.8 1.69 13,456 3 165 1.4 231.0 1.96 27,225 4 101 1.0 101.0 1.00 10,201 5 209 2.0 418.0 4.00 43,681 Total 855 8.2 1560.8 14.90 164,259 Y = 171 X = 1.64 nXY – X Y [nX 2 – (X) 2][nY 2 – (Y) 2] r = Causal MethodsLinear Regression =0.98
The sales of Jensen Foods, a small grocery chain located in southwest Texas, since 2005 are: Linear Trend – Using the Least Squares Method: An Example
Nonlinear Trends (File:PPT_Log_Regr) • A linear trend equation is used when the data are increasing (or decreasing) by equal amounts • A nonlinear trend equation is used when the data are increasing (or decreasing) by increasing amounts over time • When data increase (or decrease) by equal percents or proportions plot will show curvilinear pattern • Consider the sales data for Gulf Shores Importers, as shown in the next slide. • Top graph is original data • Consider log(sales) as the log base 10 of the original data which is now is linear • Using SPSS or Data Analysis in Excel, generate the linear equation • Regression output shown in subsequent slide
Log Trend Equation – Gulf Shores Importers Example Year Sales Code Log(Sales) 1995 124 1 2.09 1996 176 2 2.24 1997 307 3 2.49 1998 524 4 2.72 1999 714 5 2.85 2000 1052 6 3.02 2001 1638 7 3.21 2002 2403 8 3.38 2003 3358 9 3.53 2004 4181 10 3.62 2005 5389 11 3.73 2006 8027 12 3.90 2007 10587 13 4.02 2008 13537 14 4.13 2009 17516 15 4.24
Log Trend Equation – Gulf Shores Importers Example – SPSS output