0% found this document useful (0 votes)
2 views21 pages

Unit-V

Chapter 5 discusses regression and correlation analysis, focusing on the statistical relationship between random variables and how to predict values using regression lines. It explains the concepts of independent and dependent variables, the method of least squares for fitting regression lines, and provides examples for calculating regression equations. Additionally, it covers the simplification of regression equations using deviations from means and introduces linear regression as the simplest form of regression analysis.

Uploaded by

Biswajit Muduli
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views21 pages

Unit-V

Chapter 5 discusses regression and correlation analysis, focusing on the statistical relationship between random variables and how to predict values using regression lines. It explains the concepts of independent and dependent variables, the method of least squares for fitting regression lines, and provides examples for calculating regression equations. Additionally, it covers the simplification of regression equations using deviations from means and introduces linear regression as the simplest form of regression analysis.

Uploaded by

Biswajit Muduli
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Chapter 5

Regression and Correlation Analysis

5.1 Regression
In the regression analysis we study aspects of statistical relationship between two or more
random variables. For example, in a computer system the throughput ‘Y’ and the degree of
multiprogramming ‘X’ might will be related to each other. One indicator of the association
between two random variables is their correlation coefficient 𝜌 (X, Y) that we will study in
section 5.2.

A related problem is that of predicting a value of system throughput ‘y’ at a given degree
of multiprogramming ‘x’. The problem then is to find a regression line or a regression curve
that describe the dependence of ‘Y’ on ‘X’. Also, we may study the inverse regression
problem of dependence of ‘X’ on ‘Y’,

Let us understand the requirement of regression analysis through another example. If we


know that advertising and sales are correlated, we find out expected amount of sales for a
given advertising expenditure. Similarly, if we know that the yield of rice and rainfall are
closely related we may find out the amount of rain required to achieve a certain production
figure. “Regression Analysis reveals average relationship between two variables and this
makes possible estimation or prediction”. Regression Analysis is also visualized as a
statistical device with the help of which we are in a position to estimate (or predict) the
unknown values of one variable from known values of other variables.
The variable which is used to predict the variable of interest is called the independent
variable or explanatory variable and the variable we are trying to predict is called the
“dependent variable” or “explained variable”. Normally, the independent variable is
denoted by ‘X’ and the dependent variable by ‘y’.

Regression Lines:
The regression line can be best appreciated with the help of the following example:

X: height of 65 63 67 64 68 62 70 66 68 67
father(inches)
Y: height of 68 66 68 65 69 66 68 65 71 67
son(inches)
The two-regression lines corresponding to these variables are:
X = -3.38 + 1.036 Y
Y = 35.82 + 2.476 X
For example, if Y = 65, X would be -3.38 + 1.036 * 65 = 63.96
Y = 70, X would be -3.38 + 1.036 * 70 = 69.14
Now an important question is coming to my mind i.e., how to obtain these two lines from
the given data.
It is important to note that the regression lines are drawn on least sequences assumption
which stipulates that of the sum of squares of the deviations of the observed ‘Y’ values
from the fitted line shall be minimum.
The total of the squares of the deviations of the various point is minimum only from the
line of best fit. The deviation from the point from the line of best fit can be measured in
two ways – vertical i.e., parallel to Y-axis, and horizontal i.e. parallel to X-axis.
The regression line of Y on X is drawn in such a way that it minimizes total of squares of
the vertical deviations.
To be more specific if our points are {(𝑥 , 𝑦 )|𝑖 = (1)𝑛} then we choose ‘a’ and ‘b’ so as to
minimize.

𝐸= y − (𝑎 + 𝑏𝑥 )

= (y − 𝑎 − 𝑏𝑥 )

Taking partial derivatives w.r.t. ‘a’ and ‘b’ and setting them equal to ‘0’ we obtain

= 2∑ (𝑦 − 𝑎 − 𝑏𝑥 )(−1) = 0 (1)

= 2∑ (𝑦 − 𝑎 − 𝑏𝑥 )(−𝑥 ) = 0 (2)

From (1), we get

2 (𝑦 − 𝑎 − 𝑏𝑥 )(−1) = 0

=> 𝑦 − 𝑎− 𝑏𝑥 = 0

=> 𝑦 − 𝑛𝑎 − 𝑏 𝑥
=> ∑ 𝑦 −𝑎− ∑ 𝑥 =0

1 1
=> 𝑦 =𝑎+𝑏 𝑥
𝑛 𝑛

=> 𝑦 = 𝑎 + 𝑏𝑥̅ , (3)

Where 𝑦 = ∑ 𝑦 , 𝑥̅ = ∑ 𝑥

Similarly from (2), we get

2 (𝑦 − 𝑎 − 𝑏𝑥 )(−𝑥 ) = 0

=> − 𝑥 𝑦 +𝑎 𝑥 +𝑏 𝑥 =0

=> 𝑥𝑦 =𝑎 𝑥 +𝑏 𝑥 =0

=> ∑ 𝑥 𝑦 = 𝑎𝑥̅ + 𝑏 ∑ 𝑥 (4)

From equations (3) and (4), we get the value of ‘a’ and ‘b’ as follows.
𝑎 = 𝑦 − 𝑏𝑥̅ (5)
Now substitute the value of ‘a’ in equation (4), We get

1 1
𝑥 𝑦 = (𝑦 − 𝑏𝑥̅ ) + 𝑏. 𝑥
𝑛 𝑛

1
=> 𝑥 𝑦 = 𝑥̅ 𝑦 − 𝑏𝑥̅ + 𝑏 𝑥
𝑛

=> 𝑥 𝑦 = 𝑛𝑥̅ 𝑦 − 𝑛𝑏𝑥̅ + 𝑏 𝑥

=> 𝑥 𝑦 − 𝑛𝑥̅ 𝑦 = −𝑛𝑏𝑥̅ + 𝑏 𝑥

=> 𝑏 𝑥 − 𝑛𝑥̅ = 𝑥 𝑦 − 𝑛𝑥̅ 𝑦

∑ 𝑥 𝑦 − 𝑛𝑥̅ 𝑦
=> 𝑏 =
∑ 𝑥 − 𝑛𝑥̅
This value of ‘b’ can be substituted in equation (5), we get,
∑ 𝑥 𝑦 − 𝑛𝑥̅ 𝑦
𝑎=𝑦− . 𝑥̅
∑ 𝑥 − 𝑛𝑥̅
Now using the value of ‘a’ and ‘b’, We can get the line of regression of x and y.

Example:
1. From the following data obtain the regression equa on of y on x.
x 6 2 10 4 8
y 9 11 5 8 7

Solution: To compute the regression equation y = a + bx it is


Required to find out the value of ‘a’ and ‘b.
x Y xy x
6 9 54 36
2 11 22 4
10 5 50 100
4 8 32 16
8 7 56 54
∑ = 30 ∑ = 40 ∑ = 214 ∑ = 220

𝑋=6
𝑌=8
∗ ∗
b= = = = -0.65

a = 8—(−0.65)6 = 11.9
Hence, y = 11.9 + ( -0.65) X
Y = 11.9 – 0.65X

The above method of finding out regression equation is tedious. The equation is very much
be simplified if instead of dealing with actual values of x and y we take deviations of x and
y series from respective means. In such a case the two regression equations are written as
follows:
Regression Equa on of x on y:
𝑥 − 𝑥̅ = 𝜌 (𝑦 − 𝑦),
𝑤ℎ𝑒𝑟𝑒 𝑥̅ and 𝑦 are the means of x and y series, respec vely.
𝜌 is known as the regression coefficient of x on y.
The coefficient can also be denoted as ′𝑏𝑥𝑦′.
𝜎𝑥 𝑐𝑜𝑣(𝑥, 𝑦) 𝜎𝑥 𝑐𝑜𝑣(𝑥, 𝑦)
𝑏𝑥𝑦 = 𝜌 = ∗ =
𝜎𝑦 𝜎𝑥. 𝜎𝑦 𝜎𝑦 𝜎𝑦
Similarly,
Regression Equa on of y on x:
𝜎𝑦
𝑦−𝑦 =𝜌 = (𝑥 − 𝑥̅ )
𝜎𝑥

=> 𝑦 − 𝑦 = 𝑏𝑦𝑥(𝑥 − 𝑥̅ )
( , )
Where 𝑏𝑥𝑦 = 𝜌. = is known as regression coefficient of y on x.
Note: 𝑏𝑦𝑥 ∗ 𝑏𝑥𝑦 = 𝜌 ∗ ∗ 𝜌 =𝑦

=>𝜆2 = 𝑏𝑥𝑦 × 𝑏𝑦𝑥

=>𝜆 = √𝑏𝑥𝑦 × √𝑏𝑦𝑥

Exercise:
1. The following table shows the ages (x) and blood pressure (y)of 8 persons:

X 52 63 45 36 72 65 47 25
Y 62 53 51 25 79 43 60 33
Obtain the equation of Y and X and find the expected blood pressure of a person who
is 49 years old.
2. In a correla on study the following values are obtained:

X Y
Mean 65 67
Standard deviation (σ) of coefficient of Correlation 2.5 3.5
Find the two regression equations that are associated with the above values.

3. You are given the following data:

X Y
Arithmetic mean 36 85
Standard deviations 11 8
Correction coefficient between x and y =0.66
(i) Find the two regression equation.
(ii) Estimate the value of x when y=75.
4. Write a program in any computer programming language to es mate the value of
unknown variable based on thevalue of other known variable.

More on Regression:
Regression problem is defined as that of predefined continuous value rather than a nominal
or discrete value.
In linear regression data are modelled using a straight line. Linear regression is the simplest
form of regression. The linear regression models a random variable, Y (called a response
variable) as a linear function of another random variables, X (called a predicator variable)
that is
Y = 𝛼 + 𝛽𝑋
Where 𝛼 𝑎𝑛𝑑 𝛽 are regression coefficients specifying the Y-intercept and slope of the line,
respectively. These coefficients can be obtained by the method of t least squares which
minimizes the error between the actual data and the estimate of the line.
Given n samples or data points of the form (x1,y1), (y1,y2)…….(xn,yn) then the regression
coefficients can be estimated as follows:
∑ 𝑦 = 𝑛𝛼 + 𝛽 ∑ 𝑥 (6)
⟹∑ 𝑥 𝑦 = 𝛼∑ 𝑥 +∑ 𝑥 (7)
From (6) on dividing by n, we get
𝑦 = 𝛼 + 𝛽𝑥̅ (8)
We know that
Cov(X,Y) = E[XY] = E[x].E[Y]

= ∑ 𝑥 𝑦 − 𝑥̅ 𝑦

⟹ ∑ 𝑥 𝑦 = 𝑐𝑜𝑣(𝑥, 𝑦) + 𝑥̅ 𝑦 (9)

Similarly,
𝜎 = 𝐸[𝑥 ] − (𝐸[𝑥]) (Variance)

⟹ 𝜎 = ∑ 𝑥 − ( ∑ 𝑥)

⟹ ∑ 𝑥 = 𝜎 + 𝑥̅ (10)

Dividing (2) by n, and using (3) and (4), we get


∑ 𝑥𝑦 = ∑ 𝑥 + ∑ 𝑥

 Cov(X, Y) + 𝑥̅ 𝑦 = 𝛼𝑥̅ + 𝛽(𝜎 + 𝑥̅ ) (11)


Multiplying 𝑥̅ with (8), we get
𝑥̅ 𝑦 = 𝛼𝑥̅ + 𝛽𝑥̅ (12)
Now subtract (12) from (11), we get
Cov(x, y) = 𝛽𝜎
( , )
𝛽=
 𝛼 = 𝑦 − 𝛽𝑥̅
Therefore,
( , )
𝛽 =

∑ ̅
 𝛽=
∑ ̅
∑ ̅
𝛽 = ∑ ̅
∑ ( ̅ )( )
𝛽 = ∑ ̅)
(
Here the linear regression equation is
∑ ( ̅ )( )
Y = 𝑦 − 𝛽𝑥̅ + ∑ ̅)
.𝑋
(

Alternatively,
Minimize E = ∑ (𝑦 − (𝑎 + 𝑏𝑥 )) (𝐿𝑒𝑎𝑠𝑡 𝑠𝑞𝑢𝑎𝑟𝑒 𝑓𝑖𝑡)
Taking partial derivative of a and setting then equal to 0, we obtain
𝜕𝐸
= 0
𝜕𝑎
 2∑ (𝑦 − (𝑎 + 𝑏𝑥 ))(−1) = 0
 ∑ 𝑦 = 𝑛𝑎 + 𝑏 ∑ 𝑥 (13)
𝜕𝐸
= 0
𝜕𝑎
 2 ∑ (𝑦 − (𝑎 + 𝑏𝑥 ))(−𝑥 ) = 0
 ∑ 𝑥 𝑦 = 𝑎 ∑ 𝑥 + 𝑏. ∑ 𝑥 (14)
Hence, the line of best fit can be obtained by solving the following determinants
𝑌 𝑋 1
∑ 𝑦 ∑ 𝑥 𝑛
∑ 𝑥𝑦 ∑ 𝑥 ∑ 𝑥
𝑥 𝑛 𝑦 𝑛 𝑦 𝑥
⟹ 𝑌. − 𝑋 + =0
𝑥 𝑥 𝑥𝑦 𝑥 𝑥𝑦 𝑥

Multiple Regression:
Multiple regression is an extension of linear regression involving more than one predicator
variable. It allows response variable Y to be modelled as a linear function of a
multidimensional feature vector e.g.,
Y = 𝜶 + 𝜷𝑿𝟏 + 𝜸𝑿𝟐
Here is to minimize,

E = 𝐘 − (𝜶 + 𝜷𝑿𝟏 + 𝜸𝑿𝟐 )
Regression can act as a classifies
Classification
𝑌∁ = 𝛼∁ + 𝛽 ∁
.𝑋 + 𝛽 ∁
.𝑋 + 𝛽 ∁
.𝑋 + 𝛽 ∁
.𝑋

𝑌∁ = 𝛼∁ + 𝛽 ∁
.𝑋 + 𝛽 ∁
.𝑋 + 𝛽 ∁
.𝑋 + 𝛽 ∁
.𝑋

𝑌∁ = 𝛼∁ + 𝛽 ∁
.𝑋 + 𝛽 ∁
.𝑋 + 𝛽 ∁
.𝑋 + 𝛽 ∁
.𝑋

Max { 𝑌∁ , 𝑌∁ , 𝑌∁ }
𝜕𝐸
= 0
𝜕𝛼

=> −2 𝒚𝒊 − (𝜶 + 𝜷𝑿𝟏 + 𝜸𝑿𝟐 ) = 0

=> ∑ 𝑦 = 𝑛𝛼 + 𝛽 ∑ 𝑥 +𝛾∑ 𝑥 (15)

𝜕𝐸
= 0
𝜕𝛽
⇒ 2∑ 𝒚𝒊 − (𝜶 + 𝜷𝑿𝒊𝟏 + 𝜸𝑿𝒊𝟐 ) (−𝑥 ) = 0
=> 2 ∑ 𝑦 𝑥 = 𝛼. ∑ 𝑥 + 𝛽. ∑ 𝑥 + 𝛾. ∑ 𝑥 𝑥 (16)

𝜕𝐸
= 0
𝜕𝛾

2∑ 𝒚𝒊 − (𝜶 + 𝜷𝑿𝒊𝟏 + 𝜸𝑿𝒊𝟐 ) (−𝑥 ) = 0


=> ∑ 𝑦𝑥 = 𝛼. ∑ 𝑥 + 𝛽. ∑ 𝑥 + 𝛾. ∑ 𝑥 𝑥 (17)
The values of 𝛼, 𝛽 𝑎𝑛𝑑 𝛾 can be obtained as follows:
𝑌 𝑋 𝑋 1

𝑦 𝑥 𝑥 𝑛

=0
𝑦𝑥 𝑥 𝑥 𝑥 𝑥

𝑦𝑥 𝑥 𝑥 𝑥 𝑥

Hence, we can extend this idea for m predictor attributes.

Non-Linear Regression:
Polynomial regression can be modelled by adding polynomial terms to the basic linear
model. By applying transformations to the variables, we can convert the non-linear model
into a linear once that can then be solved by the method of least squares.
Ex: -
Y=𝛼 + 𝛽 𝑋 + 𝛽 𝑋 + 𝛽 𝑋 (18)
After transformation:
Y=𝛼 + 𝛽 𝑋 + 𝛽 𝑋 + 𝛽 𝑋
i.e., let X1 = X
X2 = X2, X3 = X3
Now this can be solved by the method of least squares.

NOTE: Some models are intractably non-linear (such as the term of exponential terms for
example) and cannot be converted to a linear model.
Example: Y = aebx
Taking logarithm both side
Log10Y = log10a + bx log10 e
= > log10Y = log10a + bx
= > U = A + BX
Now this is a linear equation in X and U.
Thus the normal equivalence
∑ 𝑈 = 𝑛𝐴 + 𝐵 ∑ 𝑋 (19)
∑ 𝑋𝑈 = 𝐴 ∑ 𝑋 + 𝐵 ∑ 𝑋 (20)
𝑈 𝑋 1
∑𝑈 ∑𝑋 𝑛 = 0
∑ 𝑋𝑈 ∑𝑋 ∑𝑋
From these we find A and B and consequently
a = antilog(A)
b = B/loge
5.2 Correlation Analysis
Let us learn the theory of correlation analysis by putting a question "Uncover the hidden
relationship between income and expenditure of the employees of fakir Mohan
University."
Attempting to uncovering the hidden relationship between two variable like "income" and
"expenditure" or more variables is known as correlation analysis.
Over the years many definitions for correlation analysis have been defined by potential
statisticians/ mathematicians:
Some of the definitions of correlation is given below.
 "Correla on Analysis deals with the associa on between two or more variables"
 Correla on is an analysis of the covariance between two or more variables.
The problem of analyzing the relation between different series should be broken down
into three steps:

• Determining whether a relation exist and if it does, measuring it.

• Testing whether it is significant.

• Establishing the cause and affect relation, if any


However, in this Section, we will learn only step no. Now very specifically we stay
correlation analysis helps us in determining the degree of relationship between two or
more variables- it does not tell us anything about cause and effect relationship.
Types of Correlation:
Correlation is described or classified in several different ways. Three of the most important
ways of classifying correlation are:

• Posi ve or Nega ve
• Simple , Par al and Mul ple
• Linear and Non-linear

Positive and Negative Correlation:


 Whether Correla on is posi ve (direct) or nega ve would depend upon the
direc on of change of the variables. If both the variables are varying in the same
direc on i.e., either both are increasing or decreasing then correla on is said to be
posi ves

 If on the other hand, the variables are varying in opposite direc on i.e., one is
increasing and the other one is decreasing or vice-versa, then correla on is said to
be nega ve.
Simple Partial and Multiple Correlation:
The definition between simple, partial, and multiple correlation is based upon the
number of variables Studied.
 If study is confined on two variables then it is said to be simple correla on.
 If the study is undertaken on three or more variables then it is a problem of either
mul ple or par al correla on
 In mul ple correla on three or more variables are studied simultaneously
 Ex: Study the rela onship between the yield of rice per acre and both the amount
of rainfall and the amount of fer lizers used Jit is a problem of mul ple correla on.
 On the other hand, in par al correla on we recognize more than two variables,
but consider only two variables to be influencing each other the effect of other
influencing variables being kept constant.
Linear and Non-Linear Correlation:
The distinction between linear and nonlinear Correlation is based upon the
constancy of the ratio of range between the variables. If the amount of change in
the other variable then the correlation is said to be linear.
On the other hand if the amount of change in one variable does not bear a
constant ratio to the amount of change in the other variable , then the correlation
is said to be non-linear or Curvilinear
Method of Studying Correlation:
The two very popular methods of ascertaining whether two variables are correlated
or not are:

• Scatter Diagram Method

• Karl Pearson's coefficient of Correlation

Scatter Diagram Method:


The simplest device for ascertaining whether two variables are related is to prepare a
dot chart in a graph paper, called scatter diagram based on the Scatter of the various
points we can form idea as to whether the variables are related or not. The greater the
scatter of the plotted points on the chart, the lesser is the relationship between the
two variables.
The more closely the points come to a straight line, the higher the degree of
relationship. if all the points lie on a straight line falling from the lower left hand
corner to upper right hand corner, correlation is said to be perfectly positive (i.e.,
p=+l)
 On the other hand, if all the points are lying on a straight line rising from the upper
le hand corner to the lower right hand corner of the diagram ,correla on is said to
be perfectly nega ve i.e. ( p= -1)

Example:
Given the following pair of values of the variables X and
X: 2 3 5 6 8 9
Y : 6 5 7 8 12 11
• Plot a scatter diagram.

• Is there an any correlation between the variables X and Y ?

• By graphic inspection draw an estimating line.


Solution:

• The variable X and Y are posi vely correlated.


• The points are closure to a straight line, hence the degree of rela onship is higher
in this case.
One of the merits of this method is that it is simple to understand and visualize.
However, the greatest disadvantage of this method is that cannot establish the exact
degree of correlation between the variance.

Karl Pearson's Coefficient of Correlation:


Of the several mathema cal methods of measuring Correla on, the Karl Pearson's
method , Popularly Known as Pearson's Coefficient of Correla on is mostly widely used in
Prac ce . The Coefficient of Correla on is denoted by the symbol 'p'

Where cov (x, y) =E [x y] – E[x] E[y],

𝜎x = 𝑉𝑎𝑟[𝑥 ] = 𝐸 [𝑥 ] − (𝐸[𝑥])

𝜎 y= 𝑉𝑎𝑟[𝑦] = 𝐸 [𝑦 ] − (𝐸[𝑦])
It can be realised that
−1 ≤ 𝜌(𝑥, 𝑦) = 𝜌 ≤ 1
Also:
−1 𝑖𝑓 𝑥 = −𝑎𝑦(𝑎 > 0)
𝜌(𝑥, 𝑦) = 0 𝑖𝑓 𝑥 𝑎𝑛𝑑 𝑦 𝑎𝑟𝑒 𝑢𝑛𝑐𝑜𝑟𝑟𝑒𝑐𝑡𝑒𝑑
+1 𝑖𝑓 𝑥 = 𝑎𝑦(𝑎 > 0)
With our experience on expectation, we can write equation (1) as:
𝐸[𝑥, 𝑦] − 𝐸[𝑥][𝑦]
𝜌=
𝐸 [𝑥 ] − (𝐸[𝑥]) 𝐸[𝑦 ] − (𝐸[𝑦])
1 1 1

𝑥 𝑦 − ( ∑ 𝑥 )( ∑ 𝑦 )
= 𝑛 𝑛 𝑛
1 1 1 1
∑ 𝑥 −( ∑ 𝑥 ) ∑ 𝑦 −( ∑ 𝑦 )
𝑛 𝑛 𝑛 𝑛

∑ . ∵ ̅ ∑
=
∑ ̅ ∑ ∵ ∑

∑ ( )( )
=
∑ ( ) ∑ ( )

Now by using formula we solve few problems.


Example: Calculate Karl Pearson’s coefficient of correction from the following data.
Roll no. of students: 1 2 3 4 5
Marks in Math :48 35 17 23 47 (x)
Marks in Comp. Sc. :45 20 40 25 45 (y)
𝑆𝑜𝑙 : Let marks in Mathematics and Computer Science be denoted as x and y,
respectively.
(𝒙 − 𝟑𝟒)(𝒚
x y x-34 y-35 (𝒙 − 𝟑𝟒)𝟐 (𝒙 − 𝟑𝟓)𝟐
− 𝟑𝟒)
48 45 +14 +10 196 100 140
35 20 +1 -15 1 225 -15
17 40 -17 +5 289 25 -85
23 25 -11 -10 121 100 110
47 45 +13 +10 169 100 130
∑ 𝒙=170 ∑ 𝒚=175 = 𝟕𝟕𝟔 = 𝟓𝟓𝟎 = 𝟐𝟖𝟎

In order to complete the value of ‘𝜌’ by using formula (III), we need to complete the value
of 𝑥̅ and 𝑦. So
𝑥̅ = ∑ 𝑥 = (48 + 35 + 17 + 23 + 47) = = 34

𝑦= ∑ 𝑦 = (45 + 20 + 40 + 25 + 45) = = 35

By using formula (III), we get


∑( )( )
𝜌=
∑( ) .( )

= = = = 0.42859 (Ans.)
√ . √ .

Computational Steps:
1. Compute the mean of x series and y series.
2. Take the devia ons of x series from the mean of x (𝑥̅ ) and denote these devia ons
by (x-𝑥̅ )
3. Take the devia ons of y series from the mean of y (i.e., 𝑦) and denote these
devia ons by (y-𝑦)
4. Mul ply (x-𝑥̅ ) and (y-𝑦) i.e. compute (x-𝑥̅ )(y-𝑦) and obtain the
total i.e., ∑(x − 𝑥̅ )(y − 𝑦) .
5. Take the square of (x-𝑥̅ ) and obtain the total i.e., ∑(x − 𝑥̅ ) .
6. Take the square of (y-𝑦)and obtain the total i.e., ∑(y − 𝑦) .
7. Now compute the value of 𝜌 and display the value.

Exercise:
1. Convert the computational steps into a computer program using any language.
2. Calculate coefficient of correlation from the following data:
X: 100 200 300 400 500 600 700
Y: 30 50 60 80 100 110 130
Ans: +0.977

Direct Method of computing correlation coefficient:


The correction coefficient can also be calculated without taking deviations of items either
from actual mean or assumed mean. The formula, we can derive as follows:

1 1 1
∑ 𝑥 𝑦 − ( ∑ 𝑥 )( ∑ 𝑦 )
𝜌= 𝑛 𝑛 𝑛
1 1 1 1
∑ 𝑥 −( ∑ 𝑥 ) ∑ 𝑦 −( ∑ 𝑦 )
𝑛 𝑛 𝑛 𝑛
∑ (∑ )(∑ )
=
∑ (∑ ) ∑ (∑ )

3. Compute the correlation coefficient from the following data using equation (IV).
X: 2 3 5 6 8 9
Y: 6 5 7 8 12 11
𝑆𝑜𝑙 :
x y xy 𝒙𝟐 𝒚𝟐
2 6 12 4 36
3 5 15 9 25
5 7 35 25 49
6 8 48 36 64
8 12 96 64 144
9 11 99 81 121
∑ 𝒙=33 ∑ 𝒚=49 ∑ 𝒙𝒚=305 ∑ 𝑥 =219 ∑ 𝑦 =439

6(305) − (33)(49)
𝜌=
6(219) − (33) 6(439) − (49)

=
√ √

= =
√ √ ( )( . )

= = +0.93 (Positively Correlated)


.

Correction of Grouped Data:


When the number of observations is large the data are often classified into two-way
frequency distribution called a correlation table.
What is a correlation table?
A correlation table is also called a bivariate frequency table since it
shows the frequency distribution of two related variables.

The class intervals for y are listed in the captions or column headings, and those for x are
listed in the stubs at the left of the table, the order can also be reserved. The frequencies
for each cell of the table are determined by either tallying or card sorting just as in the case
of frequency distribution of a single variable.
The formula for calculating the coefficient of correlation is:
.∑ . . . (∑ )(∑ )
𝜌= ,
.∑ . . (∑ ) .∑ . . (∑ )

Where, 𝑥 = (x − 𝑥̅ ), 𝑑𝑦 = (y − 𝑦), 𝑥̅ and 𝑦 are assumed mean and ‘𝑓’ is the frequency.
Example:
The following table gives the frequency, according to groups of marks obtained by 67
students on a test. Measure the degree of relationship between age ad test.
Age in Years
Test marks 18 19 20 21 Total
200-250 4 4 2 1 11
250-300 3 5 4 2 14
300-350 2 6 8 5 21
350-400 1 4 6 10 21
Total 10 19 20 18 67

Solution:
Let 𝑥 is the assumed mean of x series and 𝑦 is the assumed mean of y series.
dx = x – 𝑥̅ = x – 275
dy = y – 𝑦 = y – 19
The table for computing the correlation coefficient is as follows:

Test Age in Years(X)


Mark(Y)
18 19 20 21
dy -1 0 +1 +2 𝑓

200-250 -1 4 (4 4 (0 2 (-2 1 (-2 11 -11 11 0


250-300 0 3 (0 5 (0 4 (0 2 (0 14 0 0 0
300-350 +1 2 (-2 6 (0 8 (8 5 (10 21 21 21 16
350-400 +2 1 (-2 4 (0 6 (12 10 (40 21 42 84 50
Total 10 19 20 18 n=67

-10 0 20 36
10 0 20 72
0 0 18 48

67(66) − (46)(52)
ρ= 
(67)(102) − (46) (67)(112) − (52)
 
√ √

  
√ √ ( . ) ( . )

 
.

Exercise:
1. The following are the marks obtained by the students of a class in theory of probability
(TP) and Computer Network(CN):
Roll [Link] Theory of Computer
student probability Network
1 15 13
2 0 1
3 1 2
4 3 7
5 16 8
6 2 9
7 18 12
8 5 9
9 4 17
10 17 16
11 6 6
12 19 18
13 14 11
14 9 3
15 8 5
16 13 4
17 10 10
18 13 11
19 11 14
20 11 7
21 12 18
22 18 15
23 9 15
24 7 3
Prepare a correlation table taking the magnitude of each class interval as four marks and
the first interval as equal to 0 and less than 4. Calculate Karl Pearson’s correlation
coefficient of TP and CN.
Note: One of the merits of this method is that if summarizes in one figure not only the
degree of correlation but also the direction, i.e., whether correlation is positive or negative.
Some of the demerits of this method are: (I) the value of the coefficient is unduly affected
by the extreme items; (II) as compared with other methods this method takes more time
to compute the value of correlation coefficient; and (III) it also assumes linear relationship
between variables.

Interpreting Coefficient of Correlation:


The coefficient of correlation measures the degree of relation between two sets of figures.
As the reliability of estimates depends upon the closeness of the relationship it is
imperative that at most care be taken while interpreting the value of coefficient of
correlation, otherwise fallacious cohesions can be drawn.
The following general rules are given which would help in interpreting the value of.
1. When 𝜌 =+1, it means there is perfect +ve relationship between the variables.
2. When 𝜌 = -1, it means there is perfect -ve relationship between the variables.
3. When 𝜌 = 0, it means that there is no relationship between the variables i.e, the
variables are uncorrelated.

Coefficient of Correlation and Probable Error


The probable error of the coefficient of correlation helps in interpreting its values, with the
help of probable error it is possible to determine the reliability of the value of the
coefficient in so far as it depends on the conditions of random sampling. The probable error
of the coefficient of correlation is obtained as follows:

P.E. = 0.6745 x ( )

Where ‘𝜌′ is the correlation coefficient and ‘N’ is the number of pairs of observations.
Interpretation:
i. If the value of ‘𝜌′ is less than the probable error there is no evidence the probable error
there is no evidence of correlation i.e, the value of ‘𝜌’ is not at all significant.
ii. If the value of ‘𝜌’ is more than ‘6’ times the probable error the coefficient of correlation
is practically certain, i.e, the value of ‘𝜌’ is significant.
iii. The coefficient of correlation obtained from population can lie between

R= ± P.E
, where R denotes correlation in the population.
Standard Error of ′𝜌′

=

Properties of the Coefficient of Correlation:
i. The coefficient of correlation lies between -1 and +1. Mathematically, -1≤ 𝜌 ≤ 1 ,
|𝜌| ≤ 1.
ii. The coefficient of correlation is independent of change of scale and origin of the
variables X and Y.
<Hints: X’ = , Y’= >
iii. The coefficient of correlation is the geometric mean of two regression coefficients.
Mathematically, 𝜌 = 𝑏 𝑋𝑏

iv. The degree of relationship between the two variables is symmetric as show below.
𝜌𝑋𝑌 =𝜌𝑌𝑋

You might also like