Mean and Median Korea Income 2003-2009

Load Data

load("income_03_09.rda")
ls()
##  [1] "income.03.09"        "mean.income"         "median.income"      
##  [4] "median.mean.ratio"   "old.dir"             "old.par"            
##  [7] "results.pictogram"   "results.pictogram.2" "results.pictogram.3"
## [10] "results.pictoram.2"  "Titanic.df"

Set up a data matrix

income.03.09<-cbind(mean=mean.income, median=median.income)
income.03.09
##      mean median
## [1,] 2846   2581
## [2,] 2885   2603
## [3,] 2910   2657
## [4,] 2966   2671
## [5,] 3041   2720
## [6,] 3037   2704
## [7,] 3055   2664
rownames(income.03.09)<-2003:2009
income.03.09
##      mean median
## 2003 2846   2581
## 2004 2885   2603
## 2005 2910   2657
## 2006 2966   2671
## 2007 3041   2720
## 2008 3037   2704
## 2009 3055   2664

Compare the two plots

par(mfrow=c(1,2))
plot(mean~as.numeric(rownames(income.03.09)), data=income.03.09, type="b", ylim=c(2500,3100), ann=F, xlab="", ylab="")
title(xlab="Year", ylab="Income (10,000 won)")
lines(median~as.numeric(rownames(income.03.09)), data=income.03.09, type="b", lty=2)
legend("topleft", inset=0.02, lty=1:2, legend=c("mean", "median")) 
plot(mean~as.numeric(rownames(income.03.09)), data=income.03.09, type="b", ylim=c(2000,3500), ann=F, xlab="", ylab="")
title(xlab="Year", ylab="Income (10,000 won)")
lines(median~as.numeric(rownames(income.03.09)), data=income.03.09, type="b", lty=2)
legend("topleft", inset=0.02, lty=1:2, legend=c("mean", "median")) 
mtext("Pictogram : Case of Korea Income", side=3, outer=TRUE, line=-3)

par(mfrow=c(1,1))

Compute median/mean ratio

options(digits=3)
median.mean.ratio<-median.income/mean.income*100
median.mean.ratio
## [1] 90.7 90.2 91.3 90.1 89.4 89.0 87.2

Compare the two plots

par(mfrow=c(1,2))
plot(median.mean.ratio~as.numeric(rownames(income.03.09)), type="b", xlab="Year", ylab="Median/Mean Ratio(%)")
plot(median.mean.ratio~as.numeric(rownames(income.03.09)), type="b", xlab="Year", ylab="Median/Mean Ratio(%)", ylim=c(50,100))
mtext("Pictogram : Case of Median/Mean Ratio", side=3, outer=TRUE, line=-3)

par(mfrow=c(1,1))