Το dataset περιλαμβάνει πληροφορίες για 1987 πελάτες ασφαλιστηκών. Περιλαμβάνει χαρακτηριστικά όπως ηλικία, τομέας ενασχόλησης, εκπαιδευτικό επίπεδο, εισόδημα, οικογενειακή κατάσταση, διαχρονικές νώσους, συχνότητα που ταξιδεύουν και αν ο πελάτης πήρε ποτέ ταξιδιωτική ασφάλεια ή όχι.
Πηγή: Το dataset διατίθεται από το Kaggle.
Η πρόβλεψη για το ποιά ομάδα ανθρώπων τείνει να αγοράζει ταξιδιωτική ασφάλεια είναι πολύ σημαντική για της ασφαλιστικές. Μέσω αυτής της ανάλυσης οι εταιρίες μπορούν να ομαδοποιήσουν τους χρήστες έτσι ώστε να μπορούν να απευθυνθούν στο κατάλληλο δημογραφικό.
Πιθανά Επιχειρηματικά Ερωτήματα
TravelInsurancePrediction <- read.csv("C:\\Users\\Tasos\\Downloads\\TravelInsurancePrediction.csv")
## Warning: package 'knitr' was built under R version 4.4.3
| Μεταβλητή | Τύπος |
|---|---|
| Age | Αριθμητικό |
| Employment.Type | Κατηγορική |
| GraduateOrNot | Κατηγορική |
| AnnualIncome | Αριθμητικό |
| FamilyMembers | Αριθμητικό |
| ChronicDiseases | Δυαδικό |
| FrequentFlyerer | Κατηγορική |
| EverTravelledAboard | Κατηγορική |
| TravelInsurance | Δυαδικό |
summary(TravelInsurancePrediction)
## X Age Employment.Type GraduateOrNot
## Min. : 0.0 Min. :25.00 Length:1987 Length:1987
## 1st Qu.: 496.5 1st Qu.:28.00 Class :character Class :character
## Median : 993.0 Median :29.00 Mode :character Mode :character
## Mean : 993.0 Mean :29.65
## 3rd Qu.:1489.5 3rd Qu.:32.00
## Max. :1986.0 Max. :35.00
## AnnualIncome FamilyMembers ChronicDiseases FrequentFlyer
## Min. : 300000 Min. :2.000 Min. :0.0000 Length:1987
## 1st Qu.: 600000 1st Qu.:4.000 1st Qu.:0.0000 Class :character
## Median : 900000 Median :5.000 Median :0.0000 Mode :character
## Mean : 932763 Mean :4.753 Mean :0.2778
## 3rd Qu.:1250000 3rd Qu.:6.000 3rd Qu.:1.0000
## Max. :1800000 Max. :9.000 Max. :1.0000
## EverTravelledAbroad TravelInsurance
## Length:1987 Min. :0.0000
## Class :character 1st Qu.:0.0000
## Mode :character Median :0.0000
## Mean :0.3573
## 3rd Qu.:1.0000
## Max. :1.0000
Δεν χρειάστηκε να γίνει κάποιος καθαρισμός του dataset αφού δεν υπήρχαν ελειπείς πεδία ούτε ακραίες τιμές.
ggplot(TravelInsurancePrediction, aes(x = AnnualIncome, y = TravelInsurance, color = factor(EverTravelledAbroad))) +
geom_jitter(alpha = 0.5, width = 0.3, height = 0.3) +
labs(title = "Annual Income vs. Travel Insurance (Colored by If they Travelled Aboard)",
x = "Annueal Income", y = "Travel Insurance",
color = "EveraTravelledAboard\n(0 = No Default, 1 = Defaulted)") +
scale_color_manual(values = c("red", "blue"),
labels = c("No Default", "Defaulted")) +
theme_minimal()
Διάγραμμα 1. Σχέση εισοδήματος σε σχέση με τον αν αγοράζουν ταξιδιωτική ασφάλεια.
Σχόλιο: Φαίνεται οτι οι περισσότεροι που έχουν υψηλό εισόδημα, έχουν περισσότερες πιθανότητες να αγοράσουν ταξιδιωτική ασφάλεια.
ggplot(TravelInsurancePrediction, aes(x = FrequentFlyer, y = AnnualIncome, fill = factor(TravelInsurance))) +
geom_boxplot() +
labs(title = "Frequnce of travelling based on annual income",
x = "Flying Frequency", y = "Annual Income" , fill = "Travel Insurance owner")
theme_minimal()
## List of 136
## $ line :List of 6
## ..$ colour : chr "black"
## ..$ linewidth : num 0.5
## ..$ linetype : num 1
## ..$ lineend : chr "butt"
## ..$ arrow : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_line" "element"
## $ rect :List of 5
## ..$ fill : chr "white"
## ..$ colour : chr "black"
## ..$ linewidth : num 0.5
## ..$ linetype : num 1
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_rect" "element"
## $ text :List of 11
## ..$ family : chr ""
## ..$ face : chr "plain"
## ..$ colour : chr "black"
## ..$ size : num 11
## ..$ hjust : num 0.5
## ..$ vjust : num 0.5
## ..$ angle : num 0
## ..$ lineheight : num 0.9
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : logi FALSE
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ title : NULL
## $ aspect.ratio : NULL
## $ axis.title : NULL
## $ axis.title.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 2.75points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 2.75points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.x.bottom : NULL
## $ axis.title.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : num 90
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.75points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.title.y.left : NULL
## $ axis.title.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : num -90
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 2.75points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : chr "grey30"
## ..$ size : 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 1
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 2.2points 0points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x.top :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : NULL
## ..$ vjust : num 0
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 2.2points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.x.bottom : NULL
## $ axis.text.y :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 1
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.2points 0points 0points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.y.left : NULL
## $ axis.text.y.right :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 0points 0points 2.2points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.text.theta : NULL
## $ axis.text.r :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0.5
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : 'margin' num [1:4] 0points 2.2points 0points 2.2points
## .. ..- attr(*, "unit")= int 8
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ axis.ticks : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ axis.ticks.x : NULL
## $ axis.ticks.x.top : NULL
## $ axis.ticks.x.bottom : NULL
## $ axis.ticks.y : NULL
## $ axis.ticks.y.left : NULL
## $ axis.ticks.y.right : NULL
## $ axis.ticks.theta : NULL
## $ axis.ticks.r : NULL
## $ axis.minor.ticks.x.top : NULL
## $ axis.minor.ticks.x.bottom : NULL
## $ axis.minor.ticks.y.left : NULL
## $ axis.minor.ticks.y.right : NULL
## $ axis.minor.ticks.theta : NULL
## $ axis.minor.ticks.r : NULL
## $ axis.ticks.length : 'simpleUnit' num 2.75points
## ..- attr(*, "unit")= int 8
## $ axis.ticks.length.x : NULL
## $ axis.ticks.length.x.top : NULL
## $ axis.ticks.length.x.bottom : NULL
## $ axis.ticks.length.y : NULL
## $ axis.ticks.length.y.left : NULL
## $ axis.ticks.length.y.right : NULL
## $ axis.ticks.length.theta : NULL
## $ axis.ticks.length.r : NULL
## $ axis.minor.ticks.length : 'rel' num 0.75
## $ axis.minor.ticks.length.x : NULL
## $ axis.minor.ticks.length.x.top : NULL
## $ axis.minor.ticks.length.x.bottom: NULL
## $ axis.minor.ticks.length.y : NULL
## $ axis.minor.ticks.length.y.left : NULL
## $ axis.minor.ticks.length.y.right : NULL
## $ axis.minor.ticks.length.theta : NULL
## $ axis.minor.ticks.length.r : NULL
## $ axis.line : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ axis.line.x : NULL
## $ axis.line.x.top : NULL
## $ axis.line.x.bottom : NULL
## $ axis.line.y : NULL
## $ axis.line.y.left : NULL
## $ axis.line.y.right : NULL
## $ axis.line.theta : NULL
## $ axis.line.r : NULL
## $ legend.background : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.margin : 'margin' num [1:4] 5.5points 5.5points 5.5points 5.5points
## ..- attr(*, "unit")= int 8
## $ legend.spacing : 'simpleUnit' num 11points
## ..- attr(*, "unit")= int 8
## $ legend.spacing.x : NULL
## $ legend.spacing.y : NULL
## $ legend.key : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.key.size : 'simpleUnit' num 1.2lines
## ..- attr(*, "unit")= int 3
## $ legend.key.height : NULL
## $ legend.key.width : NULL
## $ legend.key.spacing : 'simpleUnit' num 5.5points
## ..- attr(*, "unit")= int 8
## $ legend.key.spacing.x : NULL
## $ legend.key.spacing.y : NULL
## $ legend.frame : NULL
## $ legend.ticks : NULL
## $ legend.ticks.length : 'rel' num 0.2
## $ legend.axis.line : NULL
## $ legend.text :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : 'rel' num 0.8
## ..$ hjust : NULL
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.text.position : NULL
## $ legend.title :List of 11
## ..$ family : NULL
## ..$ face : NULL
## ..$ colour : NULL
## ..$ size : NULL
## ..$ hjust : num 0
## ..$ vjust : NULL
## ..$ angle : NULL
## ..$ lineheight : NULL
## ..$ margin : NULL
## ..$ debug : NULL
## ..$ inherit.blank: logi TRUE
## ..- attr(*, "class")= chr [1:2] "element_text" "element"
## $ legend.title.position : NULL
## $ legend.position : chr "right"
## $ legend.position.inside : NULL
## $ legend.direction : NULL
## $ legend.byrow : NULL
## $ legend.justification : chr "center"
## $ legend.justification.top : NULL
## $ legend.justification.bottom : NULL
## $ legend.justification.left : NULL
## $ legend.justification.right : NULL
## $ legend.justification.inside : NULL
## $ legend.location : NULL
## $ legend.box : NULL
## $ legend.box.just : NULL
## $ legend.box.margin : 'margin' num [1:4] 0cm 0cm 0cm 0cm
## ..- attr(*, "unit")= int 1
## $ legend.box.background : list()
## ..- attr(*, "class")= chr [1:2] "element_blank" "element"
## $ legend.box.spacing : 'simpleUnit' num 11points
## ..- attr(*, "unit")= int 8
## [list output truncated]
## - attr(*, "class")= chr [1:2] "theme" "gg"
## - attr(*, "complete")= logi TRUE
## - attr(*, "validate")= logi TRUE
Διάγραμμα 2. Συχνότητα με την οποία ταξιδεύουν σε σχέση με το ετήσιο εισόδημα.
Σχόλιο: Παρτηρούμε πώς μεγάλο ποστό τακτικών ταξιδιοτών είναι ανασφάλιστο όταν το εισόδημα τους είναι κάτω των 140.000. Αλλά όλοι όσοι βρίσκονται πάνω από τις 140.000 έχουν ασφάλεια.
ggplot(TravelInsurancePrediction, aes(x = Age, fill = factor(FrequentFlyer))) +
geom_histogram(position = "identity", alpha = 0.6, bins = 50) +
labs(title = "Age destribution by frequency of travelling",
x = "Age", y = "Count", fill = "FrequentFlyer") +
theme_minimal()
Διάγραμμα 3. Κατανομή ηλικιών με βάση το πόσο συχνά ταξιδεύουν.
Σχόλιο: Οι νεότερες ηλικίες ταξιδευν συχνότερα από άτομα μεγαλύτερης ηλικίας.
ggplot(TravelInsurancePrediction, aes(x = Employment.Type, fill = factor(TravelInsurance))) +
geom_bar(position = "dodge", color = "black") +
labs(title = "Travel Insurance by line of work",
x = "Line of Work", y = "Count",
fill = "Travel Insurance\n(0 = No Default, 1 = Defaulted)") +
theme_light()
Διάγραμμα 4. Τομέας Απασχόλησης σε σχάση με τη κατοχή ασφάλειας.
Σχόλιο: Το ποσοστό των εργαζομένων στον ιδιωτικό τομεά που είναι ασφαλισμένο είναι μεγαλύτερο από αυτό του δημόσιου.