Professional Documents
Culture Documents
Statistics Exp 1
Statistics Exp 1
Practice problem
Problem 1 :
Compute mean ,median and mode of for the
following frequency Distribution:
Height in Cm 145- 150 150- 155 155- 160 160- 165 165- 170 170- 175 175- 180 180-185
No. of Adult men 4 6 28 58 64 30 5 5
R code:-
# name= Pranav
> mid=seq(147.5,182.5,5)
> mid
> f=c(4,6,28,58,64,30,5,5)
> fr.distr=data.frame(mid,f)
> fr.distr
mid f
1 147.5 4
2 152.5 6
3 157.5 28
4 162.5 58
5 167.5 64
6 172.5 30
7 177.5 5
8 182.5 5
>
> # mean
>
> mean=(sum(mid*f))/sum(f)
> mean
[1] 165.175
> # median
>
> midx=seq(147.5,182.5,5)
> frequency=c(4,6,28,58,64,30,5,5)
> fr.dist<-data.frame(midx,frequency)
> fr.dist
midx frequency
1 147.5 4
2 152.5 6
3 157.5 28
4 162.5 58
5 167.5 64
6 172.5 30
7 177.5 5
8 182.5 5
> cl=cumsum(frequency)
> cl
> n=sum(frequency)
>n
[1] 200
> ml=min(which(cl>=n/2))
> ml
[1] 5
> h=5
>h
[1] 5
> f=frequency[ml]
>f
[1] 64
> l=mid[ml]-h/2
>l
[1] 165
> median=l+(((n/2)-c)/f)*h
> c=cl[ml-1]
>c
[1] 96
> median=l+(((n/2)-c)/f)*h
> median
[1] 165.3125
>
> # mode
> m=which(frequency==max(frequency))
>m
[1] 5
> fm=frequency[m]
> fm
[1] 64
> f1=frequency[m-1]
> f2=frequency[m+1]
> f1
[1] 58
> f2
[1] 30
> l=midx[m]-h/2
>l
[1] 165
> mode=l+((fm-f1)/(2*fm-f1-f2))*h
> mode
[1] 165.75
Screenshot:-
Problem 2:-
An entomologist studying morphological
variation in species of mosquito recorded the
following data on body length:
1.2,1.4,1.3,1.6,1.0,1.5,1.7,1.1,1.2,1.3
Compute all the measures of dispersion
Formula used:-
1. Range=largest value-smallest value
2. Quartile deviation=Q3-Q1/Q3+Q1
3. Mean deviation = E|x-a|/n
R code:-
# pranav
> # 18MIS0072
> x=c(1.2,1.4,1.3,1.6,1.0,1.5,1.7,1.1,1.2,1.3)
>x
[1] 1.2 1.4 1.3 1.6 1.0 1.5 1.7 1.1 1.2 1.3
> summary(x)
> range
[1] 0.7
> var(x)
[1] 0.049
> sd
[1] 0.2213594
> cqd
[1] 0.1028037
>
> y=(x-mean(x))
>y
[1] -0.13 0.07 -0.03 0.27 -0.33 0.17 0.37 -0.23 -0.13 -0.03
> y=abs(y)
>y
[1] 0.13 0.07 0.03 0.27 0.33 0.17 0.37 0.23 0.13 0.03
> mdl=sum(y)/length(y)
> mdl
[1] 0.176
>
> z=abs(x-median(x))
>z
[1] 0.1 0.1 0.0 0.3 0.3 0.2 0.4 0.2 0.1 0.0
> mdl2=sum(z)/length(z)
> mdl2
[1] 0.17
Screenshot:-
Challenging problems:-
Problem 1:-
A quality control engineer is interested in determining whether a machine is
properly adjusted to dispense 16 ounces of sugar. Following data refer to the
net weight (in ounces) packed in twenty on-pound bags after the machine was
adjusted . Compute the measures of skewness and kurtosis.
15.9,16.2,16.0,15.6,16.2,15.9,16.0,15.6,15.6,16.0
15.8,16.0,15.8,15.9,16.2,15.8,15.8,16.2,16.0,15.9
R code:-
> # 18MIS0072
>
x=c(15.9,16.2,16.0,15.6,16.2,15.9,16.0,15.6,16.0,15.8,16.0,15.8,15.9,16.2,15.8,16.2,15.8,16.2,16.0,15
.9)
>x
[1] 15.9 16.2 16.0 15.6 16.2 15.9 16.0 15.6 16.0 15.8 16.0 15.8 15.9 16.2 15.8 16.2 15.8 16.2 16.0
15.9
> n=length(x)
>n
[1] 20
> mean=mean(x)
> mean
[1] 15.95
> m4=sum((x-mean)^4)/n
> m4
[1] 0.00258125
> m2=var(x)
> m2
[1] 0.03526316
> beta2=m4/(m2^2)
> beta2
[1] 2.07581
> gam2=beta2-3
> gam2
[1] -0.9241897
Screenshot:-
Problem 2
For the following datas, Frame the continuous class frequency distribution
table of length 10 and calculate the measures of central tendency and
dispersion of it.
Marks of 250 canditates
R code:-
#18mis0072
>
x=c(32,54,38,44,68,41,30,43,46,41,40,31,40,40,36,46,48,32,40,17,48,47,37,52,48,47,32,26,21,41,53,
33,32,50,58,33,51,43,45,32,40,50,31,50,42,50,55,52,45,44,41,31,50,45,30,48,37,34,36,40,42,45,40,19
,61,32,43,42,17,57,31,57,47,23,60,51,46,40,31,52,21,35,38,15,37,36,41,34,24,30,34,55,34,47,35,58,3
7,46,41,38,41,15,38,37,52,28,29,38,23,40,51,50,34,34,44,44,43,34,34,38,33,41,44,47,38,30,37,42,41,
60,49,37,22,42,48,42,53,44,47,43,54,39,32,44,17,44,54,50,33,44,39,32,35,44,42,42,38,41,25,45,56,50
,38,37,50,35,41,33,34,33,26,42,44,42,38,18,56,22,18,38,36,40,50,52,30,44,32,58,33,31,39,48,24,33,4
6,29,45,38,24,43,48,42,62,37,38,41,32,17,38,28,35,45,49,37,38,31,53,43,47,36,31,47,42,48,40,53,48,
51,47,34,49,49,46,46,31,38,48,28,36,45,48,34,39,42,23,37,43,19,39,48)
>x
[1] 32 54 38 44 68 41 30 43 46 41 40 31 40 40 36 46 48 32 40 17 48 47 37 52 48 47 32 26 21 41 53
33 32 50 58 33 51 43 45 32 40 50 31 50 42 50 55 52 45 44 41 31 50 45 30 48 37
[58] 34 36 40 42 45 40 19 61 32 43 42 17 57 31 57 47 23 60 51 46 40 31 52 21 35 38 15 37 36 41 34
24 30 34 55 34 47 35 58 37 46 41 38 41 15 38 37 52 28 29 38 23 40 51 50 34 34
[115] 44 44 43 34 34 38 33 41 44 47 38 30 37 42 41 60 49 37 22 42 48 42 53 44 47 43 54 39 32 44 17
44 54 50 33 44 39 32 35 44 42 42 38 41 25 45 56 50 38 37 50 35 41 33 34 33 26
[172] 42 44 42 38 18 56 22 18 38 36 40 50 52 30 44 32 58 33 31 39 48 24 33 46 29 45 38 24 43 48 42
62 37 38 41 32 17 38 28 35 45 49 37 38 31 53 43 47 36 31 47 42 48 40 53 48 51
[229] 47 34 49 49 46 46 31 38 48 28 36 45 48 34 39 42 23 37 43 19 39 48
> summary(x)
> range=68-15
> range
[1] 53
> var(x)
[1] 93.81423
> sd=sqrt(var(x))
> sd
[1] 9.685775
> cqd=(47-34)/(47+34)
> cqd
[1] 0.1604938
> y=(x-mean(x))
>y
[1] -7.968 14.032 -1.968 4.032 28.032 1.032 -9.968 3.032 6.032 1.032 0.032 -8.968
0.032 0.032 -3.968 6.032 8.032 -7.968 0.032 -22.968 8.032
[22] 7.032 -2.968 12.032 8.032 7.032 -7.968 -13.968 -18.968 1.032 13.032 -6.968 -7.968
10.032 18.032 -6.968 11.032 3.032 5.032 -7.968 0.032 10.032
[43] -8.968 10.032 2.032 10.032 15.032 12.032 5.032 4.032 1.032 -8.968 10.032 5.032 -
9.968 8.032 -2.968 -5.968 -3.968 0.032 2.032 5.032 0.032
[64] -20.968 21.032 -7.968 3.032 2.032 -22.968 17.032 -8.968 17.032 7.032 -16.968 20.032
11.032 6.032 0.032 -8.968 12.032 -18.968 -4.968 -1.968 -24.968
[85] -2.968 -3.968 1.032 -5.968 -15.968 -9.968 -5.968 15.032 -5.968 7.032 -4.968 18.032 -
2.968 6.032 1.032 -1.968 1.032 -24.968 -1.968 -2.968 12.032
[106] -11.968 -10.968 -1.968 -16.968 0.032 11.032 10.032 -5.968 -5.968 4.032 4.032 3.032 -
5.968 -5.968 -1.968 -6.968 1.032 4.032 7.032 -1.968 -9.968
[127] -2.968 2.032 1.032 20.032 9.032 -2.968 -17.968 2.032 8.032 2.032 13.032 4.032
7.032 3.032 14.032 -0.968 -7.968 4.032 -22.968 4.032 14.032
[148] 10.032 -6.968 4.032 -0.968 -7.968 -4.968 4.032 2.032 2.032 -1.968 1.032 -14.968
5.032 16.032 10.032 -1.968 -2.968 10.032 -4.968 1.032 -6.968
[169] -5.968 -6.968 -13.968 2.032 4.032 2.032 -1.968 -21.968 16.032 -17.968 -21.968 -1.968 -
3.968 0.032 10.032 12.032 -9.968 4.032 -7.968 18.032 -6.968
[190] -8.968 -0.968 8.032 -15.968 -6.968 6.032 -10.968 5.032 -1.968 -15.968 3.032 8.032
2.032 22.032 -2.968 -1.968 1.032 -7.968 -22.968 -1.968 -11.968
[211] -4.968 5.032 9.032 -2.968 -1.968 -8.968 13.032 3.032 7.032 -3.968 -8.968 7.032
2.032 8.032 0.032 13.032 8.032 11.032 7.032 -5.968 9.032
[232] 9.032 6.032 6.032 -8.968 -1.968 8.032 -11.968 -3.968 5.032 8.032 -5.968 -0.968
2.032 -16.968 -2.968 3.032 -20.968 -0.968 8.032
> y=abs(y)
>y
[1] 7.968 14.032 1.968 4.032 28.032 1.032 9.968 3.032 6.032 1.032 0.032 8.968 0.032 0.032
3.968 6.032 8.032 7.968 0.032 22.968 8.032 7.032 2.968 12.032
[25] 8.032 7.032 7.968 13.968 18.968 1.032 13.032 6.968 7.968 10.032 18.032 6.968 11.032
3.032 5.032 7.968 0.032 10.032 8.968 10.032 2.032 10.032 15.032 12.032
[49] 5.032 4.032 1.032 8.968 10.032 5.032 9.968 8.032 2.968 5.968 3.968 0.032 2.032 5.032
0.032 20.968 21.032 7.968 3.032 2.032 22.968 17.032 8.968 17.032
[73] 7.032 16.968 20.032 11.032 6.032 0.032 8.968 12.032 18.968 4.968 1.968 24.968 2.968
3.968 1.032 5.968 15.968 9.968 5.968 15.032 5.968 7.032 4.968 18.032
[97] 2.968 6.032 1.032 1.968 1.032 24.968 1.968 2.968 12.032 11.968 10.968 1.968 16.968
0.032 11.032 10.032 5.968 5.968 4.032 4.032 3.032 5.968 5.968 1.968
[121] 6.968 1.032 4.032 7.032 1.968 9.968 2.968 2.032 1.032 20.032 9.032 2.968 17.968
2.032 8.032 2.032 13.032 4.032 7.032 3.032 14.032 0.968 7.968 4.032
[145] 22.968 4.032 14.032 10.032 6.968 4.032 0.968 7.968 4.968 4.032 2.032 2.032 1.968
1.032 14.968 5.032 16.032 10.032 1.968 2.968 10.032 4.968 1.032 6.968
[169] 5.968 6.968 13.968 2.032 4.032 2.032 1.968 21.968 16.032 17.968 21.968 1.968 3.968
0.032 10.032 12.032 9.968 4.032 7.968 18.032 6.968 8.968 0.968 8.032
[193] 15.968 6.968 6.032 10.968 5.032 1.968 15.968 3.032 8.032 2.032 22.032 2.968 1.968
1.032 7.968 22.968 1.968 11.968 4.968 5.032 9.032 2.968 1.968 8.968
[217] 13.032 3.032 7.032 3.968 8.968 7.032 2.032 8.032 0.032 13.032 8.032 11.032 7.032
5.968 9.032 9.032 6.032 6.032 8.968 1.968 8.032 11.968 3.968 5.032
[241] 8.032 5.968 0.968 2.032 16.968 2.968 3.032 20.968 0.968 8.032
> mdl=sum(y)/length(y)
> mdl
[1] 7.602816
> z=abs(x-median(x))
> mdl2=sum(z)/length(z)
> mdl2
[1] 7.6
Screenshot:-
Lab observation:-