You are on page 1of 8

STATISTICS FOR ENGINEERS

LAB ASSESSMENT-3

COURSE CODE: MAT2001 SLOT: L53+L54

NAME: C. SHARAN KUMAR REDDY


REG. NO: 21MIS0098

SOLUTION:

METHOD-1:

CORRELATION:

CODE:

X=c(65,66,67,67,68,69,70,72)
Y=c(67,68,65,68,72,72,69,71)

var(X)

var(Y)

var(X,Y)

r = var(x,y)/sqrt(var(x)*var(y))

cor(X,Y)

CORRELATION = 0.6030227

Spearman's rank correlation rho

CODE:

X=c(65,66,67,67,68,69,70,72)

Y=c(67,68,65,68,72,72,69,71)

cor.test(X,Y,method="spearman",exact = FALSE)
Rho = 0.6848611

REGRESSION

X ON Y:

CODE:

X=c(65,66,67,67,68,69,70,72)

Y=c(67,68,65,68,72,72,69,71)

fit = lm(X~Y)

fit

Y ON X:

X=c(65,66,67,67,68,69,70,72)

Y=c(67,68,65,68,72,72,69,71)

fit = lm(Y~X)

fit
REGRESSION LINE EQUATIONS:

X = 30.3636+0.5455*Y

Y = 23.6667 + 0.6667*X

METHOD-2

2.

SOLUTION:

SOURCE CODE:

X = c(78,89,97,69,59,79,68,57)

Y = c(125,137,156,112,107,138,123,108)

R = cor.test(X,Y,method="pearson")

RG= cor.test(X,Y,method="spearman",exact=FALSE)

reg_x = lm(X~Y)

reg_y = lm(Y~X)

print(R)

print(RG)
print(reg_x)

print(reg_y)
REGRESSION LINE EQUATIONS:

X = -22.833 + 0.774*Y

Y = 39.106 + 1.163*X

3.

SOLUTION:
SOURCE CODE:

X = c(92,89,87,86,83,77,71,63,53,50)

Y = c(86,88,91,77,68,85,52,82,37,57)

R = cor.test(X,Y,method="pearson")

RG = cor.test(X,Y,method="spearman",exact=FALSE)

reg_x = lm(X~Y)

reg_y = lm(Y~X)

print(R)

print(RG)

print(reg_x)

print(reg_y)
REGRESSION LINE EQUATIONS:
X = 30.2497 + 0.6203*Y

Y = 5.9519 + 0.8835*X

You might also like