0% found this document useful (0 votes)
13 views26 pages

Stats Final Record

Uploaded by

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

Stats Final Record

Uploaded by

Maya
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

NAME: YASHI.

S
REG NO:2413711034070

RANGE & STANDARD DEVIATION

Question :
1. Find range & standard deviation for the following data.

10 20 40 70 80 40 90

Coding:
t=c(10,20,40,70,80,40,90)
range(t)
sd(t)

Result:
>t=c(10,20,40,70,80,
40,90)
>range(t
)
[1] 1090
>sd(t)
[1] 30.5505
NAME: YASHI.S
REG NO:2413711034070

Output:
NAME:YASHI.S
REG NO:2412711034070

QUARTILE DEVIATION

Question:
Calculate the quartile deviation for the following data: 12, 15, 20, 28, 30, 40, 50

Coding:

#Name: YASHI.S#
#REG NO.:2413711034070#
x=c(12,15,20,28,30,40,50)
q1=quantile(x,0.75) q1
q2=quantile(x,0.25) q2 qd=(q1-q2)/2
qd

Result:
The quartile deviation for the given data is 8.75.
NAME:YASHI.S
REG NO:2413711034070

Output:
NAME:YASHI.S
REG NO:2413711034070

COEFFICIENT OF VARIATION

Question :
7. The scores of 2 batsmen A & B in ten innings during a certain season are as follows.

A 10 115 5 73 7 120 36 84 29 19
B 45 12 76 42 4 50 37 48 13 0

Coding:
a=c(10,115,5,73,7,120,36,84,29,19)
cv1=((sd(a)/mean(a))*100)
cv1
b=c(45,12,76,42,4,50,37,48,13,0)
cv2=((sd(b)/mean(b))*100)
cv2

Result:
>a=c(10,115,5,73,7,120,36,84,
29,19)
>cv1=((sd(a)/mean
(a))*100)
> 1
cv
[1] 89.50609
>b=c(45,12,76,42,4,50,37,48,13,
0)
>cv2=((sd(b)/mean
(b))*100)
> 2
cv
[1] 74.72809
NAME:YASHI.S
REG NO:2413711034070

Output:
NAME:YASHI.S
REG NO:2413711034070

COEFFICIENT OF CORRELATION

Question :
2. Calculate the coefficient of correlation of the following data.

x 1 1 1 1 1 2 2 24 26 28

y 0 2 4 6 8 0 2 100 120 110

2 3 3 5 5 7 8
Coding: 0 0 7 0 6 8 9
#Name: YASHI.S#
#REG NO.:2413711034070#
x=c(10,12,14,16,18,20,22,24,26,28)
y=c(20,30,37,50,56,78,89,100,120,1
10) cor(x,y,method="pearson"
)

Result:
The coefficient of correlation for the given data is 0.9851764
NAME:YASHI.S
REG NO:2413711034070

Output:
NAME:YASHI.S
REG NO:2413711034070

RANK CORRELATION

Question :
1. Calculate the Rank correlation coefficient of the following data.

x 3 5 1 6 7 2 8 9 4

y 5 3 2 6 8 1 7 9 4

Coding:
#Name: YASHI.S #
#REG NO:2413711034070#
x=c(3,5,1,6,7,2,8,9,4)
y=c(5,3,2,6,8,1,7,9,4)
cor(x,y,method="spearman")

Result:
The Rank Correlation coefficient for the given data is 0.9
NAME:YASHI.S
REG NO:2413711034070

Output:
NAME:YASHI.S
REG NO:2413711034070

REGRESSION EQUATION

Question :
3. Find the regression equation for the following data.

x 1 2 3 4 5 8 1

y 9 8 10 12 14 16 0

1
Coding: 5
#Name: YASHI.S#
#REG NO.:2413711034070#
x=c(1,2,3,4,5,8,10)
y=c(9,8,10,12,14,16,15)
r1=lm(x~y) print(r1) r2=lm(y~x)
print(r2)

Result:
The Regression equation of x on y is X = 0.9483 Y - 6.6650
The Regression equation of y on x is Y = 0.8671 X + 7.9122
NAME:YASHI.S
REG NO:2413711034070

Output:
NAME:YASHI.
REG
S
NO:2413711034070

t-TEST FOR SINGLE MEAN

Question
A
: sample of 10 house owners is drawn. Their incomes are obtained as values. Mean is
standard deviation is ₨650. Test the hypothesis that the average income of the house
₨6000,
town is of the
owners
₨5500.

Coding
:#Name:
YASHI.S#
#REG
NO.:2413711034070#
xbar=60
00
sd=65
0
muo=550
0
n=1
0
t=(xbar-muo)/(sd/sqrt(n-
1))
t
alpha=0.
05
t.half.alpha=qt(1-alpha/
2,df=n-1)
t.half.alph
a

Result:
H0:
µ=5500
H1: µ≠5500 (2-tailed
test)
Test statistic: t =
(xbar-µ)/(s/sqrt(n-1))
Calculated value =
2.307692
Tabulated value =
2.262157

Conclusion:-
Since calculated value is greater than tabulated value, we reject H0 and
accept H1.
Therefore the population mean of house owners in town is not equal
to 5500.
NAME:YASHI.S
REG NO:2413711034070

Output:
NAME:YASHI.
REG
S
NO:2413711034070

t-TEST FOR DIFFERENCE OF MEAN


Question
:Below are given, the heights of six randomly chosen sailors (in inches) 63,65,68,69,71,72
and the of ten randomly chosen soldiers (in inches) 61,62,65,66,69,69,70,71,72,73.
heights
Discuss
on thesebased
data that sailors on an average are taller than
soldiers.
Coding
:#Name:
YASHI.S#
#REG
NO.:2413711034070#
x=c(63,65,68,69,71,
72)
xbar=mean(
x)
s1=sd(
x)
n1=
6
y=c(61,62,65,66,69,69,70,71,72,
73)
ybar=mean
(y)
s2=sd(
y)
n2=1
0
S=sqrt(((n1*s1*s1)+(n2*s2*s2))/
(n1+n2-2))
t=(xbar-ybar)/(S*sqrt((1/n1)+(1/
n2)))
t
alpha=0.
05
t.alpha=qt(1-
alpha,df=n1+n2-2)
t.alph
a
Result:
H0: µ1 =
µ2
H1: µ1 > µ2 (1-tailed
test)
Test statistic: t =
(x1bar-x2bar)/(S*sqrt((1/n1)+(1/n2)))
Calculated value =
0.09302605
Tabulated value =
1.76131

Conclusion:-
Since calculated value is lesser than tabulated value, we accept H0 and
reject H1. on an average height of sailors is equal to that of the
Therefore
soldiers.
NAME:YASHI.S
REG NO:2413711034070

Output:
NAME:YASHI.S
REG
NO:2413711034070

PAIRED t-TEST

Question:
An IQ test was given to 10 men, before and after training. Test whether there is any
change
after theintraining
IQ program at 1% level of
significance.

Me 2 3 4 5 6 7 8 9 1
1
n 0
IQ(before 167 1 1 1 1 1 1 1 1 1
) 2 5 5 6 5 5 6 3 4
IQ(after 170 4 7 5 3 4 6 8 3 3
)
1 1 1 1 1 1 1 1 1
3 5 5 5 6 6 7 4 3
8 8 6 6 7 8 2 2 8
Coding:
#Name:YASHI.S
#
#REGNO.:2413711034070
#
x=c(167,124,157,155,163,154,156,168,133,14
3)
y=c(170,138,158,156,156,167,168,172,142,13
8)
d=x-
y
d
dbar=mean(
d)
dba
r
sigma=sd(
d)
sigm
a
n=1
0
t=dbar/(sigma/sqrt(n-
1))
t
alpha=0.0
1
t.half.alpha=qt(1-alpha/2,df=n-
1)
t.half.alph
a
NAME:YASHI.S
REG NO:2413711034070

Result:
H0: µ=0
H1: µ≠0 (2-tailed test)
Test statistic: t = dbar/(sigma*sqrt(n-1))
Calculated value = |-1.83241| that is 1.83241
Tabulated value = 3.249836

Conclusion:-
Since calculated value is lesser than tabulated value, we accept H0 and reject H1.
Therefore there is no change in IQ after the training program.
NAME:YASHI.S
REG NO:2413711034070

Output:
NAME:YASHI.
REG
S
NO:2413711034070

Z-TEST FOR SINGLE MEAN

Question
:A sample of 450 items is taken from a population; whose standard deviation is 20, mean
is 30. Test
whether the sample has come from a population with
mean 29.

Coding
:#Name:
YASHI.S#
#REG
NO.:2413711034070#
xbar=3
0
sigma=2
0
muo=2
9
n=45
0
z=(xbar-muo)/(sigma/
sqrt(n))
z
alpha=0.0
5
z.half.alpha=qnorm(1-
alpha/2)
z.half.alph
a

Result:
H0:
µ=29
H1: µ≠29 (2-tailed
test)
Test statistic: Z =
(xbar-µ)/(sigma*sqrt(n))
Calculated value =
1.06066
Tabulated value =
1.959964

Conclusion:-
Since calculated value is lesser than tabulated value, we accept H0 and
reject H1.
Therefore the sample is taken from a population with
mean 29
NAME:YASHI.S
REG NO:2413711034070

Output:
NAME:YASHI.S
REG
NO:2413711034070

Z-TEST FOR DIFFERENCE OF MEAN

Question:
Random samples drawn from 2 places gave the following data. Relating to the heights of
adult
males
.
Place Place
Mean A
68. B
68.5
S.D of
heights(inches) 2.
5 3.
8
Sample
heights 120
5 150
0
Size 0 0
Coding:

#Name:
YASHI.S#
#REG
NO.:2413711034070#
n1=120
0
s1=2.
5
x1bar=68.
5
n2=150
0s2=3.
0
x2bar=68.5
8z=(x1bar-x2bar)/sqrt((s1*s1)/n1+(s2*s2)/

zn2)
alpha=0.0
5
z.half.alpha=qnorm(1-
alpha/2)
z.half.alph
a

Result:
H0:
µ1=µ2
H1: µ1≠µ2 (2-
tailed)
Test statistic: Z =
(x1bar-x2bar)/sqrt((s1*s1/n1)+(s2*s2/n2))
Calculated value = |-0.7556479| that is
0.7556479
Tabulated value =
1.959964
NAME:YASHI.S
REG NO:2413711034070

Conclusion:-
Since the calculated value is lesser than the tabulated value, we accept H0
and reject H1.
Therefore the mean height of the adults is the same in both places.
NAME:YASHI.S
REG NO:2413711034070

Output:
NAME:YASHI.S
REG NO:2413711034070

CHI-SQUARE TEST

Question:
The following data is collected on two characteristics. Based on this can you say there is
no
relationship between the habit of smoking and
literacy.

Smoker Non-Smokers
s
Literat 83 57
e
Illiterate 45 68

Coding:
#Name: YASHI.S#
#REG NO.:2413711034070#
print(getwd()
)
setwd("D:"
)
data=read.csv("CHISQR.CSV"
)
dat
a
chisq.test(data
)

Result:
H0: There is no relationship between the habit of smoking and
literacy.
H1: There is relationship between the habit of smoking and
literacy.
Calculated value =
0.003159
Tabulated value =
0.05

Conclusion:-
Since the calculated value is lesser than the tabulated value, we reject H0 and accept
H1.
Therefore there is a relationship between the habit of smoking and
literacy.
NAME:YASHI.S
REG NO:2413711034070

Output:

You might also like