Berikut ini adalah data demografi dari WHO yang diperoleh dari www.kaggle.com
| Country | Year | Status | Life.expectancy | Adult.Mortality | infant.deaths | Alcohol | percentage.expenditure | Hepatitis.B | Measles | BMI | under.five.deaths | Polio | Total.expenditure | Diphtheria | HIV.AIDS | GDP | Population | thinness..1.19.years | thinness.5.9.years | Income.composition.of.resources | Schooling |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Afghanistan | 2015 | Developing | 65.0 | 263 | 62 | 0.01 | 71.279624 | 65 | 1154 | 19.1 | 83 | 6 | 8.16 | 65 | 0.1 | 584.25921 | 33736494 | 17.2 | 17.3 | 0.479 | 10.1 |
| Afghanistan | 2014 | Developing | 59.9 | 271 | 64 | 0.01 | 73.523582 | 62 | 492 | 18.6 | 86 | 58 | 8.18 | 62 | 0.1 | 612.69651 | 327582 | 17.5 | 17.5 | 0.476 | 10.0 |
| Afghanistan | 2013 | Developing | 59.9 | 268 | 66 | 0.01 | 73.219243 | 64 | 430 | 18.1 | 89 | 62 | 8.13 | 64 | 0.1 | 631.74498 | 31731688 | 17.7 | 17.7 | 0.470 | 9.9 |
| Afghanistan | 2012 | Developing | 59.5 | 272 | 69 | 0.01 | 78.184215 | 67 | 2787 | 17.6 | 93 | 67 | 8.52 | 67 | 0.1 | 669.95900 | 3696958 | 17.9 | 18.0 | 0.463 | 9.8 |
| Afghanistan | 2011 | Developing | 59.2 | 275 | 71 | 0.01 | 7.097109 | 68 | 3013 | 17.2 | 97 | 68 | 7.87 | 68 | 0.1 | 63.53723 | 2978599 | 18.2 | 18.2 | 0.454 | 9.5 |
| Afghanistan | 2010 | Developing | 58.8 | 279 | 74 | 0.01 | 79.679367 | 66 | 1989 | 16.7 | 102 | 66 | 9.20 | 66 | 0.1 | 553.32894 | 2883167 | 18.4 | 18.4 | 0.448 | 9.2 |
| Country | RataRataHarapanHidup |
|---|---|
| Japan | 82.53750 |
| Sweden | 82.51875 |
| Iceland | 82.44375 |
| Switzerland | 82.33125 |
| France | 82.21875 |
| Italy | 82.18750 |
| Spain | 82.06875 |
| Australia | 81.81250 |
| Norway | 81.79375 |
| Canada | 81.68750 |
| Country | RataRataHarapanHidup |
|---|---|
| Nigeria | 51.35625 |
| Swaziland | 51.32500 |
| Zimbabwe | 50.48750 |
| Côte d’Ivoire | 50.38750 |
| Chad | 50.38750 |
| Malawi | 49.89375 |
| Angola | 49.01875 |
| Lesotho | 48.78125 |
| Central African Republic | 48.51250 |
| Sierra Leone | 46.11250 |
Negara Japan memiliki rata-rata harapan hidup paling tinggi yaitu 82.5375 Tahun. Sementara negara Sierra Leone memiliki rata-rata harapan hidup paling rendah yaitu 46.1125 Tahun. Indonesia memiliki rata-rata hidup 67.55625 Tahun. Angka tersebut Lebih Rendah daripada rata-rata hidup global yaitu 69.2249317 Tahun
Hasil pengujian shapiro menunjukan bahwa data rata-rata harapan hidup di negara maju 0.944 dan di negara berkembang 0.922 dengan p.value masing-masing adalah 0.406 dan 0.185
Grafik Normalitas Data Variabel Life.expectancy
ggplot(DataWHO, aes(x = Life.expectancy))+ geom_histogram()
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.
## Warning: Removed 10 rows containing non-finite values (stat_bin).
Hasil pengujian kehomogenan menggunakan metode var.test dan bartlett.test menunjukan bahwa varian data rata-rata harapan hidup adalah 0.619 dengan nilai p.value keduanya adalah 0,364 lebih kecil daripada 0.05, masing-masing dengan nilai 0.619 dan 0.8221
##
## Two Sample t-test
##
## data: RataRataHarapanHidup by Status
## t = 21.671, df = 30, p-value < 2.2e-16
## alternative hypothesis: true difference in means between group Developed and group Developing is not equal to 0
## 95 percent confidence interval:
## 10.94739 13.22538
## sample estimates:
## mean in group Developed mean in group Developing
## 79.19785 67.11147
Hasil Uji Beda Rata-Rata Usia Harapan Hidup antara negara berkembang dengan negara maju, secara statistik, diketahui nilai t = 21.671 dan beda rata-rata secara signifikan dengan p.value sebesar 2.2e-16, lebih kecil daripada 0.05
DataKelompok <- DataWHO %>%
group_by(Status) %>%
summarize(RataRataHarapanHidup = mean(Life.expectancy, na.rm=TRUE)) %>%
filter(!is.nan(RataRataHarapanHidup))
ggplot(DataKelompok, aes(x=Status, y=RataRataHarapanHidup, fill=Status)) +
geom_bar(stat = "identity")
### Perbandingan pada negara-negara ASEAN #### [1]
DataKelompok <- DataWHO %>%
filter(Country %in% c("Indonesia","Thailand","Malaysia","Singapore","Vietnam","Philippines")) %>%
group_by(Country) %>%
summarize(RataRataHarapanHidup = mean(Life.expectancy, na.rm=TRUE)) %>%
filter(!is.nan(RataRataHarapanHidup))
ggplot(DataKelompok, aes(x=Country, y=RataRataHarapanHidup, fill=Country)) +
geom_bar(stat = "identity") +
geom_text(aes(label=as.integer(RataRataHarapanHidup)), position=position_dodge(width=0.9), vjust=-0.25)
DataKelompok <- DataWHO %>%
filter(Country %in% c("Indonesia","Thailand","Malaysia","Singapore","Vietnam","Philippines")) %>%
group_by(Year, Country) %>%
summarize(RataRataHarapanHidup = mean(Life.expectancy, na.rm=TRUE)) %>%
filter(!is.nan(RataRataHarapanHidup))
## `summarise()` has grouped output by 'Year'. You can override using the
## `.groups` argument.
ggplot(DataKelompok,
aes(x = Year,
y = RataRataHarapanHidup,
color = Country))+
geom_point() +
geom_line()
ggplot(TrenHarapanHidup) +
geom_point(aes(x = Year, y = RataRataHarapanHidup, colour = RataRataHarapanHidup), size = 3) +
geom_line(data = TrenHarapanHidup, aes(x = Year, y = RataRataHarapanHidup))
library(ggplot2)
Data <- DataWHO %>%
mutate(GDPPerKapita = (GDP)/Population) %>%
group_by(Country) %>%
summarize(MeanGDP = mean(GDPPerKapita, na.rm=TRUE),
MeanHarapanHidup = mean(Life.expectancy, na.rm=TRUE)) %>%
filter(!is.na(MeanGDP) & !is.na(MeanHarapanHidup))
gg <- ggplot(Data, aes(x=MeanGDP, y=MeanHarapanHidup)) +
geom_point(aes(x=MeanGDP, y=MeanHarapanHidup)) +
geom_smooth(method="loess", se=F) +
labs(subtitle="Life Expectancy Vs Population",
y="Life Expectancy",
x="Population",
title="Scatterplot",
caption = "Source: WHO")
plot(gg)
## `geom_smooth()` using formula 'y ~ x'
library(tidyr)
library(reshape2)
##
## Attaching package: 'reshape2'
## The following object is masked from 'package:tidyr':
##
## smiths
cordf <- DataWHO %>%
drop_na() %>%
select(Hepatitis.B, Polio, Measles, HIV.AIDS, Diphtheria)
cormat <- cor(cordf)
melted <- melt(cormat, varnames = c("X","Y"))
ggplot(melted)+
geom_tile(aes(X, Y, fill=value))