You are on page 1of 4

MAT2001 – Statistics for Engineers

Embedded Lab – R Statistical Software

WINTER SEMESTER – 2019 ∼ 2020


L1+L2 SLOT

E-RECORD
Experiment No.: 01

Submitted By

Vunnam Lakshmi sai rama krishna


Reg. No.: 18MIS0340
MTech.(SE) – I Year SITE

DEPARTMENT OF MATHEMATICS
SCHOOL OF ADVANCED SCIENCES
VELLORE INSTITUTE OF TECHNOLOGY
VELLORE – 632 014
TAMIL NADU
INDIA

Date: 0 6 - 0 1 - 2 0 2 0
Experiment No.: 1
Measures of Central Tendency, Dispersion,
Skewness and Kurtosis
Experiment Date: 0 6 - 0 1 - 2 0 2 0

Program / Problem No.: 01

1. Aim of the Program / Problem Statement:


Write the R programming code for computing the mean, median, mode, variance, standard
deviation, co-efficient of variation, first four moments about the mean and Pearson’s
coefficients β1 & β2 for the following frequency distribution, and also comment the nature
of skewness and kurtosis of the distribution based on the Pearson’s co-efficient β1 & β2.

2. R Programming Part

2.1. Inputs in R Software

2.2. R Programming Code

#MEAN
> h=10
> x=seq(15,95,h)
> f=c(65,50,65,90,91,55,70,5,31)
> M=(sum(x*f))/sum(f)
>M
[1] 49.3295

#MEDIAN
> cf=cumsum(f)
> N=sum(f)
> mc=min(which(cf>=N/2))
> mcf=f[mc]
> c=cf[mc-1]
> l=x[mc]-h/2
> Md
[1] 49
#MODE
> mc
> f1=f[mc]
> f0=f[mc-1]
> f2=f[mc+1]
> l=x[mc]-h/2
> M0=l+((f1-f0)/(2*f1-f0-f2))*h
> M0
>50.2

#QUARTILE DEVIATION
> q1=min(which(cf>=N/4))
> q3=min(which(cf>=(3*N)/4))
> Q1=x[q1]
> Q3=x[q3]
> QD=(1/2)*(Q3-Q1)
> Q1=(x[q1]-h/2) + ((h/f[q1])*(N/4-cf[q1-1]))
> Q1
[1] 32.38462
> Q3=(x[q3]-h/2) + ((h/f[q3])*(3*N/4-cf[q3-1]))
> Q3
[1] 65.54545
> QD=(1/2)*(Q3-Q1)
> QD
[1] 16.58042

#VARIANCE
> var=((1/N)*(sum((x^2)*f)))-M^2
> var
[1] 488.152

#STANDARD DEVIATION
> SD=sqrt(var)
> SD
[1] 22.09416

#CO-VARIANCE
> CV=100*(SD/M)
> CV
[1] 44.78894

#PEARSONS COEFFICIENTS
> M1=sum(((x-M)^1)*f)/N
> M2=sum(((x-M)^2)*f)/N
> M3=sum(((x-M)^3)*f)/N
> M4=sum(((x-M)^4)*f)/N
> B1=(M3^2)/(M2^3)
> B2=(M4)/(M2^2)
> B1
[1] 0.03438487
> B2
[1] 2.310008
2.3. Outputs (Expressions or Figures) in R Software

Mean (M)=49.3295,
Median (Md)=49,
Mode (M0) =50.2,
Quartile Deviation (QD) =16.58042,
Variance (var) =488.152,
Standard Deviation (SD) = 22.09416
Co-variance (CV) =44.78894,
Pearson’s Coefficients: B1 =0.03438487, B2 =2.310008
3. Proof for Output Execution in Lab Hours

**********

You might also like