MODULE - 2
Understanding Data. 45
Here, the aim of bivariate analysis is to find relationships among variables. The relationships
can then be used in comparisons, finding causes, and in further explorations. To do that, graphical
display of the data is necessary. One such graph method is called scatter plot.
Scatter plot is used to visualize bivariate data. It is useful to plot two variables with without
or
nominal variables, to illustrate the trends, and also to show differences. It is a plot between explan-
atory and response variables. It is graph showing the relationship between two variables.
a 2D
The scatter plot (Refer Figure 2.11) indicates strength, shape, direction and the presence
of Outliers. It is useful in exploratory data before calculating a correlation coefficient or fitting
regression curve.
Scatter plot
200 Series 1
150
Sales of sweaters
100
50
0 5 10 15 20 25
Temperature
Figure 2.11: Scatter Plot
Line graphs are similar to scatter plots. The Line Chart for sales data is shown in Figure 2.12.
Sales data
200
Line 1
150
Sales
100
50
0
5 10 15 20 22 23
Temperture
Figure 2.12: Line Chart
46. Machine Learning
2.6.1 Bivariate Statistics
Covariance and Correlation are examples of bivariate statistics. Covariance is a measure of joint
probability of random variables, say X and Y. Generally, random variables are represented in
capital letters. It is defined as covariance(X, Y) or COV(X, Y) and is used to measure the variance
between two dimensions. The formula for finding co-variance for specific x,and y are:
1N
cov(X,Y) =Σ(x Ε(Χ))(y E(Y)) (2.17)
N1 - -
Here, x, and y, are data values from X and Y. E(X) and E(Y) are the mean values of x, and y,.
N is the number of given data. Also, the COV(X, Y) is same as COV(Y, X).
Example 2.6: Find the covariance of data X= (1, 2, 3, 4, 5) and Y = (1, 4, 9, 16, 25)
15 55
Solution: Mean(X) = E(X) = = 3, Mean(Y) = E(Y) = = 11. The covariance is computed
5 5
using Eq. (2.17) as:
(1 – 3)(1 – 11) + (2 – 3)(4 – 11) + (3 – 30)(9 -11) + (4 – 3)(16 – 11) + (5 – 3)(25 – 11) = 12
5
The covariance between X and Y is 12. It can be normalized to a value between -1 and +1. This
is done by dividing it by the correlation of variables. This is called Pearson correlation coefficient.
Sometimes, N-1 is also can be used instead of N. In that case, the covariance is 60/4 = 15.
Correlation
The Pearson correlation coefficient is the most common test for determining any association
between two phenomena. It measures the strength and direction of a linear relationship between
thex and y variables.
The correlation indicates the relationship between dimensions using its sign. The sign is more
important than the actual value.
1. If the value is positive, it indicates that the dimensions increase together.
2. If the value is negative, it indicates that while one-dimension increases, the other dimension
decreases.
3. If the value is zero, then it indicates that both the dimensions are independent of each
other.
If the dimensions are correlated, then it is better to remove one dimension as it is a redundant
dimension.
Ifthe given attributes are X =(* ,*) and Y= (y Y2,y),then the Pearson correlation
coefficient, that is denoted as r, is given as:
COV(X,Y)
=
(2.18)
σχσγ
iations of X and Y.
where, ox σ, are the standard dev