Professional Documents
Culture Documents
Stats Math Da1 Problem1
Stats Math Da1 Problem1
LAB(STATISTICS)
DIGITAL ASSIGNMENT -1
SOMYA RATHI
(20BCE2323)
PROBLEM-1
AIM:
The aim of problem 1 is to find mean and median of grouped (discrete) data,
given their frequency distribution table (responses).
FORMULAE:
∑ 𝑓𝑥
1. mean = ∑𝑓
x=class ; f=frequency
R – SYNTAX:
X<-c(x1,x2,x3,x4) :R syntax for assigning x values
PROBLEM STATEMENT:
R-CODE:
> #20BCE2323
> date()
> #problem 1
>
> X<-c(0,1,2,3)
> F<-c(8,11,5,1)
> Y<-rep(X,F)
>Y
[1] 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 3
> mean(Y)
[1] 0.96
> median(Y)
[1] 1
> #20BCE2323
> date()
>