Determinants of health, dimensions of health, positive health and spectrum of...
Mean, median, mode 1
1. Measures of Central Tendency
with R Programming Language
Ph.D Kucherenko Svitlana
2. There are three measures of central tendencies:
modemedianmean
3. Mean
Example :
Data Set = 3, 5, 1,
4, 7, 6, 8, 2, 9
Number of
Elements in Data
Set = 9
Mean
=(3+5+1+4+7+6+8
+2+9)/ 9 =45/9=5
4. R can be downloaded from
http://cran.r-project.org/
x<-c(3,5,1,4,7,6,8,2,9)
Where x – vector name; <- Assignment Operator;
c(3,5,1,4,7,6,8,2,9) – Vector Contents
c() (for concatenate)
x
>x<-c(3,5,1,4,7,6,8,2,9)
> x
x[1] 3 5 1 4 7 6 8 2 9
> mean(x)
[1] 5
mean ()
5.
6. Median
1. Reorder the data set from the smallest to
the largest
2. Understand the number of elements are
odd or even
7. Examples : Odd Number of Elements
Data Set = 1, 5, 9, 3, 5, 4, 8
Reordered = 1, 3, 4, 5, 5, 8, 9
Median = 5
Examples : Even Number of Elements
Data Set = 1, 5, 8, 3, 5, 4
Reordered = 1, 3, 4, 5, 5, 8
Median = ( 4 + 5 ) / 2 = 4.5
9. Mode
A data set with two modes is called bimodal.
A data set with three modes is called
trimodal.
Examples:
Single Mode Data Set = 1, 5, 8, 3, 5, 4, 7
Mode = 5
Examples:
Bimodal Data Set = 2, 5, 2, 1, 5, 4, 9
Modes = 2 and 5
Examples:
Trimodal Data Set = 2, 5, 2, 8, 5, 6, 8
Modes = 2, 5, and 8