correlation and regression dr. ghada abo-zaid

94
CORRELATION AND REGRESSION DR. GHADA ABO-ZAID Correlation and regression

Upload: basil-bird

Post on 04-Jan-2016

28 views

Category:

Documents


5 download

DESCRIPTION

Correlation and regression Dr. Ghada Abo-Zaid. Correlation and regression. Outline. Once you have finished studying this chapter, you will be able to: Draw a scatter diagram, and explain the relationship between two variables from the plot. Understand the definition of covariance. - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Correlation and regression Dr.  Ghada Abo-Zaid

CORRELATION AND REGRESSION

DR. GHADA ABO-ZAID

Correlation and regression

Page 2: Correlation and regression Dr.  Ghada Abo-Zaid

Outline

Once you have finished studying this chapter, you will be able to:

Draw a scatter diagram, and explain the relationship between two variables from the plot.

Understand the definition of covariance. Calculate the covariance, and interpret the

results. Calculate the coefficient of correlation and

interpret the results. Clarify the difference between the covariance

and correlation.

Page 3: Correlation and regression Dr.  Ghada Abo-Zaid

Identify the assumptions and limitations of correlation coefficient.

Test the hypothesis of coefficient of correlation. Understand the definition of Spearman's rank

correlation coefficient. Calculate Spearman's rank correlation

coefficient and interpret the results. Identify the difference between the correlation

coefficient and Spearman's rank correlation coefficient.

Test the hypothesis of Spearman's rank correlation coefficient.

Outline

Page 4: Correlation and regression Dr.  Ghada Abo-Zaid

Scatter Plot

Exploring the dataset before starting any statistical analysis is considered currently as one of the most important steps in the statistical analysis, especially in social science research.

A scatter plot or scatter diagram might be used for examining initially whether there is an association between two variables, and shows the direction of this association.

Page 5: Correlation and regression Dr.  Ghada Abo-Zaid

Possible scatter plots association between X and Y variables.

Page 6: Correlation and regression Dr.  Ghada Abo-Zaid

Negative association

Page 7: Correlation and regression Dr.  Ghada Abo-Zaid

No association and non-linear association

Page 8: Correlation and regression Dr.  Ghada Abo-Zaid

Covariance

Basically, covariance is used for detecting the direction of an association between two random variables.

If the two variables are moved at the same direction, it is named as a positive covariance.

If the two variables are moved at the reverse directions, it is named as a negative covariance.

Page 9: Correlation and regression Dr.  Ghada Abo-Zaid

Covariance

In other words, A covariance is a positive or a negative single number that help in detecting the association between two variables by its sign. For example if the single number is minus, this refers to an indirect association between two variables and vice versa.

Covariance is denoted as Cov (X,Y).

Page 10: Correlation and regression Dr.  Ghada Abo-Zaid

Sampling Covariance

The sample covariance between X and Y is defined by two formulas:

Second: Short calculation formula

where and are the sampling means for X and Y respectively.

Page 11: Correlation and regression Dr.  Ghada Abo-Zaid

Example

In the stock market, the interest of the analyst is to select stocks that:

a) reduce the risk taken for the same amount of return.

b) select the stocks that are working well together.

Table 4.1 shows the daily returns for two stocks using the closing prices, say NSGB bank, , and Sidi krier petroleum, , in 2014, for a sequence of 10 days.

Page 12: Correlation and regression Dr.  Ghada Abo-Zaid

Table 4.1: Gives the daily returns for two stocks using the closing prices.

Calculate the covariance between X and Y by using

a) Long calculation formulab) Short calculation formula

Page 13: Correlation and regression Dr.  Ghada Abo-Zaid

Short calculation formula

Page 14: Correlation and regression Dr.  Ghada Abo-Zaid

Short calculation formula

Page 15: Correlation and regression Dr.  Ghada Abo-Zaid

Short calculation formula

Interpretation: The result indicates to a positive relationship between the two variables (return of the two stocks) X and Y.

Page 16: Correlation and regression Dr.  Ghada Abo-Zaid

Correlation

Though a covariance measure gives the direct association between two variables, it is still not capable of measuring the size or strength of an association.

A correlation is a statistical measure that determines the strength of an association between two variables and detect their direction.

It is also named as Pearson's correlation coefficient in honour of Karl Person (1857 -1936)

Page 17: Correlation and regression Dr.  Ghada Abo-Zaid

Short calculation formula

Page 18: Correlation and regression Dr.  Ghada Abo-Zaid

Note that the coefficient of correlation lies between +1 and -1.

if r = +1 this indicates a perfect positive correlation between X and Y.

if r = -1 , this indicates a perfect negative association between X and Y.

If r = 0 , this is an indicator of no correlation between X and Y.

Page 19: Correlation and regression Dr.  Ghada Abo-Zaid

Assumptions of Person's Correlation

The variables X and Y must be continuous random variables.

The data for X and Y variables must tend to a normal distribution ( bell shape).

Page 20: Correlation and regression Dr.  Ghada Abo-Zaid

Example

A sample of 8 students was selected randomly to examine the association between the number of hours a student spent studying for an exam (X) and the score that a student obtained on that exam (Y). The data are given below

Page 21: Correlation and regression Dr.  Ghada Abo-Zaid

Example

Find the linear correlation coefficient between the number of hours a student spent in studying and the score a student obtained in the exam, and interpret the result.

Page 22: Correlation and regression Dr.  Ghada Abo-Zaid

Solution by using short calculation formula

Page 23: Correlation and regression Dr.  Ghada Abo-Zaid

Solution by using short calculation formula

Page 24: Correlation and regression Dr.  Ghada Abo-Zaid

Solution by using short calculation formula

Page 25: Correlation and regression Dr.  Ghada Abo-Zaid

Solution by using short calculation formula

Interpretation: This indicates there is a very strong positive association between the number of hours a student spent in studying and the number of the score on the exam.

Interpretation: This means that the more hours a student spent in studying, the better score he or she will obtain.

Page 26: Correlation and regression Dr.  Ghada Abo-Zaid

Hypothesis Test for a Linear Correlation Coefficient

Hypothesis test for a linear correlation coefficient is basically used to detect whether the sample correlation coefficient r is the estimator of population correlation coefficient r (rho) or not by using the Student t distribution.

The student t statistic formula is given below:

which is distributed as with degree of freedom

Page 27: Correlation and regression Dr.  Ghada Abo-Zaid

listed the steps of the hypothesis t- test for a linear correlation coefficient

Page 28: Correlation and regression Dr.  Ghada Abo-Zaid

the steps of the hypothesis t- test for a linear correlation coefficient

Page 29: Correlation and regression Dr.  Ghada Abo-Zaid

Example

A sample of 7 observations was taken randomly to examine the association between the income per thousand pounds, X, and the number of breads con

consumed for person per day, Y

Page 30: Correlation and regression Dr.  Ghada Abo-Zaid

Example

Find the linear correlation coefficient between X and Y and interpret the result

Test the significant of the linear correlation coefficient at significant level, , equals 5%

Page 31: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Find the linear correlation coefficient between X and Y and interpret the result

Page 32: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Page 33: Correlation and regression Dr.  Ghada Abo-Zaid

Interpretation: This indicates there is a very strong negative association between the income and the number of bread consumed for person. This means that the more income a person earns the less money spent on bread.

Page 34: Correlation and regression Dr.  Ghada Abo-Zaid

Test the significant of the linear correlation coefficient at significant level, , equals 5% Step 1: Let

Step 2 :

Page 35: Correlation and regression Dr.  Ghada Abo-Zaid

Test the significant of the linear correlation coefficient at significant level, , equals 5%

Page 36: Correlation and regression Dr.  Ghada Abo-Zaid

Test the significant of the linear correlation coefficient at significant level, , equals 5%

We conclude that there is a sufficient evidence to support that there is a linear correlation coefficient between the two variables.

Page 37: Correlation and regression Dr.  Ghada Abo-Zaid

Rank Correlation

Coefficient of correlation is used to measure the association between two variables, but this is under certain conditions.

One of these conditions is that X and Y random variables should be continuous.

In addition, the data of X and Y variables are underlying the normal distribution.

What happen if one of those conditions is not achieved?

Page 38: Correlation and regression Dr.  Ghada Abo-Zaid

Rank Correlation

this basically lead to think of another measure of correlation called rank correlation coefficient

It is also named as Spearman's rank correlation coefficient.

Spearman's rank correlation coefficient, is a non-parametric statistics measure that is equivalent to Pearson's correlation coefficient, r.

Page 39: Correlation and regression Dr.  Ghada Abo-Zaid

It is also undertaken to measure the association between two variables, even if these variables do not underlying normal distribution or they are not continuous variables.

Spearman's Rank correlation coefficient is undertaken if the data are in orders or can be ranked in orders.

Page 40: Correlation and regression Dr.  Ghada Abo-Zaid

Rank Correlation

The formula of Spearman's Rank correlation coefficient, is given as:

Page 41: Correlation and regression Dr.  Ghada Abo-Zaid

Steps for calculating Spearman's Rank Correlation Coefficient

Page 42: Correlation and regression Dr.  Ghada Abo-Zaid

Steps for calculating Spearman's Rank Correlation Coefficient

Page 43: Correlation and regression Dr.  Ghada Abo-Zaid

Example

The following table gives the grades of 8 students in linear algebra course , X, and probability course, Y

where : E , V.G, G, and P are excellent, very good, good, and pass respectively. Find the correlation between X and Y.

Page 44: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Page 45: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Interpretation: This indicates that there is a moderate positive association between the evaluation grades of linear algebra and probability course.

Page 46: Correlation and regression Dr.  Ghada Abo-Zaid

Hypothesis Significant test of Spearman's Rank Correlation Coefficient Hypothesis test is also undertaken for a

Spearman's Rank Correlation Coefficient to detect whether the sample rank correlation coefficient is an estimator of population correlation coefficient r (rho) or not by using the Student t distribution.

Page 47: Correlation and regression Dr.  Ghada Abo-Zaid

the steps of the hypothesis t- test for Spearman's Rank Correlation Coefficient

Page 48: Correlation and regression Dr.  Ghada Abo-Zaid

the steps of the hypothesis t- test for Spearman's Rank Correlation Coefficient

Page 49: Correlation and regression Dr.  Ghada Abo-Zaid

Example

In the previous Example test the significance of Spearman's Rank Correlation Coefficient

Page 50: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Page 51: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Page 52: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Page 53: Correlation and regression Dr.  Ghada Abo-Zaid

SIMPLE REGRESSION ANALYSIS

Page 54: Correlation and regression Dr.  Ghada Abo-Zaid

Outlines

Goals of chapter five simple linear regression analysis

Once you have finished studying this chapter, you will be able to:

Identify the difference between the dependent and independent variable.

Fit simple linear egression model and interpret the results.

Understand the assumption of simple linear regression model.

know the BLUE method and the advantage of this method for estimating the unknown parameters of simple linear regression model.

Page 55: Correlation and regression Dr.  Ghada Abo-Zaid

Outlines

Assessing the best fitted simple linear regression model.

Construct ANOVA table and calculate F-value.

Understand hypothesis tests of individual regression coefficients.

Calculate the coefficient of determination and interpret the result.

Page 56: Correlation and regression Dr.  Ghada Abo-Zaid

Simple Regression Analysis The Correlation coefficient is a statistics

measure that examines an association between two variables and determine the direction and the strength of there relation.

However, it does not indicate causation. For instance, if two variables, say X and Y show high positive correlation, this does not mean that if Y increase by a certain value, X will increase by the same amount or more.

In addition, it does not give any information about one of the variables predict one another.

Page 57: Correlation and regression Dr.  Ghada Abo-Zaid

Simple Regression Analysis Simple linear regression model is a

simple statistical model that indicates causality by determining the dependent variable, Y and an independent variable, X .

Least square estimation method is used for fitting a model and estimate the effect size of the independent variable, X that influence on the dependent variable, Y.

Page 58: Correlation and regression Dr.  Ghada Abo-Zaid

Simple Regression Analysis In social sciences, it is difficult to

estimate the exact relationship between two variables. It is often assumed that there is an acceptable measurement of error.

In statistical analysis, the error term is included in the model as a random factor called the error term or disturbance term.

Page 59: Correlation and regression Dr.  Ghada Abo-Zaid

Simple Regression Analysis The simple linear regression model is

written mathematically as:

Page 60: Correlation and regression Dr.  Ghada Abo-Zaid

Estimation of and

Page 61: Correlation and regression Dr.  Ghada Abo-Zaid

The sum of square error

Page 62: Correlation and regression Dr.  Ghada Abo-Zaid

Example

A chain of stores sells treadmills; the manager of the stores wants to know whether advertising of the product increase the sales. The manger decided to examine the association between an advertising expenditures and sales for 6 months. Note that advertising expenditures is the independent variable, X and is measured by thousand Egyptian pounds per month, and Y is the number of treadmills sold per month. The data are given in the following table.

Page 63: Correlation and regression Dr.  Ghada Abo-Zaid

Example

o Draw the scatter plot and depict the association between X and Y.o Fit the simple linear regression model.o Calculate the error term by using:

a). Long calculation formula. b). Short calculation formula.

Page 64: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Draw the scatter plot

Page 65: Correlation and regression Dr.  Ghada Abo-Zaid

Depict of Scatter plot

The scatter plot shows a direct association between the advertising expenditures, X and the number of sold treadmill, Y.

This indicates that the more amount of money spending on advertising, the more expected number of treadmills are sold.

Page 66: Correlation and regression Dr.  Ghada Abo-Zaid

2. Fitting the simple linear regression model.

Page 67: Correlation and regression Dr.  Ghada Abo-Zaid

Estimate b0 and b1

Page 68: Correlation and regression Dr.  Ghada Abo-Zaid

Estimate b0 and b1

Page 69: Correlation and regression Dr.  Ghada Abo-Zaid

Calculate the error term

First: Long calculation formula

Page 70: Correlation and regression Dr.  Ghada Abo-Zaid

Calculate the error term

Page 71: Correlation and regression Dr.  Ghada Abo-Zaid

Assessing the Best Fitted Simple Linear Regression ModelTesting the significance of the linear regression

model can be undertaken through three methods. The first method is Analysis of variance (ANOVA)

table, that aimed to test the full model by calculating F-value.

The second method is used hypotheses test to test whether a regression parameter are significant or not.

The last one is the coefficient of determination, In the following sections, the three assessing methods are explained in details.

Page 72: Correlation and regression Dr.  Ghada Abo-Zaid

First method: Analysis of Variance (ANOVA table)

To construct ANOVA table, three types of variation should be defined , which are given in the following equation:

SST is named as total sum of squares variation, and it calculated by using the following formula

Page 73: Correlation and regression Dr.  Ghada Abo-Zaid

SSE is named as sum of square error which is the error that not explained by regression.

It can be calculated as follows

Page 74: Correlation and regression Dr.  Ghada Abo-Zaid

SSR is named as sum of square regression. It is variation that explained by regression.

it can be written mathematically as follows:

Page 75: Correlation and regression Dr.  Ghada Abo-Zaid

Construct an ANOVA table

Page 76: Correlation and regression Dr.  Ghada Abo-Zaid

Decision

Page 77: Correlation and regression Dr.  Ghada Abo-Zaid

Hypothesis Tests of Individual Regression Coefficients

Test the significance of slope

Page 78: Correlation and regression Dr.  Ghada Abo-Zaid

Test the significance of slope b1

Page 79: Correlation and regression Dr.  Ghada Abo-Zaid

test the significance of b0

Page 80: Correlation and regression Dr.  Ghada Abo-Zaid

test the significance of b0

Page 81: Correlation and regression Dr.  Ghada Abo-Zaid

Third Method: The Coefficient of Determination,

The coefficient of determination is one of the statistical tool that assess linear regression model.

This indicates how well data fit the line. The coefficient of determination lies between zero and one.

If the coefficient of determination, equals one, this indicates the perfect linear relationship between X and Y.

While, if =0 this indicates that there is no linear relationship between X and Y.

In general, if the value of is close to one, this indicates that the model is a good fit and vice versa

Page 82: Correlation and regression Dr.  Ghada Abo-Zaid

The formula of coefficient of determination is given below

In other words, the coefficient of determination is the square of the Person's correlation coefficient between X and Y, and it is written mathematically as follows:

Page 83: Correlation and regression Dr.  Ghada Abo-Zaid

Example

In previous example , the estimate simple linear regression model were as follows:

Page 84: Correlation and regression Dr.  Ghada Abo-Zaid

Example

From the dataset at previous example find the following:

Test the full estimate simple regression model by constructing ANOVA table , find F-value and interpret the results.

Test the significance of and individually, at 5% significant level.

Calculate the coefficient of determination, and interpret the results.

Page 85: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Test the full estimate simple regression model by constructing ANOVA table , find F-value and interpret the results.

Page 86: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Page 87: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Page 88: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Step 5: Decision Since F-calculated> F-tabulated, then,

this indicates the significance of the full simple regression model.

Page 89: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Page 90: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Page 91: Correlation and regression Dr.  Ghada Abo-Zaid

Solution

Page 92: Correlation and regression Dr.  Ghada Abo-Zaid

Second : test the significance of b0

Page 93: Correlation and regression Dr.  Ghada Abo-Zaid

Second : test the significance of b0

Page 94: Correlation and regression Dr.  Ghada Abo-Zaid

3) Calculate the coefficient of determination, and interpret the results.