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

Data Analytics Practical

The document outlines various practical topics in statistics, including scatter diagrams, regression analysis, correlation coefficients, and probability concepts. It provides detailed methodologies for fitting linear and quadratic models, calculating correlation coefficients, and understanding random experiments and events. Each practical section includes word problems, theoretical explanations, calculation tables, Excel steps, and conclusions to summarize findings.

Uploaded by

baburaoaapte100
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)
6 views21 pages

Data Analytics Practical

The document outlines various practical topics in statistics, including scatter diagrams, regression analysis, correlation coefficients, and probability concepts. It provides detailed methodologies for fitting linear and quadratic models, calculating correlation coefficients, and understanding random experiments and events. Each practical section includes word problems, theoretical explanations, calculation tables, Excel steps, and conclusions to summarize findings.

Uploaded by

baburaoaapte100
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

Practical Topics

March 3, 2026

Practical 1: Scatter Diagram and Fitting a Straight Line


Aim
To study the scattered nature of data and fit a straight line using the Method of Least
Squares.

Word Problem
A coaching institute recorded the number of hours students studied per week and their test
scores. The data is given below:

Study Hours (X) Test Score (Y)


2 40
4 50
6 65
8 70
10 85
12 95

Theory
The regression line is given by:

Y = a + bX
P P P
n XY − X Y
b= P P
n X 2 − ( X)2

a = Ȳ − bX̄

1
Calculation Table
X Y X2 XY
2 40 4 80
4 50 16 200
6 65 36 390
8 70 64 560
10 85 100 850
12 95 144 1140
X X
X = 42, Y = 405
X X
X 2 = 364, XY = 3220

n=6

6(3220) − (42)(405)
b=
6(364) − 422
2310
b= = 5.5
420

X̄ = 7, Ȳ = 67.5

a = 67.5 − (5.5)(7) = 29

Regression Line
Y = 29 + 5.5X

Estimation
For X = 9:

Y = 29 + 5.5(9) = 78.5

Excel Steps
1. Enter the data in two columns (A: Study Hours, B: Test Scores).

2. Select the data.

3. Click Insert → Scatter Plot.

4. To find regression line:

2
• Right click on data points.
• Select Add Trendline.
• Choose Linear.
• Tick Display Equation on Chart.

5. Alternatively, use formulas:

=SLOPE(B2:B7,A2:A7)
=INTERCEPT(B2:B7,A2:A7)

6. To estimate score for 9 hours:

=29 + 5.5*9

Conclusion
There is a strong positive linear relationship between study hours and test scores.

Practical 2: Fitting a Quadratic Curve


Aim
To fit a quadratic curve to the given data using the Method of Least Squares.

Word Problem
A manufacturing company recorded the number of machines installed and the monthly profit
(in thousand).

Machines Installed (X) Profit (Y)


1 10
2 18
3 28
4 42
5 60

Theory
When the data shows curvature, we fit:

Y = a + bX + cX 2
Normal equations:

3
X X X
Y = na + b X +c X2

X X X X
XY = a X +b X2 + c X3

X X X X
X 2Y = a X2 + b X3 + c X4

Final Fitted Curve


Y = 4 + 3X + 2X 2

Excel Steps
1. Enter X and Y values in two columns.

2. Select the data.

3. Click Insert → Scatter Plot.

4. Right click on points → Add Trendline.

5. Choose Polynomial.

6. Set Order = 2.

7. Tick Display Equation on Chart.

8. Alternatively, use LINEST:

=LINEST(B2:B6, A2:A6^{1,2}, TRUE, TRUE)

Conclusion
The scatter diagram shows a curved pattern. A quadratic curve fits the data better than a
straight line.

Practical 3: Karl Pearson’s Coefficient of Correlation


Aim
To identify univariate and bivariate data and compute Karl Pearson’s coefficient of correla-
tion.

4
Word Problem
A teacher wants to study the relationship between the number of hours studied and marks
obtained by students.

Study Hours (X) Marks (Y)


2 35
4 45
6 60
8 65
10 80

Part A: Identifying Data


• Study Hours alone → Univariate data

• Marks alone → Univariate data

• Study Hours and Marks together → Bivariate data

Theory
Karl Pearson’s coefficient of correlation:
P P P
n XY − X Y
r=p P P P P
(n X 2 − ( X)2 )(n Y 2 − ( Y )2 )

Calculation Table
X Y X2 Y2 XY
2 35 4 1225 70
4 45 16 2025 180
6 60 36 3600 360
8 65 64 4225 520
10 80 100 6400 800

X X
X = 30, Y = 285
X X
X 2 = 220, Y 2 = 17475
X
XY = 1930, n = 5
Substituting in formula:

5(1930) − (30)(285)
r=p
[5(220) − 302 ][5(17475) − 2852 ]

5
After calculation,

r ≈ 0.98

Interpretation
Since r is close to 1, there is a strong positive correlation between study hours and marks.

Correlation vs Causation
Although there is strong correlation, it does not necessarily mean studying alone causes
high marks. Other factors such as intelligence, teaching quality, and environment may also
influence marks.

Excel Steps
1. Enter X and Y values.

2. Use formula:

=CORREL(A2:A6,B2:B6)

3. Scatter plot: Insert → Scatter Chart.

Practical 4: Spearman’s Rank Correlation


Aim
To obtain Spearman’s Rank correlation coefficient for qualitative/rank data.

Word Problem
Two judges ranked 6 dance performances in a competition. Their rankings are given below:

Participant Judge 1 Rank (X) Judge 2 Rank (Y)


A 1 2
B 2 1
C 3 4
D 4 3
E 5 6
F 6 5

6
Theory
Spearman’s Rank Correlation:

6 d2
P
ρ=1−
n(n2 − 1)
where d = X − Y

Calculation Table
X Y d = X-Y d2
1 2 -1 1
2 1 1 1
3 4 -1 1
4 3 1 1
5 6 -1 1
6 5 1 1
X
d2 = 6

n=6

6(6)
ρ=1−
6(36 − 1)
36
ρ=1−
210

ρ = 1 − 0.1714

ρ ≈ 0.83

Interpretation
There is strong positive agreement between the two judges.

Excel Steps
1. Enter ranks in two columns.
2. Find difference: = A2 − B2
3. Square difference: = C22
4. Apply formula manually:

=1 - (6*SUM(D2:D7))/(6*(6^2-1))

7
Conclusion
Spearman’s Rank Correlation is useful for qualitative or ranked data where numerical mea-
surements are not available.

Practical 5: Regression Lines and Their Properties


Aim
1. To obtain regression lines of Y on X and X on Y .

2. To find their point of intersection and verify that it gives the means of X and Y .

3. To estimate values of Y for given X and values of X for given Y .

4. To obtain correlation coefficient from regression coefficients.

Word Problem
A company recorded the number of hours employees worked overtime and the corresponding
weekly productivity score.

Overtime Hours (X) Productivity Score (Y)


2 50
4 60
6 65
8 80
10 85

Theory
Regression line of Y on X:

Y − Ȳ = byx (X − X̄)
Regression line of X on Y :

X − X̄ = bxy (Y − Ȳ )
Where:
P P P
n XY − X Y
byx = P P
n X 2 − ( X)2
P P P
n XY − X Y
bxy = P P
n Y 2 − ( Y )2
Also,

8
p
r = ± byx · bxy

Calculation Table
X Y X2 Y2 XY
2 50 4 2500 100
4 60 16 3600 240
6 65 36 4225 390
8 80 64 6400 640
10 85 100 7225 850

X X
X = 30, Y = 340
X X
X 2 = 220, Y 2 = 23950
X
XY = 2220, n = 5

Means
30
X̄ = =6
5
340
Ȳ = = 68
5

Regression Coefficients
5(2220) − (30)(340)
byx =
5(220) − 302
11100 − 10200
byx =
1100 − 900
900
byx = = 4.5
200
900
bxy =
5(23950) − 3402
900
bxy =
119750 − 115600
900
bxy = = 0.217
4150

9
Regression Line of Y on X
Y − 68 = 4.5(X − 6)

Y = 4.5X + 41

Regression Line of X on Y
X − 6 = 0.217(Y − 68)

X = 0.217Y − 8.756

Point of Intersection
The two regression lines intersect at:

(X̄, Ȳ ) = (6, 68)


Hence verified that regression lines always intersect at the means.

Correlation Coefficient
p
r= (4.5)(0.217)


r= 0.9765

r ≈ 0.99
There is a very strong positive correlation.

Estimation
Estimate Y when X = 7

Y = 4.5(7) + 41

Y = 72.5
Estimate X when Y = 75

X = 0.217(75) − 8.756

X ≈ 7.52

10
Excel Steps
1. Enter data in two columns.

2. To find regression of Y on X:

=SLOPE(B2:B6,A2:A6)
=INTERCEPT(B2:B6,A2:A6)

3. To find regression of X on Y:

=SLOPE(A2:A6,B2:B6)
=INTERCEPT(A2:A6,B2:B6)

4. Correlation:

=CORREL(A2:A6,B2:B6)

Conclusion
• Two regression lines were obtained.

• They intersect at the mean values (6, 68).

• Strong positive correlation exists between overtime hours and productivity.

• Regression line of Y on X is used to predict Y from X.

• Regression line of X on Y is used to predict X from Y.

Practical 6: Random Experiment and Algebra of Events


Aim
1. To understand the concept of random experiment, sample point and sample space.

2. To identify events and perform operations on events.

3. To identify mutually exclusive, exhaustive and complementary events.

Word Problem
An experiment consists of tossing two coins simultaneously.

11
Part A: Identifying Outcomes
Possible outcomes:

S = {HH, HT, T H, T T }
Each element is called a sample point.
Hence, the sample space contains 4 sample points.
This is a discrete sample space.

Part B: Defining Events


Let:

A = Event of getting at least one Head

A = {HH, HT, T H}

B = Event of getting exactly one Head

B = {HT, T H}

Part C: Union and Intersection


A ∪ B = {HH, HT, T H}

A ∩ B = {HT, T H}

Part D: Complementary Event


Complement of A:

A′ = S − A

A′ = {T T }
Hence, A and A’ are complementary events.

12
Part E: Mutually Exclusive Events
Let:

C = Getting two Heads = {HH}

D = Getting two Tails = {T T }

C ∩D =∅
Therefore, C and D are mutually exclusive events.

Part F: Exhaustive Events


Events:

E = Getting at least one Head

F = Getting no Head

E∪F =S
Therefore, E and F are exhaustive events.

Conclusion
• The experiment of tossing two coins is a random experiment.

• The sample space consists of four discrete sample points.

• Events are subsets of the sample space.

• Union and intersection of events were obtained.

• Mutually exclusive, complementary and exhaustive events were identified.

Excel Steps
1. Enter Sample Space in Column A.

A2 = HH
A3 = HT
A4 = TH
A5 = TT

2. Define Event A (e.g., at least one Head) in Column B.

13
Use IF formula:
=IF(OR(A2="HH",A2="HT",A2="TH"),1,0)
Copy down

3. Define Event B (e.g., exactly one Head) in Column C.

=IF(OR(A2="HT",A2="TH"),1,0)
Copy down

4. To find Union A ∪ B:

=IF(OR(B2=1,C2=1),1,0)

5. To find Intersection A ∩ B:

=IF(AND(B2=1,C2=1),1,0)

6. Count outcomes using:

=COUNTIF(range,1)

7. Probability = (Number of favourable outcomes) / (Total outcomes)

=COUNTIF(range,1)/4

Practical 7: Multiplication Law, Conditional Probabil-


ity and Bayes’ Theorem
Aim
1. To understand the multiplication law of probability.

2. To compute conditional probabilities and identify independent events.

3. To apply Bayes’ theorem.

14
Theory
Multiplication Law of Probability:

P (A ∩ B) = P (A)P (B|A)
If A and B are independent events:

P (A ∩ B) = P (A)P (B)
Conditional Probability:

P (A ∩ B)
P (A|B) =
P (B)
Independent Events:
Two events A and B are independent if:

P (A|B) = P (A)
Bayes’ Theorem (without proof ):

P (B|Ai )P (Ai )
P (Ai |B) = P
P (B|Aj )P (Aj )

Part A: Multiplication Law of Probability


Word Problem:
A box contains 5 red balls and 3 blue balls. Two balls are drawn one after another
without replacement. Find the probability that both balls are red.
Solution:
Let,
A = First ball is red
B = Second ball is red

5
P (A) =
8
After drawing one red ball, 4 red remain out of 7 balls.
4
P (B|A) =
7
Using multiplication law:

P (A ∩ B) = P (A)P (B|A)

5 4
P (A ∩ B) = ×
8 7
20 5
P (A ∩ B) = =
56 14
15
Part B: Conditional Probability and Independence
Word Problem:
A die is thrown once.
Let,
A = Getting an even number
B = Getting a number greater than 3
Sample space:
S = {1, 2, 3, 4, 5, 6}

A = {2, 4, 6}
B = {4, 5, 6}

A ∩ B = {4, 6}

3 1
P (A) = =
6 2
3 1
P (B) = =
6 2
2 1
P (A ∩ B) = =
6 3
Check independence:
1 1 1
P (A)P (B) = × =
2 2 4
Since,
P (A ∩ B) ̸= P (A)P (B)
Therefore, events A and B are not independent.
Conditional probability:

P (A ∩ B)
P (A|B) =
P (B)
1/3 2
P (A|B) = =
1/2 3

16
Part C: Bayes’ Theorem
Word Problem:
A factory has two machines M1 and M2 .

P (M1 ) = 0.6, P (M2 ) = 0.4


Probability that machine produces defective item:

P (D|M1 ) = 0.02

P (D|M2 ) = 0.05
If a product is found defective, find the probability it was produced by machine M1 .
Solution:
Using Bayes’ theorem:

P (D|M1 )P (M1 )
P (M1 |D) =
P (D|M1 )P (M1 ) + P (D|M2 )P (M2 )
0.02 × 0.6
P (M1 |D) =
(0.02 × 0.6) + (0.05 × 0.4)
0.012
P (M1 |D) =
0.012 + 0.02
0.012
P (M1 |D) =
0.032

P (M1 |D) = 0.375

Conclusion
• Multiplication law was applied to dependent events.

• Conditional probability was computed and independence was checked.

• Bayes’ theorem was applied to find posterior probability.

• Hence, theoretical concepts were verified through numerical problems.

Excel Steps
1. Enter probabilities:

A2 = P(A)
A3 = P(B)
A4 = P(A and B)

17
2. Multiplication Law: P(A ∩ B) = P(A) × P(B \ A )

=A2*(A4/A2)

3. Conditional Probability P(B \ A ):

=A4/A2

4. To check Independence: If P(A ∩ B) = P(A) × P(B)

=A2*A3

Compare with A4.

5. Bayes’ Theorem: P(A \ B) = [P(A) × P(B \ A ] / P(B)

=(A2*(A4/A2))/A3

Practical 8: Probability Distribution of a Random Vari-


able
Aim
1. To obtain the probability distribution of a random variable.

2. To find expectation and variance of the random variable.

3. To verify that expectation is the mean of the distribution.

Theory
Probability Distribution: If X is a discrete random variable, then

P (X = xi ) = pi
where
X
pi = 1
Expectation (Mean):
X
E(X) = xi p i
Variance:

V ar(X) = E(X 2 ) − [E(X)]2

18
Word Problem
A fair coin is tossed twice. Let the random variable X denote the number of heads obtained.

Part A: Random Experiment and Sample Space


Sample Space:

S = {HH, HT, T H, T T }
Define random variable X:

X(HH) = 2
X(HT ) = 1
X(T H) = 1
X(T T ) = 0

Part B: Probability Distribution


X P(X)
1
0 4
2
1 4
1
2 4

Check:
1 2 1
+ + =1
4 4 4
Hence, it is a valid probability distribution.

Part C: Expectation
X
E(X) = xP (x)
     
1 2 1
E(X) = 0 +1 +2
4 4 4
2 2
E(X) = 0 + +
4 4
4
E(X) =
4

E(X) = 1

19
Part D: Variance
First find E(X 2 ):
     
2 1
2 2 2 2 1
E(X ) = 0 +1 +2
4 4 4
2 4
E(X 2 ) = 0 + +
4 4
6
E(X 2 ) = = 1.5
4
Now,

V ar(X) = E(X 2 ) − [E(X)]2

V ar(X) = 1.5 − (1)2

V ar(X) = 1.5 − 1

V ar(X) = 0.5

Part E: Verification that Expectation is Mean


Mean of distribution:
0+1+1+2
X̄ =
4
4
X̄ =
4

X̄ = 1
Since

E(X) = X̄ = 1
Hence verified that expectation is the mean of the probability distribution.

Conclusion
• The probability distribution of the random variable was obtained.

• Expectation and variance were computed.

• It was verified that expectation equals the mean.

20
Excel Steps
1. Enter random variable values in Column A.

A2 = 0
A3 = 1
A4 = 2

2. Enter probabilities in Column B.

B2 = 1/4
B3 = 2/4
B4 = 1/4

3. Check sum of probabilities:

=SUM(B2:B4)

4. Expectation E(X):

=SUMPRODUCT(A2:A4,B2:B4)

5. Compute X² in Column C:

=A2^2
Copy down

6. Compute E(X²):

=SUMPRODUCT(C2:C4,B2:B4)

7. Variance:

= (Cell of E(X^2)) - (Cell of E(X))^2

8. Verify Mean:

=AVERAGE(A2:A4)

21

You might also like