Tugas Analisis Eksplorasi Data

A. Tahapan Pra-Prosessing

Import Data Excell

library(readxl)
## Warning: package 'readxl' was built under R version 4.1.2
lembar1 <- read_xlsx("C:/SMT 4/Analisis Eksplorasi Data/3/Data untuk Eksplorasi (1).xlsx", sheet=1)
lembar3 <- read_xlsx("C:/SMT 4/Analisis Eksplorasi Data/3/Data untuk Eksplorasi (1).xlsx", sheet=3)
## New names:
## * `` -> ...2
## * `` -> ...3
## * `` -> ...4
## * `` -> ...5
## * `` -> ...6
## * ...
str(lembar1)
## tibble [118 x 38] (S3: tbl_df/tbl/data.frame)
##  $ Country: chr [1:118] "Country" "CH" "DE" "DK" ...
##  $ X2     : chr [1:118] "GDP (USDbn)" "749.0176725" "3793.593164" "355.1840323" ...
##  $ X3     : chr [1:118] "Real GDP growth ( avg last 5yrs%)" "1.88522" "1.62892" "2.68708" ...
##  $ X4     : chr [1:118] "Real GDP growth (%)" "-2.7232" "-4.7654" "-2.7333" ...
##  $ X5     : chr [1:118] "Consumer prices ( avg annual avg. % growth 5yrs)" "0.00116" "1.20768" "0.54" ...
##  $ X6     : chr [1:118] "Consumer prices (annual avg. % growth)" "-0.0084" "0.3778" "0.3" ...
##  $ X7     : chr [1:118] "Gross dom. inv. (% GDP avg 5yrs)" "24.41888" "20.71144" "22.06322" ...
##  $ X8     : chr [1:118] "Gross dom. inv. (% GDP)" "24.5284" "20.2475" "23.1748" ...
##  $ X9     : chr [1:118] "Gross dom. svg. (% GDP avg 5yrs)" "36.5367" "27.49714" "28.83828" ...
##  $ X10    : chr [1:118] "Gross dom. svg. (% GDP)" "37.0514" "25.9843" "29.6644" ...
##  $ X39    : chr [1:118] "Bank System Assets (% GDP avg 5yr)" "473.2558" "179.5237" "281.1473" ...
##  $ X40    : chr [1:118] "Bank System Assets (% GDP)" "523.8202" "193.952499113789" "310.480386182536" ...
##  $ X42    : chr [1:118] "Loan-deposit ratio (% avg 5yr)" "84.47336" "144.0191" "355.6127" ...
##  $ X43    : chr [1:118] "Loan-deposit ratio (%)" "82.5" "138.357238793467" "359.138861033201" ...
##  $ X44    : chr [1:118] "Capital adequacy ratio (% avg 5yr)" "17.92784" "18.782" "21.346" ...
##  $ X45    : chr [1:118] "Capital adequacy ratio (%)" "19.3" "18.58" "22.6" ...
##  $ X46    : chr [1:118] "Non-performing loans (% of gross loans avg 5yr)" "0.6909" "1.494" "2.52018" ...
##  $ X47    : chr [1:118] "Non-performing loans (% of gross loans)" "0.75" NA "1.8" ...
##  $ X60    : chr [1:118] "NXD (% GDP avg 5yr)" "-152.445" "-15.6481" "-5.59082" ...
##  $ X61    : chr [1:118] "NXD (% GDP)" "-154.9536" "-19.0912" "-13.995" ...
##  $ X66    : chr [1:118] "GXD (% GDP avg 5yr)" "275.6169" "165.293" "155.8403" ...
##  $ X67    : chr [1:118] "GXD (% GDP)" "319.5953" "205.9636" "194.6712" ...
##  $ X102   : chr [1:118] "GDP per cap. (USD)" "89770.8521" "50891.5812" "67565.6556" ...
##  $ X103   : chr [1:118] "GDP per cap. (% US)" "129.49325180099" "73.4104242604391" "97.4625532568579" ...
##  $ X104   : chr [1:118] "GNI per cap. (PPP)e (USD)" "71660" "57410" "62120" ...
##  $ X105   : chr [1:118] "GNI per cap. (PPP)e (% US)" "108.444309927361" "86.8795399515738" "94.0072639225182" ...
##  $ X106   : chr [1:118] "Real GDP per cap. (%, 5Y av. gr.)" "0.1733" "-0.1226" "1.3106" ...
##  $ X107   : chr [1:118] "Population (%, 5Y av. gr.)" "0.8402" "0.4835" "0.3613" ...
##  $ X108   : chr [1:118] "Unemployment (% labour force avg 5yr)" "2.88574" "3.73164" "5.5" ...
##  $ X109   : chr [1:118] "Unemployment (% labour force)" "3.1728" "4.8177" "5.4" ...
##  $ X111   : chr [1:118] "Pol. Stab." "94.7619018554687" "66.6666641235352" "83.8095245361328" ...
##  $ X112   : chr [1:118] "Gov. Eff." "99.5192337036133" "93.2692337036133" "99.038459777832" ...
##  $ X113   : chr [1:118] "Rule of Law" "99.038459777832" "92.3076934814453" "98.0769195556641" ...
##  $ X114   : chr [1:118] "Ctrl. of Corr." "96.1538467407227" "95.1923065185547" "97.5961532592773" ...
##  $ X115   : chr [1:118] "Reg. Qual." "94.711540222168" "96.1538467407227" "92.3076934814453" ...
##  $ X116   : chr [1:118] "Voice & Acc-ty" "97.0443344116211" "95.0738906860352" "98.5221710205078" ...
##  $ X117   : chr [1:118] "HDI" "98.9" "97.3" "95.2" ...
##  $ X118   : chr [1:118] "Ease of DB (p-tile)f" "81.5" "88.9" "98.5" ...
str(lembar3)
## tibble [251 x 11] (S3: tbl_df/tbl/data.frame)
##  $ source: https://raw.githubusercontent.com/lukes/ISO-3166-Countries-with-Regional-Codes/master/all/all.csv: chr [1:251] NA "name" "Afghanistan" "Ã…land Islands" ...
##  $ ...2                                                                                                     : chr [1:251] NA "alpha-2" "AF" "AX" ...
##  $ ...3                                                                                                     : chr [1:251] NA "alpha-3" "AFG" "ALA" ...
##  $ ...4                                                                                                     : chr [1:251] NA "country-code" "4" "248" ...
##  $ ...5                                                                                                     : chr [1:251] NA "iso_3166-2" "ISO 3166-2:AF" "ISO 3166-2:AX" ...
##  $ ...6                                                                                                     : chr [1:251] NA "region" "Asia" "Europe" ...
##  $ ...7                                                                                                     : chr [1:251] NA "sub-region" "Southern Asia" "Northern Europe" ...
##  $ ...8                                                                                                     : chr [1:251] NA "intermediate-region" NA NA ...
##  $ ...9                                                                                                     : chr [1:251] NA "region-code" "142" "150" ...
##  $ ...10                                                                                                    : chr [1:251] NA "sub-region-code" "34" "154" ...
##  $ ...11                                                                                                    : chr [1:251] NA "intermediate-region-code" NA NA ...

Rename kolom lembar3

colnames(lembar3) <- c("Negara", "Alpha.2", "Alpha.3", "Kode_Negara", "Kode_ISO", "Region", "Sub_Region", "Intermediate_Region", "Kode_Region", "Kode_Sub.Region", "Intermediate_Kode.Region")

Mengubah Tipe Data

lembar1['Country'] <- as.factor(lembar1[['Country']]) 
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
lembar1 <- lembar1 %>%
  mutate(across(where(is.character), as.numeric))
## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion

## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion
lembar1['Country'] <- as.character(lembar1[['Country']]) #ubah lagi tipe data variabel country menjadi chr
str(lembar1)
## tibble [118 x 38] (S3: tbl_df/tbl/data.frame)
##  $ Country: chr [1:118] "Country" "CH" "DE" "DK" ...
##  $ X2     : num [1:118] NA 749 3793.6 355.2 73.1 ...
##  $ X3     : num [1:118] NA 1.89 1.63 2.69 3.23 ...
##  $ X4     : num [1:118] NA -2.72 -4.77 -2.73 -1.31 ...
##  $ X5     : num [1:118] NA 0.00116 1.20768 0.54 1.17428 ...
##  $ X6     : num [1:118] NA -0.0084 0.3778 0.3 0.4 ...
##  $ X7     : num [1:118] NA 24.4 20.7 22.1 18.4 ...
##  $ X8     : num [1:118] NA 24.5 20.2 23.2 15.7 ...
##  $ X9     : num [1:118] NA 36.5 27.5 28.8 53.7 ...
##  $ X10    : num [1:118] NA 37.1 26 29.7 54.5 ...
##  $ X39    : num [1:118] NA 473 180 281 1618 ...
##  $ X40    : num [1:118] NA 524 194 310 1660 ...
##  $ X42    : num [1:118] NA 84.5 144 355.6 46.3 ...
##  $ X43    : num [1:118] NA 82.5 138.4 359.1 42.7 ...
##  $ X44    : num [1:118] NA 17.9 18.8 21.3 23.3 ...
##  $ X45    : num [1:118] NA 19.3 18.6 22.6 23.9 ...
##  $ X46    : num [1:118] NA 0.691 1.494 2.52 NA ...
##  $ X47    : num [1:118] NA 0.75 NA 1.8 1.03 ...
##  $ X60    : num [1:118] NA -152.44 -15.65 -5.59 -1955.72 ...
##  $ X61    : num [1:118] NA -155 -19.1 -14 -2807.2 ...
##  $ X66    : num [1:118] NA 276 165 156 6908 ...
##  $ X67    : num [1:118] NA 320 206 195 5946 ...
##  $ X102   : num [1:118] NA 89771 50892 67566 124340 ...
##  $ X103   : num [1:118] NA 129.5 73.4 97.5 179.4 ...
##  $ X104   : num [1:118] NA 71660 57410 62120 77350 ...
##  $ X105   : num [1:118] NA 108.4 86.9 94 117.1 ...
##  $ X106   : num [1:118] NA 0.1733 -0.1226 1.3106 0.0792 ...
##  $ X107   : num [1:118] NA 0.84 0.483 0.361 2.022 ...
##  $ X108   : num [1:118] NA 2.89 3.73 5.5 5.97 ...
##  $ X109   : num [1:118] NA 3.17 4.82 5.4 6.8 ...
##  $ X111   : num [1:118] NA 94.8 66.7 83.8 95.7 ...
##  $ X112   : num [1:118] NA 99.5 93.3 99 95.7 ...
##  $ X113   : num [1:118] NA 99 92.3 98.1 95.7 ...
##  $ X114   : num [1:118] NA 96.2 95.2 97.6 98.1 ...
##  $ X115   : num [1:118] NA 94.7 96.2 92.3 95.2 ...
##  $ X116   : num [1:118] NA 97 95.1 98.5 96.6 ...
##  $ X117   : num [1:118] NA 98.9 97.3 95.2 87.7 95.7 100 96.8 91.4 95.7 ...
##  $ X118   : num [1:118] NA 81.5 88.9 98.5 62.5 78.4 95.8 95.3 97.4 93.2 ...

Penggabungan sheet1 dan sheet3 berdasarkan kode negara Alpha.2

data_merge <- merge(lembar1, lembar3, by.x=1, by.y=2, all=FALSE)

Save Data

library(writexl)
## Warning: package 'writexl' was built under R version 4.1.2
write_xlsx(data_merge, 'Datafix (1).xlsx')

B. Proses Awal

IMPORT DATA

library(readxl)
TugasAED<-read_xlsx("C:/SMT 4/Analisis Eksplorasi Data/3/Datafix.xlsx")
head(TugasAED)
## # A tibble: 6 x 48
##   Country     X2     X3     X4    X5    X6    X7    X8    X9   X10   X39   X40
##   <chr>    <dbl>  <dbl>  <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
## 1 AD        2.86  1.79  -11.8   0.68  0.3   NA    NA   NA    NA    564.  605. 
## 2 AE      353.    2.66   -7.51  1.77 -2.07  24.9  23.8 50.1  47.8  176.  226. 
## 3 AM       12.6   4.75   -7.6   1.44  1.2   19.4  17.2  7.93  8.58  81.0 109. 
## 4 AO       62.5  -0.878  -3.98 22.4  21.8   NA    NA   32.0  31.3   47.3  44.7
## 5 AR      375.   -0.237  -9.91 36.7  42.7   16.7  13.8 17.1  20.2   NA    NA  
## 6 AT      430.    1.88   -6.26  1.52  1.39  24.8  25.2 28.2  28.7  177.  183. 
## # ... with 36 more variables: X42 <dbl>, X43 <dbl>, X44 <dbl>, X45 <dbl>,
## #   X46 <dbl>, X47 <dbl>, X60 <dbl>, X61 <dbl>, X66 <dbl>, X67 <dbl>,
## #   X102 <dbl>, X103 <dbl>, X104 <dbl>, X105 <dbl>, X106 <dbl>, X107 <dbl>,
## #   X108 <dbl>, X109 <dbl>, X111 <dbl>, X112 <dbl>, X113 <dbl>, X114 <dbl>,
## #   X115 <dbl>, X116 <dbl>, X117 <dbl>, X118 <dbl>, Negara <chr>,
## #   Alpha.3 <chr>, Kode_Negara <dbl>, Kode_ISO <chr>, Region <chr>,
## #   Sub_Region <chr>, Intermediate_Region <chr>, Kode_Region <dbl>, ...
str(TugasAED)
## tibble [115 x 48] (S3: tbl_df/tbl/data.frame)
##  $ Country                 : chr [1:115] "AD" "AE" "AM" "AO" ...
##  $ X2                      : num [1:115] 2.86 352.91 12.65 62.49 375.19 ...
##  $ X3                      : num [1:115] 1.786 2.659 4.748 -0.878 -0.237 ...
##  $ X4                      : num [1:115] -11.81 -7.51 -7.6 -3.98 -9.91 ...
##  $ X5                      : num [1:115] 0.68 1.77 1.44 22.36 36.7 ...
##  $ X6                      : num [1:115] 0.3 -2.07 1.2 21.83 42.68 ...
##  $ X7                      : num [1:115] NA 24.9 19.4 NA 16.7 ...
##  $ X8                      : num [1:115] NA 23.8 17.2 NA 13.8 ...
##  $ X9                      : num [1:115] NA 50.12 7.93 32.02 17.11 ...
##  $ X10                     : num [1:115] NA 47.81 8.58 31.33 20.22 ...
##  $ X39                     : num [1:115] 564.5 176.3 81 47.3 NA ...
##  $ X40                     : num [1:115] 604.9 226.1 109.4 44.7 NA ...
##  $ X42                     : num [1:115] NA 112 143 54 NA ...
##  $ X43                     : num [1:115] 55 102.5 166.8 34.8 NA ...
##  $ X44                     : num [1:115] 21.5 18.1 15.1 21.3 15.8 ...
##  $ X45                     : num [1:115] 17.5 18.2 14 NA 23.3 ...
##  $ X46                     : num [1:115] 7.3 5.49 6.07 NA NA ...
##  $ X47                     : num [1:115] 8 8.15 6.6 NA NA ...
##  $ X60                     : num [1:115] NA -13.6 47.27 15.45 -5.01 ...
##  $ X61                     : num [1:115] NA 4.64 58.3 43.91 -11.5 ...
##  $ X66                     : num [1:115] 172.8 103.5 89.6 57.1 43.3 ...
##  $ X67                     : num [1:115] 199.2 134.7 102.3 109.3 73.1 ...
##  $ X102                    : num [1:115] 38675 40105 4251 2034 9203 ...
##  $ X103                    : num [1:115] 55.79 57.85 6.13 2.93 13.28 ...
##  $ X104                    : num [1:115] NA 70430 14500 6380 22120 ...
##  $ X105                    : num [1:115] NA 106.58 21.94 9.65 33.47 ...
##  $ X106                    : num [1:115] -2.084 -0.725 2.332 -5.203 -3.73 ...
##  $ X107                    : num [1:115] 1.221 0.87 0.256 3.342 0.966 ...
##  $ X108                    : num [1:115] 2.17 1.83 18.31 8.89 9.55 ...
##  $ X109                    : num [1:115] 3 2.45 18.5 10.5 11.05 ...
##  $ X111                    : num [1:115] 98.6 69.5 27.6 35.2 43.3 ...
##  $ X112                    : num [1:115] 98.1 88.9 50 13 49 ...
##  $ X113                    : num [1:115] 90.9 77.9 49 13.5 37 ...
##  $ X114                    : num [1:115] 87.5 83.7 50 13.9 53.4 ...
##  $ X115                    : num [1:115] 86.1 78.4 63.5 16.3 33.7 ...
##  $ X116                    : num [1:115] 87.2 17.7 47.8 25.6 66.5 ...
##  $ X117                    : num [1:115] 81.3 84 57.4 21.8 76 90.9 95.7 NA 53.1 29.7 ...
##  $ X118                    : num [1:115] NA 92.1 75.7 6.9 33.9 ...
##  $ Negara                  : chr [1:115] "Andorra" "United Arab Emirates" "Armenia" "Angola" ...
##  $ Alpha.3                 : chr [1:115] "AND" "ARE" "ARM" "AGO" ...
##  $ Kode_Negara             : num [1:115] 20 784 51 24 32 40 36 533 31 50 ...
##  $ Kode_ISO                : chr [1:115] "ISO 3166-2:AD" "ISO 3166-2:AE" "ISO 3166-2:AM" "ISO 3166-2:AO" ...
##  $ Region                  : chr [1:115] "Europe" "Asia" "Asia" "Africa" ...
##  $ Sub_Region              : chr [1:115] "Southern Europe" "Western Asia" "Western Asia" "Sub-Saharan Africa" ...
##  $ Intermediate_Region     : chr [1:115] NA NA NA "Middle Africa" ...
##  $ Kode_Region             : num [1:115] 150 142 142 2 19 150 9 19 142 142 ...
##  $ Kode_Sub.Region         : num [1:115] 39 145 145 202 419 155 53 419 145 34 ...
##  $ Intermediate_Kode.Region: num [1:115] NA NA NA 17 5 NA NA 29 NA NA ...

ggplot2

library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.1.2
library(dplyr)

cek missing value

is.na(TugasAED$Region)
##   [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [25] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [37] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [49] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [61] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [73] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [85] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [97] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [109] FALSE FALSE FALSE FALSE FALSE FALSE FALSE
is.na(TugasAED$X2)
##   [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [13] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [25] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [37] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [49] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [61] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [73] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [85] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [97] FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [109] FALSE FALSE FALSE FALSE FALSE FALSE FALSE

C. Histogram

Histogram Data X3

ggplot(TugasAED, aes(x= X3))+
  geom_histogram( fill="red", color="black", alpha=0.3)+
  ggtitle("Sebaran X3")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

## Histogram Data X106

ggplot(TugasAED, aes(x= X106))+
  geom_histogram( fill="yellow", color="black", alpha=0.3)+
  ggtitle("Sebaran X106")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

Histogram Data X107

ggplot(TugasAED, aes(x= X107))+
  geom_histogram( fill="green", color="black", alpha=0.3)+
  ggtitle("Sebaran X107")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

X3 by Region

ggplot(data=TugasAED, aes(x= X3))+
  geom_histogram(aes(fill=Region))+
  facet_wrap(~Region, ncol=1)+
  xlab("Sebaran X3")+
  ylab("frekuensi")+
  theme_light()+
  ggtitle("X3 by Region")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

X106 by Region

ggplot(data=TugasAED, aes(x= X106))+
  geom_histogram(aes(fill=Region))+
  facet_wrap(~Region, ncol=1)+
  xlab("Sebaran X106")+
  ylab("frekuensi")+
  theme_light()+
  ggtitle("X106 by Region")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

X107 by Region

ggplot(data=TugasAED, aes(x= X107))+
  geom_histogram(aes(fill=Region))+
  facet_wrap(~Region, ncol=1)+
  xlab("Sebaran Warga Negara")+
  ylab("frekuensi")+
  theme_light()+
  ggtitle("X107 by Region")
## `stat_bin()` using `bins = 30`. Pick better value with `binwidth`.

D. Boxplot

Boxplot Data X3 dan Region

ggplot(data = TugasAED, mapping=aes(x=reorder(Region, X3, median), y=X3, fill=Region))+
  geom_boxplot(width = 0.5, alpha=1)+
  theme(legend.position="none")+
  ggtitle ("Rata-Rata Pertumbuhan GDP Real 5 tahun terakhir Berdasarkan Region")+
  scale_fill_manual(values=c("red", "green", "yellow", "blue", "purple"))+
  labs(
    x = "Region",
    y = "Pertumbuhan GDP Real(%)"
  )

Boxplot Data X106 dan Region

ggplot(data = TugasAED, mapping=aes(x=reorder(Region, X106, median), y=X106, fill=Region))+
  geom_boxplot(width = 0.7, alpha=1)+
  theme(legend.position="none")+
  ggtitle ("Rata-Rata GDP Per Kapita 5 tahun terakhir Berdasarkan Region")+
  scale_fill_manual(values=c("red", "green", "yellow", "blue", "purple"))+
  labs(
    x = "Region",
    y = "GDP Per Kapita(%)"
  )

E. QQ PLOT

Normal QQ-Plot Data X3

IMPORT DATA

library(readxl)
setwd("C:/SMT 4/Analisis Eksplorasi Data/3")
MydataX <- read_excel("Datafix.xlsx",sheet = "DataX3")
var.name <- read_excel ("Datafix.xlsx",sheet = "DataX3", 
                        n_max = 0 )
names(var.name)
## [1] "X3"     "Region"
colnames(MydataX) <- names(var.name)
head(MydataX)
## # A tibble: 6 x 2
##       X3 Region  
##    <dbl> <chr>   
## 1  1.79  Europe  
## 2  2.66  Asia    
## 3  4.75  Asia    
## 4 -0.878 Africa  
## 5 -0.237 Americas
## 6  1.88  Europe
library(ggplot2)
varX<-MydataX$X3
length(varX) 
## [1] 115
hist(varX, breaks=15)

Normal QQ-Plot

set.seed(42)
qqnorm(varX, cex = .5)
set.seed(42)
qqline(varX, distribution = qnorm, col = "red", lty = "dashed", lwd = .1)

Normal QQ-Plot Data X106

Import Data

library(readxl)
setwd("C:/SMT 4/Analisis Eksplorasi Data/3")
MydataY <- read_excel("Datafix.xlsx",sheet = "DataX106")
var.name <- read_excel ("Datafix.xlsx",sheet = "DataX106", 
                        n_max = 0 )
names(var.name)
## [1] "X106"
colnames(MydataY) <- names(var.name)
head(MydataY)
## # A tibble: 6 x 1
##     X106
##    <dbl>
## 1 -2.08 
## 2 -0.725
## 3  2.33 
## 4 -5.20 
## 5 -3.73 
## 6 -0.300
library(ggplot2)
varY<-MydataY$X106
length(varY) 
## [1] 115
hist(varY, breaks=15)

#Normal QQ-Plot

set.seed(42)
qqnorm(varY, cex = .5)
set.seed(42)
qqline(varY, distribution = qnorm, col = "red", lty = "dashed", lwd = .1)