library(tidyverse)
library(readr)
library(ggplot2)
library(data.table)
library(dplyr)
library(ggthemes)
library(ggpubr)
library(knitr)
library(corrplot)
data<-data.frame()
data<-esoph
glimpse(esoph)
## Rows: 88
## Columns: 5
## $ agegp <ord> 25-34, 25-34, 25-34, 25-34, 25-34, 25-34, 25-34, 25-34, 2...
## $ alcgp <ord> 0-39g/day, 0-39g/day, 0-39g/day, 0-39g/day, 40-79, 40-79,...
## $ tobgp <ord> 0-9g/day, 10-19, 20-29, 30+, 0-9g/day, 10-19, 20-29, 30+,...
## $ ncases <dbl> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, ...
## $ ncontrols <dbl> 40, 10, 6, 5, 27, 7, 4, 7, 2, 1, 2, 1, 1, 1, 2, 60, 14, 7...
summary(esoph)
## agegp alcgp tobgp ncases ncontrols
## 25-34:15 0-39g/day:23 0-9g/day:24 Min. : 0.000 Min. : 1.00
## 35-44:15 40-79 :23 10-19 :24 1st Qu.: 0.000 1st Qu.: 3.00
## 45-54:16 80-119 :21 20-29 :20 Median : 1.000 Median : 6.00
## 55-64:16 120+ :21 30+ :20 Mean : 2.273 Mean :11.08
## 65-74:15 3rd Qu.: 4.000 3rd Qu.:14.00
## 75+ :11 Max. :17.000 Max. :60.00
age_effect <- esoph %>% group_by(agegp) %>%
summarise(tot_rows = n(), people_cancer = sum(ncases), people_total = sum(ncontrols),
percentage=people_cancer*100/people_total)
ggplot(age_effect, aes(x=agegp,
y=percentage,
fill=agegp)) +
geom_col()+
labs(x="Age Groups",y="Percentage of Cases", title= "Cancer Cases for each Age Groups") +
theme(legend.position = "none")
alcohol_effect <- esoph %>% group_by(alcgp) %>%
summarise(tot_rows = n(), people_cancer = sum(ncases), people_total = sum(ncontrols),
percentage=people_cancer*100/people_total)
ggplot(alcohol_effect, aes(x=alcgp,
y=percentage,
fill=alcgp)) +
geom_col( ) +
labs( x="Alcohol Consumption",
y="Percentage of Cases",
title= "Cases for Alcohol consumption") +
theme(legend.position = "none")
tobacco_effect <- esoph %>% group_by(tobgp) %>%
summarise(tot_rows = n(),
people_cancer = sum(ncases),
people_total = sum(ncontrols),
percentage=people_cancer*100/people_total)
ggplot(tobacco_effect, aes(x=tobgp,
y=percentage,
fill=tobgp)) +
geom_bar(stat = "identity") +
labs(x="Tobacco Consumption",
y="Percentage of Cases",
title= "Cases for Tobacco consumption") +
theme(legend.position = "none")
tobgp_and_alcgp<- esoph %>%
group_by(tobgp,alcgp)%>%
summarise(tot_rows = n(),
total_case = sum(ncases),
total_control = sum(ncontrols),
percentage=100*(total_case/total_control))
ggplot(tobgp_and_alcgp,aes(x=alcgp,
y=percentage,
fill=alcgp))+
geom_col( )+
facet_grid(tobgp ~.)+
theme(text=element_text(size=8))+
labs(x="Alcohol Consumption",
y="Cancer Percentage",
title="Alcohol Consumption and Tobocco Consumption according to Cancer Percentage") +
theme(legend.position = "none")
response <- read_csv("dataset.csv")
glimpse(response)
## Rows: 1,010
## Columns: 150
## $ Music <dbl> 5, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5...
## $ `Slow songs or fast songs` <dbl> 3, 4, 5, 3, 3, 3, 5, 3, 3, 3, 3, 3...
## $ Dance <dbl> 2, 2, 2, 2, 4, 2, 5, 3, 3, 2, 3, 1...
## $ Folk <dbl> 1, 1, 2, 1, 3, 3, 3, 2, 1, 5, 2, 1...
## $ Country <dbl> 2, 1, 3, 1, 2, 2, 1, 1, 1, 2, 1, 1...
## $ `Classical music` <dbl> 2, 1, 4, 1, 4, 3, 2, 2, 2, 2, 2, 4...
## $ Musical <dbl> 1, 2, 5, 1, 3, 3, 2, 2, 4, 5, 3, 1...
## $ Pop <dbl> 5, 3, 3, 2, 5, 2, 5, 4, 3, 3, 4, 2...
## $ Rock <dbl> 5, 5, 5, 2, 3, 5, 3, 5, 5, 5, 3, 5...
## $ `Metal or Hardrock` <dbl> 1, 4, 3, 1, 1, 5, 1, 1, 5, 2, 2, 1...
## $ Punk <dbl> 1, 4, 4, 4, 2, 3, 1, 2, 1, 3, 1, 1...
## $ `Hiphop, Rap` <dbl> 1, 1, 1, 2, 5, 4, 3, 3, 1, 2, 3, 1...
## $ `Reggae, Ska` <dbl> 1, 3, 4, 2, 3, 3, 1, 2, 2, 4, 2, 1...
## $ `Swing, Jazz` <dbl> 1, 1, 3, 1, 2, 4, 1, 2, 2, 4, 2, 2...
## $ `Rock n roll` <dbl> 3, 4, 5, 2, 1, 4, 2, 3, 2, 4, 3, 2...
## $ Alternative <dbl> 1, 4, 5, 5, 2, 5, 3, 1, NA, 4, 3, ...
## $ Latino <dbl> 1, 2, 5, 1, 4, 3, 3, 2, 1, 5, 3, 2...
## $ `Techno, Trance` <dbl> 1, 1, 1, 2, 2, 1, 5, 3, 1, 1, 4, 1...
## $ Opera <dbl> 1, 1, 3, 1, 2, 3, 2, 2, 1, 2, 2, 2...
## $ Movies <dbl> 5, 5, 5, 5, 5, 5, 4, 5, 5, 5, 5, 5...
## $ Horror <dbl> 4, 2, 3, 4, 4, 5, 2, 4, 1, 2, 5, 3...
## $ Thriller <dbl> 2, 2, 4, 4, 4, 5, 1, 4, 5, 1, 4, 4...
## $ Comedy <dbl> 5, 4, 4, 3, 5, 5, 5, 5, 5, 5, 5, 4...
## $ Romantic <dbl> 4, 3, 2, 3, 2, 2, 3, 2, 4, 5, 3, 3...
## $ `Sci-fi` <dbl> 4, 4, 4, 4, 3, 3, 1, 3, 4, 1, 3, 2...
## $ War <dbl> 1, 1, 2, 3, 3, 3, 3, 3, 5, 3, 2, 5...
## $ `Fantasy/Fairy tales` <dbl> 5, 3, 5, 1, 4, 4, 5, 4, 4, 4, 5, 5...
## $ Animated <dbl> 5, 5, 5, 2, 4, 3, 5, 4, 4, 4, 5, 5...
## $ Documentary <dbl> 3, 4, 2, 5, 3, 3, 3, 3, 5, 4, 3, 5...
## $ Western <dbl> 1, 1, 2, 1, 1, 2, 1, 1, 1, 1, 1, 1...
## $ Action <dbl> 2, 4, 1, 2, 4, 4, 2, 3, 1, 2, 3, 4...
## $ History <dbl> 1, 1, 1, 4, 3, 5, 3, 5, 3, 3, 3, 2...
## $ Psychology <dbl> 5, 3, 2, 4, 2, 3, 3, 2, 2, 2, 3, 2...
## $ Politics <dbl> 1, 4, 1, 5, 3, 4, 1, 3, 1, 3, 3, 5...
## $ Mathematics <dbl> 3, 5, 5, 4, 2, 2, 1, 1, 1, 3, 2, 1...
## $ Physics <dbl> 3, 2, 2, 1, 2, 3, 1, 1, 1, 1, 1, 1...
## $ Internet <dbl> 5, 4, 4, 3, 2, 4, 2, 5, 1, 5, 4, 5...
## $ PC <dbl> 3, 4, 2, 1, 2, 4, 1, 4, 1, 1, 5, 4...
## $ `Economy Management` <dbl> 5, 5, 4, 2, 2, 1, 3, 1, 1, 4, 3, 1...
## $ Biology <dbl> 3, 1, 1, 3, 3, 4, 5, 2, 3, 2, 2, 1...
## $ Chemistry <dbl> 3, 1, 1, 3, 3, 4, 5, 2, 1, 1, 1, 1...
## $ Reading <dbl> 3, 4, 5, 5, 5, 3, 3, 2, 5, 4, 3, 3...
## $ Geography <dbl> 3, 4, 2, 4, 2, 3, 3, 3, 1, 4, 3, 5...
## $ `Foreign languages` <dbl> 5, 5, 5, 4, 3, 4, 4, 4, 1, 5, 5, 2...
## $ Medicine <dbl> 3, 1, 2, 2, 3, 4, 5, 1, 1, 1, 2, 1...
## $ Law <dbl> 1, 2, 3, 5, 2, 3, 3, 2, 1, 1, 4, 3...
## $ Cars <dbl> 1, 2, 1, 1, 3, 5, 4, 1, 1, 1, 2, 1...
## $ `Art exhibitions` <dbl> 1, 2, 5, 5, 1, 2, 1, 1, 1, 4, 2, 5...
## $ Religion <dbl> 1, 1, 5, 4, 4, 2, 1, 2, 2, 4, 2, 1...
## $ `Countryside, outdoors` <dbl> 5, 1, 5, 1, 4, 5, 4, 2, 4, 4, 4, 5...
## $ Dancing <dbl> 3, 1, 5, 1, 1, 1, 3, 1, 1, 5, 1, 1...
## $ `Musical instruments` <dbl> 3, 1, 5, 1, 3, 5, 2, 1, 2, 3, 1, 1...
## $ Writing <dbl> 2, 1, 5, 3, 1, 1, 1, 1, 1, 1, 1, 1...
## $ `Passive sport` <dbl> 1, 1, 5, 1, 3, 5, 5, 4, 4, 4, 5, 5...
## $ `Active sport` <dbl> 5, 1, 2, 1, 1, 4, 3, 5, 1, 4, 1, 3...
## $ Gardening <dbl> 5, 1, 1, 1, 4, 2, 3, 1, 1, 1, 3, 1...
## $ Celebrities <dbl> 1, 2, 1, 2, 3, 1, 1, 3, 5, 2, 2, 2...
## $ Shopping <dbl> 4, 3, 4, 4, 3, 2, 3, 3, 2, 4, 5, 3...
## $ `Science and technology` <dbl> 4, 3, 2, 3, 3, 3, 4, 2, 1, 3, 4, 3...
## $ Theatre <dbl> 2, 2, 5, 1, 2, 1, 3, 2, 5, 5, 2, 1...
## $ `Fun with friends` <dbl> 5, 4, 5, 2, 4, 3, 5, 4, 4, 5, 4, 3...
## $ `Adrenaline sports` <dbl> 4, 2, 5, 1, 2, 3, 1, 2, 1, 2, 1, 1...
## $ Pets <dbl> 4, 5, 5, 1, 1, 2, 5, 5, 1, 2, 5, 1...
## $ Flying <dbl> 1, 1, 1, 2, 1, 3, 1, 3, 2, 4, 1, 4...
## $ Storm <dbl> 1, 1, 1, 1, 2, 2, 3, 2, 3, 5, 1, 1...
## $ Darkness <dbl> 1, 1, 1, 1, 1, 2, 2, 4, 1, 4, 2, 1...
## $ Heights <dbl> 1, 2, 1, 3, 1, 2, 1, 3, 5, 5, 2, 3...
## $ Spiders <dbl> 1, 1, 1, 5, 1, 1, 1, 1, 5, 3, 2, 5...
## $ Snakes <dbl> 5, 1, 1, 5, 1, 2, 5, 5, 5, 4, 1, 5...
## $ Rats <dbl> 3, 1, 1, 5, 2, 2, 1, 3, 2, 4, 1, 5...
## $ Ageing <dbl> 1, 3, 1, 4, 2, 1, 4, 1, 2, 3, 1, 5...
## $ `Dangerous dogs` <dbl> 3, 1, 1, 5, 4, 1, 1, 2, 3, 5, 4, 5...
## $ `Fear of public speaking` <dbl> 2, 4, 2, 5, 3, 3, 1, 4, 4, 3, 2, 5...
## $ Smoking <chr> "never smoked", "never smoked", "t...
## $ Alcohol <chr> "drink a lot", "drink a lot", "dri...
## $ `Healthy eating` <dbl> 4, 3, 3, 3, 4, 2, 4, 2, 1, 3, 3, 3...
## $ `Daily events` <dbl> 2, 3, 1, 4, 3, 2, 3, 3, 1, 4, 3, 3...
## $ `Prioritising workload` <dbl> 2, 2, 2, 4, 1, 2, 5, 1, 2, 2, 2, 1...
## $ `Writing notes` <dbl> 5, 4, 5, 4, 2, 3, 5, 3, 1, 2, 4, 5...
## $ Workaholism <dbl> 4, 5, 3, 5, 3, 3, 5, 2, 4, 3, 2, 3...
## $ `Thinking ahead` <dbl> 2, 4, 5, 3, 5, 3, 3, 4, 2, 3, 3, 1...
## $ `Final judgement` <dbl> 5, 1, 3, 1, 5, 1, 3, 3, 5, 5, 3, 1...
## $ Reliability <dbl> 4, 4, 4, 3, 5, 3, 4, 3, 5, 4, 4, 3...
## $ `Keeping promises` <dbl> 4, 4, 5, 4, 4, 4, 5, 3, 4, 5, 4, 3...
## $ `Loss of interest` <dbl> 1, 3, 1, 5, 2, 3, 3, 1, 1, 3, 1, 3...
## $ `Friends versus money` <dbl> 3, 4, 5, 2, 3, 2, 4, 4, 4, 4, 3, 3...
## $ Funniness <dbl> 5, 3, 2, 1, 3, 3, 4, 4, 2, 3, 2, 5...
## $ Fake <dbl> 1, 2, 4, 1, 2, 1, 1, 2, 2, 1, 1, 3...
## $ `Criminal damage` <dbl> 1, 1, 1, 5, 1, 4, 2, 1, 1, 2, 1, 5...
## $ `Decision making` <dbl> 3, 2, 3, 5, 3, 2, 2, 3, 4, 5, 5, 3...
## $ Elections <dbl> 4, 5, 5, 5, 5, 5, 5, 5, 1, 5, 5, 1...
## $ `Self-criticism` <dbl> 1, 4, 4, 5, 5, 4, 3, 3, 3, 4, 4, 5...
## $ `Judgment calls` <dbl> 3, 4, 4, 4, 5, 4, 5, 5, 2, 5, 5, 3...
## $ Hypochondria <dbl> 1, 1, 1, 3, 1, 1, 1, 2, 2, 1, 2, 5...
## $ Empathy <dbl> 3, 2, 5, 3, 3, 4, 4, 1, 5, 4, 5, 5...
## $ `Eating to survive` <dbl> 1, 1, 5, 1, 1, 2, 1, 2, 1, 1, 2, 1...
## $ Giving <dbl> 4, 2, 5, 1, 3, 3, 5, 3, 1, 4, 3, 1...
## $ `Compassion to animals` <dbl> 5, 4, 4, 2, 3, 5, 5, 5, 4, 5, 5, 2...
## $ `Borrowed stuff` <dbl> 4, 3, 2, 5, 4, 5, 5, 2, 5, 4, 4, 2...
## $ Loneliness <dbl> 3, 2, 5, 5, 3, 2, 3, 2, 4, 2, 2, 4...
## $ `Cheating in school` <dbl> 2, 4, 3, 5, 5, 4, 2, 5, 5, 3, 3, 5...
## $ Health <dbl> 1, 4, 2, 1, 3, 3, 3, 3, 4, 4, 3, 2...
## $ `Changing the past` <dbl> 1, 4, 5, 5, 4, 3, 1, 2, 5, 2, 3, 3...
## $ God <dbl> 1, 1, 5, 4, 5, 3, 5, 4, 5, 5, 4, 1...
## $ Dreams <dbl> 4, 3, 1, 3, 3, 3, 3, 4, 4, 3, 3, 3...
## $ Charity <dbl> 2, 1, 3, 3, 3, 2, 3, 1, 1, 2, 1, 3...
## $ `Number of friends` <dbl> 3, 3, 3, 1, 3, 3, 3, 4, 2, 3, 3, 4...
## $ Punctuality <chr> "i am always on time", "i am often...
## $ Lying <chr> "never", "sometimes", "sometimes",...
## $ Waiting <dbl> 3, 3, 2, 1, 3, 3, 4, 1, 2, 1, 3, 3...
## $ `New environment` <dbl> 4, 4, 3, 1, 4, 4, 5, 4, 2, 4, 3, 5...
## $ `Mood swings` <dbl> 3, 4, 4, 5, 2, 3, 5, 3, 3, 4, 3, 5...
## $ `Appearence and gestures` <dbl> 4, 4, 3, 3, 3, 3, 4, 4, 4, 3, 4, 2...
## $ Socializing <dbl> 3, 4, 5, 1, 3, 4, 5, 2, 4, 4, 3, 5...
## $ Achievements <dbl> 4, 2, 3, 3, 3, 2, 4, 4, 2, 4, 3, 3...
## $ `Responding to a serious letter` <dbl> 3, 4, 4, 3, 3, 2, 3, 3, 2, 4, 4, 3...
## $ Children <dbl> 5, 2, 4, 2, 5, 3, 2, 4, 4, 3, 5, 5...
## $ Assertiveness <dbl> 1, 2, 3, 5, 4, 4, 3, 3, 1, 4, 2, 4...
## $ `Getting angry` <dbl> 1, 5, 4, 5, 2, 3, 3, 1, 3, 3, 1, 3...
## $ `Knowing the right people` <dbl> 3, 4, 3, 4, 3, 4, 4, 4, 3, 4, 3, 5...
## $ `Public speaking` <dbl> 5, 4, 2, 5, 5, 4, 3, 5, 4, 5, 3, 5...
## $ Unpopularity <dbl> 5, 4, 4, 3, 5, 4, 3, 2, 5, 3, 3, 2...
## $ `Life struggles` <dbl> 1, 1, 4, 3, 2, 3, 5, 2, 4, 5, 5, 4...
## $ `Happiness in life` <dbl> 4, 4, 4, 2, 3, 3, 5, 4, 3, 4, 4, 3...
## $ `Energy levels` <dbl> 5, 3, 4, 2, 5, 4, 4, 4, 1, 4, 3, 3...
## $ `Small - big dogs` <dbl> 1, 5, 3, 1, 3, 4, 3, 3, 5, 1, 2, 1...
## $ Personality <dbl> 4, 3, 3, 2, 3, 3, 3, 4, 3, 3, 3, 3...
## $ `Finding lost valuables` <dbl> 3, 4, 3, 1, 2, 3, 2, 2, 5, 3, 2, 3...
## $ `Getting up` <dbl> 2, 5, 4, 1, 4, 3, 2, 5, 5, 4, 4, 5...
## $ `Interests or hobbies` <dbl> 3, 3, 5, NA, 3, 5, 4, 4, 1, 3, 3, ...
## $ `Parents' advice` <dbl> 4, 2, 3, 2, 3, 3, 4, 3, 4, 3, 4, 4...
## $ `Questionnaires or polls` <dbl> 3, 3, 1, 4, 3, 4, 5, 3, 3, 3, 4, 4...
## $ `Internet usage` <chr> "few hours a day", "few hours a da...
## $ Finances <dbl> 3, 3, 2, 2, 4, 2, 4, 3, 2, 4, 2, 2...
## $ `Shopping centres` <dbl> 4, 4, 4, 4, 3, 3, 3, 4, 1, 4, 4, 2...
## $ `Branded clothing` <dbl> 5, 1, 1, 3, 4, 3, 1, 4, 3, 4, 2, 1...
## $ `Entertainment spending` <dbl> 3, 4, 4, 3, 3, 3, 3, 4, 2, 2, 3, 3...
## $ `Spending on looks` <dbl> 3, 2, 3, 4, 3, 1, 4, 4, 1, 3, 4, 1...
## $ `Spending on gadgets` <dbl> 1, 5, 4, 4, 2, 4, 1, 3, 3, 2, 2, 1...
## $ `Spending on healthy eating` <dbl> 3, 2, 2, 1, 4, 4, 5, 2, 4, 4, 2, 2...
## $ Age <dbl> 20, 19, 20, 22, 20, 20, 20, 19, 18...
## $ Height <dbl> 163, 163, 176, 172, 170, 186, 177,...
## $ Weight <dbl> 48, 58, 67, 59, 59, 77, 50, 90, 55...
## $ `Number of siblings` <dbl> 1, 2, 2, 1, 1, 1, 1, 1, 1, 3, 2, 1...
## $ Gender <chr> "female", "female", "female", "fem...
## $ `Left - right handed` <chr> "right handed", "right handed", "r...
## $ Education <chr> "college/bachelor degree", "colleg...
## $ `Only child` <chr> "no", "no", "no", "yes", "no", "no...
## $ `Village - town` <chr> "village", "city", "city", "city",...
## $ `House - block of flats` <chr> "block of flats", "block of flats"...
fil_res <- response %>%
select("Music":"Dancing")
fil_res=fil_res[complete.cases(fil_res),]
fil_res_pca <- princomp(as.matrix(fil_res),cor=T)
summary(fil_res_pca,loadings=TRUE)
## Importance of components:
## Comp.1 Comp.2 Comp.3 Comp.4 Comp.5
## Standard deviation 2.3813398 2.09488456 1.86461880 1.58065026 1.55647308
## Proportion of Variance 0.1111917 0.08604983 0.06817261 0.04898932 0.04750213
## Cumulative Proportion 0.1111917 0.19724158 0.26541419 0.31440351 0.36190564
## Comp.6 Comp.7 Comp.8 Comp.9 Comp.10
## Standard deviation 1.42129267 1.28689865 1.22479860 1.19651948 1.17477272
## Proportion of Variance 0.03960927 0.03247271 0.02941435 0.02807174 0.02706061
## Cumulative Proportion 0.40151491 0.43398762 0.46340196 0.49147370 0.51853431
## Comp.11 Comp.12 Comp.13 Comp.14 Comp.15
## Standard deviation 1.09607185 1.06151900 1.04252055 0.99885269 0.98712670
## Proportion of Variance 0.02355634 0.02209456 0.02131077 0.01956288 0.01910626
## Cumulative Proportion 0.54209065 0.56418521 0.58549598 0.60505886 0.62416511
## Comp.16 Comp.17 Comp.18 Comp.19 Comp.20
## Standard deviation 0.96945864 0.9633228 0.92796745 0.92353540 0.89390803
## Proportion of Variance 0.01842843 0.0181959 0.01688478 0.01672388 0.01566807
## Cumulative Proportion 0.64259355 0.6607894 0.67767422 0.69439810 0.71006617
## Comp.21 Comp.22 Comp.23 Comp.24 Comp.25
## Standard deviation 0.8793068 0.86575108 0.83229879 0.82989347 0.81904557
## Proportion of Variance 0.0151604 0.01469657 0.01358277 0.01350438 0.01315364
## Cumulative Proportion 0.7252266 0.73992314 0.75350591 0.76701028 0.78016392
## Comp.26 Comp.27 Comp.28 Comp.29 Comp.30
## Standard deviation 0.81478684 0.78837224 0.77455763 0.7586033 0.75636319
## Proportion of Variance 0.01301721 0.01218688 0.01176352 0.0112839 0.01121736
## Cumulative Proportion 0.79318113 0.80536801 0.81713153 0.8284154 0.83963279
## Comp.31 Comp.32 Comp.33 Comp.34 Comp.35
## Standard deviation 0.74543566 0.73083232 0.71834498 0.7175126 0.698295534
## Proportion of Variance 0.01089558 0.01047286 0.01011803 0.0100946 0.009561111
## Cumulative Proportion 0.85052836 0.86100122 0.87111925 0.8812138 0.890774960
## Comp.36 Comp.37 Comp.38 Comp.39
## Standard deviation 0.679817425 0.672462410 0.656138851 0.642621752
## Proportion of Variance 0.009061799 0.008866778 0.008441533 0.008097308
## Cumulative Proportion 0.899836759 0.908703537 0.917145070 0.925242378
## Comp.40 Comp.41 Comp.42 Comp.43
## Standard deviation 0.640903566 0.623731679 0.619026276 0.598016855
## Proportion of Variance 0.008054066 0.007628259 0.007513599 0.007012238
## Cumulative Proportion 0.933296445 0.940924704 0.948438302 0.955450541
## Comp.44 Comp.45 Comp.46 Comp.47
## Standard deviation 0.582772708 0.568569235 0.554139466 0.542412893
## Proportion of Variance 0.006659295 0.006338647 0.006020991 0.005768858
## Cumulative Proportion 0.962109835 0.968448482 0.974469473 0.980238331
## Comp.48 Comp.49 Comp.50 Comp.51
## Standard deviation 0.526274226 0.509340699 0.509094052 0.460734044
## Proportion of Variance 0.005430678 0.005086823 0.005081897 0.004162272
## Cumulative Proportion 0.985669009 0.990755831 0.995837728 1.000000000
##
## Loadings:
## Comp.1 Comp.2 Comp.3 Comp.4 Comp.5 Comp.6 Comp.7
## Music 0.189 0.136
## Slow songs or fast songs 0.196
## Dance 0.357 -0.120
## Folk 0.217 -0.283
## Country 0.164 -0.308 -0.123
## Classical music 0.280 -0.174 0.111
## Musical 0.203 0.130 0.107 -0.161
## Pop 0.115 0.307 0.110
## Rock 0.163 -0.112 -0.152 0.338 -0.107
## Metal or Hardrock 0.116 -0.204 -0.217 0.191 -0.107
## Punk 0.115 -0.163 -0.165 0.284 0.175 -0.163
## Hiphop, Rap 0.311 0.118 -0.129
## Reggae, Ska 0.117 0.105 0.152 -0.298
## Swing, Jazz 0.254 0.103 -0.103 -0.136
## Rock n roll 0.218 0.254 -0.167
## Alternative 0.183 -0.176 0.104 0.170 0.123 -0.122
## Latino 0.149 0.156 0.240 -0.105 -0.158
## Techno, Trance 0.252
## Opera 0.248 -0.111 -0.218 0.119
## Movies 0.139 0.105 0.169 0.132 0.341
## Horror -0.165 0.127 0.122 0.162
## Thriller -0.209 0.122 0.128 0.219
## Comedy 0.243 0.146
## Romantic 0.234 0.184 0.119
## Sci-fi -0.251 0.117 -0.128 0.153
## War -0.259 0.187
## Fantasy/Fairy tales 0.149 0.157 0.144 0.228 -0.109 0.257
## Animated 0.131 0.120 0.276 0.267
## Documentary 0.170 -0.132 -0.121 0.180
## Western -0.245 -0.207
## Action -0.259 0.147 0.190
## History 0.172 -0.135 0.193 -0.203 0.103 0.208
## Psychology 0.172 0.112 0.195
## Politics -0.166 0.251 -0.279 0.143
## Mathematics -0.183 -0.173 -0.236
## Physics 0.106 -0.220 -0.294 -0.134 -0.149
## Internet -0.154 0.160 0.101
## PC -0.289 0.123
## Economy Management 0.161 0.255 -0.101 -0.250
## Biology 0.185 -0.386 0.272
## Chemistry 0.142 -0.442 0.217
## Reading 0.233 0.125 0.115 0.104 0.109
## Geography 0.120 0.131 -0.155 0.134
## Foreign languages 0.161 0.215 0.179
## Medicine 0.183 -0.332 -0.118 0.287
## Law 0.114 0.236 -0.195 0.219
## Cars -0.243 0.188
## Art exhibitions 0.232 0.120
## Religion 0.177 -0.198
## Countryside, outdoors 0.143
## Dancing 0.122 0.172 0.214
## Comp.8 Comp.9 Comp.10 Comp.11 Comp.12 Comp.13 Comp.14
## Music 0.110 0.300 0.142 0.180 0.141 0.247
## Slow songs or fast songs 0.187 0.165 0.131 0.276 -0.398 -0.109
## Dance 0.251 0.134 0.111 -0.198
## Folk 0.154 0.105 -0.197
## Country -0.104 -0.126 0.259 -0.176
## Classical music -0.125 0.195 -0.143 0.120
## Musical -0.227 0.123
## Pop -0.185 0.277 -0.189
## Rock 0.259
## Metal or Hardrock -0.122 0.168 -0.148
## Punk
## Hiphop, Rap 0.190 -0.199 0.156 0.219
## Reggae, Ska 0.173 -0.197 -0.185 -0.271 0.175
## Swing, Jazz 0.136 -0.141 -0.190 0.257
## Rock n roll 0.189
## Alternative 0.107 0.182 -0.152 -0.123
## Latino 0.144 -0.103
## Techno, Trance 0.205 0.107 0.227 -0.270 -0.101
## Opera -0.186 0.154 -0.124 0.114 0.127
## Movies 0.161 0.229 -0.162 0.173 -0.164
## Horror -0.324 -0.376 -0.323
## Thriller 0.112 -0.395 -0.193 -0.180 -0.119
## Comedy -0.225 -0.203
## Romantic -0.227 -0.109 0.104 0.105
## Sci-fi 0.137
## War 0.175 -0.196 0.123 0.136
## Fantasy/Fairy tales -0.104 0.141 -0.235 -0.231 -0.127
## Animated -0.141 0.175 -0.207 -0.300 -0.171
## Documentary 0.221 -0.148 -0.185 -0.207
## Western 0.141 -0.164 0.171 0.130
## Action 0.120 0.171
## History 0.113 0.135
## Psychology -0.190 -0.217 0.322
## Politics -0.117 -0.124 0.126
## Mathematics -0.385 -0.139 -0.245
## Physics -0.241 -0.129 -0.110
## Internet -0.285 0.160 0.236 0.141 0.149 0.216
## PC -0.232 0.185 0.153
## Economy Management -0.270 -0.137 -0.140 -0.110
## Biology
## Chemistry 0.114
## Reading -0.150
## Geography 0.291 0.193 -0.349
## Foreign languages 0.120 0.110 0.127 -0.149
## Medicine 0.144 0.133 0.147
## Law -0.107 -0.151 -0.224 0.106 0.101
## Cars 0.123 0.245
## Art exhibitions 0.219 -0.148 -0.269 0.132
## Religion 0.154 -0.315 0.121
## Countryside, outdoors 0.410 0.268 -0.290 -0.212
## Dancing 0.200 -0.135 -0.125
## Comp.15 Comp.16 Comp.17 Comp.18 Comp.19 Comp.20
## Music 0.320 0.252 0.287 0.429
## Slow songs or fast songs 0.317 0.398
## Dance -0.114 -0.118
## Folk 0.130 0.130 -0.178 0.281
## Country 0.160 -0.214 0.164
## Classical music 0.101
## Musical -0.256 0.116 0.243
## Pop -0.140 0.106 -0.139 -0.180
## Rock -0.141 -0.119
## Metal or Hardrock -0.152
## Punk -0.225 -0.149 0.146
## Hiphop, Rap -0.126 0.123
## Reggae, Ska -0.242 0.222 -0.121 0.219
## Swing, Jazz 0.118 0.137 0.165 -0.115
## Rock n roll 0.159 0.158 -0.109 -0.304
## Alternative 0.108 -0.107 0.119 -0.152
## Latino 0.115 -0.234
## Techno, Trance 0.200 -0.262 -0.134
## Opera -0.202 -0.106 0.178 0.167
## Movies 0.147 -0.101 -0.144
## Horror 0.232 -0.108 0.150
## Thriller -0.148 -0.114
## Comedy 0.334 -0.103 0.264 0.112 0.145
## Romantic -0.164
## Sci-fi 0.190 -0.149 -0.304 0.115 0.139
## War 0.205 -0.166 -0.107
## Fantasy/Fairy tales 0.164
## Animated -0.149 0.147
## Documentary 0.233 -0.203
## Western 0.112 -0.132 -0.185 -0.155 0.298
## Action -0.119 -0.349
## History 0.228 0.151 -0.134
## Psychology 0.281 0.229 -0.182 -0.170 -0.190
## Politics 0.118 -0.110
## Mathematics 0.114
## Physics 0.103 0.141
## Internet -0.125 0.209 -0.323 -0.300
## PC -0.141 0.107 -0.118 -0.124
## Economy Management -0.154 0.151 0.247
## Biology
## Chemistry
## Reading -0.268 0.175
## Geography -0.287 0.193 -0.102
## Foreign languages -0.300 -0.375 0.209
## Medicine
## Law -0.180 0.113 0.201
## Cars -0.164 -0.159 0.207 0.302 -0.148
## Art exhibitions -0.118 -0.159 0.163
## Religion -0.150 0.112 -0.348 -0.477
## Countryside, outdoors -0.143 0.166 -0.137
## Dancing 0.180 -0.163 0.187 -0.154
## Comp.21 Comp.22 Comp.23 Comp.24 Comp.25 Comp.26
## Music 0.105 0.186 0.211 0.160
## Slow songs or fast songs 0.239 -0.325 -0.222
## Dance 0.223 -0.117
## Folk -0.124 -0.132
## Country 0.101 -0.318 -0.207 -0.199
## Classical music -0.115 0.138 -0.125
## Musical 0.158 -0.111 0.210 -0.143 0.189
## Pop -0.113 0.194 0.107 -0.214 0.169
## Rock -0.127 0.104 0.163
## Metal or Hardrock -0.193 0.108 0.234 -0.116
## Punk 0.196
## Hiphop, Rap 0.116 0.165 -0.185 -0.194
## Reggae, Ska 0.219 0.146
## Swing, Jazz -0.225 0.129 -0.156
## Rock n roll -0.172 -0.159
## Alternative -0.146 -0.116
## Latino 0.121 0.213 0.397
## Techno, Trance -0.306 -0.201 0.131
## Opera -0.174
## Movies 0.196 -0.246 -0.182
## Horror 0.117 -0.147
## Thriller 0.207 0.129
## Comedy -0.476 -0.171 -0.142 -0.216
## Romantic -0.135 0.139 -0.147
## Sci-fi -0.213 0.215 0.218 0.311
## War 0.205 0.437 -0.143
## Fantasy/Fairy tales 0.147
## Animated 0.199
## Documentary -0.105 0.406 -0.149 -0.164
## Western -0.195 -0.147 -0.133
## Action -0.187 0.159 -0.287 0.196 0.221
## History 0.274
## Psychology -0.115 -0.140 0.428
## Politics -0.113 0.164
## Mathematics 0.229 0.125 0.163
## Physics 0.236 0.130
## Internet 0.112 -0.127 -0.128 0.104
## PC -0.188
## Economy Management -0.252 0.233 -0.126 0.159
## Biology -0.132
## Chemistry
## Reading 0.135 0.216 -0.272
## Geography 0.130 -0.274 0.124 0.311
## Foreign languages -0.266 0.191 -0.118 -0.157
## Medicine -0.172
## Law -0.225 -0.147 0.119
## Cars -0.146
## Art exhibitions -0.176 0.137 -0.287 -0.232
## Religion 0.173 0.115 -0.224
## Countryside, outdoors -0.163 0.170 0.258 0.106
## Dancing 0.111 0.218 -0.185 0.243
## Comp.27 Comp.28 Comp.29 Comp.30 Comp.31 Comp.32
## Music 0.133 0.204
## Slow songs or fast songs 0.158
## Dance 0.135
## Folk -0.302 -0.362 0.166
## Country 0.253 -0.107
## Classical music -0.152
## Musical -0.134 -0.279 -0.154
## Pop 0.260
## Rock -0.156
## Metal or Hardrock -0.197 -0.205 -0.134
## Punk -0.193 -0.108 0.129
## Hiphop, Rap -0.194 -0.130 -0.342
## Reggae, Ska 0.143
## Swing, Jazz 0.125 -0.199 0.174
## Rock n roll 0.140 0.123
## Alternative -0.182 -0.136 0.391 -0.257
## Latino -0.276 -0.148 0.182 0.119
## Techno, Trance -0.168 -0.307 -0.134
## Opera 0.197
## Movies -0.104 -0.394 -0.125 -0.172 -0.176
## Horror 0.259
## Thriller 0.104 -0.131
## Comedy 0.131 -0.216
## Romantic -0.287 -0.172 0.311
## Sci-fi -0.215 0.230 -0.140 0.209 0.124
## War -0.225 -0.105
## Fantasy/Fairy tales
## Animated 0.139 0.118
## Documentary -0.311 0.180
## Western 0.351
## Action 0.175 0.137 0.244 -0.142
## History 0.154 -0.174 0.123
## Psychology 0.164 -0.171 -0.180
## Politics -0.142 -0.165
## Mathematics 0.119 0.173
## Physics 0.108
## Internet -0.141 0.116 -0.233
## PC 0.128 -0.176 0.246 -0.313
## Economy Management -0.249 -0.268
## Biology
## Chemistry 0.150 -0.116
## Reading 0.230 0.173 -0.224 -0.196 -0.167 -0.106
## Geography -0.272 0.148 0.199 -0.134
## Foreign languages 0.232 -0.158 0.194 0.240 0.214
## Medicine
## Law 0.185 -0.228 0.139 0.298
## Cars 0.191 -0.156 -0.344 0.184 0.167 0.157
## Art exhibitions 0.146 0.145
## Religion 0.102 -0.123 0.252 0.193
## Countryside, outdoors 0.312 -0.371 -0.149 0.120
## Dancing -0.234 0.327 -0.310
## Comp.33 Comp.34 Comp.35 Comp.36 Comp.37 Comp.38
## Music 0.101
## Slow songs or fast songs -0.127 -0.112
## Dance 0.149 -0.229 0.182 0.302
## Folk -0.120 -0.347 0.107 -0.127
## Country 0.200 0.240 -0.119
## Classical music -0.131 -0.135 -0.276 -0.147
## Musical 0.334 0.117 0.185
## Pop -0.206
## Rock -0.106 0.110 -0.173
## Metal or Hardrock -0.141 0.170
## Punk 0.197 -0.161 -0.226
## Hiphop, Rap -0.140 -0.120 0.262
## Reggae, Ska -0.124 -0.102 -0.156
## Swing, Jazz -0.174 -0.258 0.120
## Rock n roll 0.162 -0.124 -0.247
## Alternative 0.103 0.348 -0.107 0.207 0.218
## Latino 0.167 0.111
## Techno, Trance 0.124 -0.118 -0.230
## Opera -0.183 -0.192
## Movies -0.267 -0.105 -0.109 -0.128 0.120
## Horror -0.120
## Thriller 0.190 -0.171 0.225
## Comedy 0.197 0.113
## Romantic 0.463 0.217 -0.337
## Sci-fi 0.110 0.100 0.246
## War 0.244 -0.169 -0.216 0.169 -0.124
## Fantasy/Fairy tales
## Animated
## Documentary 0.314 0.208 0.194 -0.104
## Western -0.229 -0.215 0.203 0.204 0.161
## Action 0.170 -0.246
## History 0.187 -0.238 -0.236 0.349
## Psychology -0.146
## Politics -0.119 0.166 -0.416 0.475 -0.194
## Mathematics -0.172 -0.107 -0.125 -0.112
## Physics -0.104 0.101
## Internet -0.199 -0.194
## PC 0.143 0.270
## Economy Management 0.149 -0.103 0.117 0.256
## Biology
## Chemistry 0.104
## Reading 0.236 0.171 0.143 -0.202
## Geography -0.129 0.155
## Foreign languages -0.197 -0.155 -0.105
## Medicine
## Law -0.166 0.237 0.255 -0.282
## Cars 0.181 0.178 -0.148
## Art exhibitions 0.203 -0.157 -0.152 0.241 0.229
## Religion 0.144 0.215 0.149
## Countryside, outdoors -0.130 -0.144
## Dancing -0.111 0.128 -0.113 -0.165 -0.249
## Comp.39 Comp.40 Comp.41 Comp.42 Comp.43 Comp.44
## Music
## Slow songs or fast songs
## Dance -0.436 0.246
## Folk -0.168 0.284 0.120
## Country 0.152 -0.362 0.141
## Classical music -0.277 -0.235 0.248 -0.133 0.130
## Musical 0.111 0.106 0.128 0.230
## Pop 0.390 -0.221 -0.167 0.226
## Rock -0.152 -0.160 -0.237 -0.178 0.295 -0.272
## Metal or Hardrock 0.190 0.122 0.321
## Punk 0.218 0.240 -0.345
## Hiphop, Rap 0.190 0.255 0.172 -0.258
## Reggae, Ska -0.107 -0.198 -0.357 0.154
## Swing, Jazz 0.170 -0.133 0.277
## Rock n roll -0.123 0.379 0.206 0.177
## Alternative -0.190 -0.124 -0.175
## Latino -0.177 0.264 -0.120 -0.329
## Techno, Trance 0.129 0.206 -0.250
## Opera -0.126 0.123 -0.289 -0.278
## Movies 0.135 -0.121
## Horror 0.230 -0.177 0.333
## Thriller -0.209 0.100 -0.331
## Comedy -0.199 -0.103 -0.154
## Romantic -0.150 0.105 0.154
## Sci-fi 0.145 -0.211
## War -0.142 -0.235 0.116
## Fantasy/Fairy tales 0.175 0.145 0.101
## Animated -0.111
## Documentary 0.119 0.135 0.130
## Western 0.210 -0.180 -0.198
## Action -0.146 0.118 0.346
## History 0.127 -0.195
## Psychology -0.115
## Politics 0.186 0.183
## Mathematics 0.130 0.174 0.121
## Physics -0.169 -0.160 -0.108 -0.130
## Internet 0.171 -0.208
## PC -0.141 0.237 -0.246 0.265
## Economy Management -0.249 -0.153
## Biology -0.132
## Chemistry 0.200
## Reading -0.115 0.104 -0.143
## Geography 0.156
## Foreign languages
## Medicine -0.136
## Law -0.106 -0.134 0.138
## Cars 0.103 0.191 -0.283 -0.178
## Art exhibitions 0.259 0.111
## Religion -0.123
## Countryside, outdoors 0.113
## Dancing -0.145 0.208
## Comp.45 Comp.46 Comp.47 Comp.48 Comp.49 Comp.50
## Music
## Slow songs or fast songs
## Dance 0.140 -0.174 0.195
## Folk 0.144 0.110 0.109
## Country -0.176
## Classical music -0.159 0.405 -0.164 0.236
## Musical -0.249 0.238
## Pop 0.123 -0.143
## Rock -0.191 0.273 -0.128 -0.257 0.170
## Metal or Hardrock -0.407 -0.120 0.201 0.157
## Punk 0.217 0.291 0.128 -0.115
## Hiphop, Rap -0.105 -0.135 0.106
## Reggae, Ska -0.111 -0.218
## Swing, Jazz 0.131 0.303 -0.267 -0.176
## Rock n roll -0.270 0.208 0.209
## Alternative -0.199
## Latino 0.205 -0.101
## Techno, Trance 0.182
## Opera 0.233 -0.105 -0.414 0.166
## Movies
## Horror 0.258
## Thriller -0.331 -0.144
## Comedy
## Romantic
## Sci-fi -0.175 0.103 -0.104 0.104
## War 0.146 -0.133
## Fantasy/Fairy tales -0.170 -0.136 -0.558 -0.188
## Animated 0.122 0.145 0.525 0.119
## Documentary
## Western 0.100 0.143 0.118
## Action 0.108
## History -0.324 0.108 0.202 -0.101
## Psychology 0.206 -0.198
## Politics
## Mathematics -0.191 0.143 0.432
## Physics -0.125 0.127 -0.627
## Internet -0.200 -0.166
## PC 0.125 0.212 0.179
## Economy Management -0.104 0.145 -0.128
## Biology 0.116 0.148 0.149 0.159 0.180
## Chemistry -0.145 -0.640
## Reading 0.383 0.113
## Geography 0.125
## Foreign languages -0.175 -0.104
## Medicine 0.192 0.505 -0.241 -0.118
## Law -0.100
## Cars 0.117
## Art exhibitions -0.214 -0.172 0.193
## Religion -0.106
## Countryside, outdoors
## Dancing -0.167
## Comp.51
## Music
## Slow songs or fast songs
## Dance
## Folk
## Country
## Classical music -0.111
## Musical
## Pop
## Rock
## Metal or Hardrock 0.101
## Punk
## Hiphop, Rap
## Reggae, Ska
## Swing, Jazz
## Rock n roll
## Alternative
## Latino
## Techno, Trance
## Opera
## Movies
## Horror
## Thriller
## Comedy
## Romantic
## Sci-fi
## War
## Fantasy/Fairy tales 0.252
## Animated -0.263
## Documentary
## Western
## Action
## History
## Psychology
## Politics
## Mathematics
## Physics
## Internet
## PC
## Economy Management
## Biology 0.685
## Chemistry -0.275
## Reading
## Geography
## Foreign languages
## Medicine -0.442
## Law
## Cars
## Art exhibitions
## Religion
## Countryside, outdoors
## Dancing
ggplot(data=data.frame(PC=1:length(fil_res_pca$sdev),
Cumulative_Variance=cumsum(fil_res_pca$sdev^2/sum(fil_res_pca$sdev^2))),
aes(x=PC,y=Cumulative_Variance)) + geom_line() +
geom_point() +
scale_y_continuous(labels = scales::percent,breaks=seq(0,1,length.out=11)) +
scale_x_continuous(breaks=seq(0,135,by=5))
fil_res_mdsa<- response %>% select("History":"Pets")%>% drop_na()
glimpse(head(as.data.frame(fil_res_mdsa)))
## Rows: 6
## Columns: 32
## $ History <dbl> 1, 1, 1, 4, 3, 5
## $ Psychology <dbl> 5, 3, 2, 4, 2, 3
## $ Politics <dbl> 1, 4, 1, 5, 3, 4
## $ Mathematics <dbl> 3, 5, 5, 4, 2, 2
## $ Physics <dbl> 3, 2, 2, 1, 2, 3
## $ Internet <dbl> 5, 4, 4, 3, 2, 4
## $ PC <dbl> 3, 4, 2, 1, 2, 4
## $ `Economy Management` <dbl> 5, 5, 4, 2, 2, 1
## $ Biology <dbl> 3, 1, 1, 3, 3, 4
## $ Chemistry <dbl> 3, 1, 1, 3, 3, 4
## $ Reading <dbl> 3, 4, 5, 5, 5, 3
## $ Geography <dbl> 3, 4, 2, 4, 2, 3
## $ `Foreign languages` <dbl> 5, 5, 5, 4, 3, 4
## $ Medicine <dbl> 3, 1, 2, 2, 3, 4
## $ Law <dbl> 1, 2, 3, 5, 2, 3
## $ Cars <dbl> 1, 2, 1, 1, 3, 5
## $ `Art exhibitions` <dbl> 1, 2, 5, 5, 1, 2
## $ Religion <dbl> 1, 1, 5, 4, 4, 2
## $ `Countryside, outdoors` <dbl> 5, 1, 5, 1, 4, 5
## $ Dancing <dbl> 3, 1, 5, 1, 1, 1
## $ `Musical instruments` <dbl> 3, 1, 5, 1, 3, 5
## $ Writing <dbl> 2, 1, 5, 3, 1, 1
## $ `Passive sport` <dbl> 1, 1, 5, 1, 3, 5
## $ `Active sport` <dbl> 5, 1, 2, 1, 1, 4
## $ Gardening <dbl> 5, 1, 1, 1, 4, 2
## $ Celebrities <dbl> 1, 2, 1, 2, 3, 1
## $ Shopping <dbl> 4, 3, 4, 4, 3, 2
## $ `Science and technology` <dbl> 4, 3, 2, 3, 3, 3
## $ Theatre <dbl> 2, 2, 5, 1, 2, 1
## $ `Fun with friends` <dbl> 5, 4, 5, 2, 4, 3
## $ `Adrenaline sports` <dbl> 4, 2, 5, 1, 2, 3
## $ Pets <dbl> 4, 5, 5, 1, 1, 2
youth_responses_dist <- 1 - cor(fil_res_mdsa)
fil_res_mdsa <- cmdscale(youth_responses_dist,k=2)
colnames(fil_res_mdsa) <- c("x","y")
print(fil_res_mdsa)
## x y
## History 0.06372563 0.012956654
## Psychology 0.23826552 -0.024422880
## Politics -0.14749496 0.107881476
## Mathematics -0.32345626 -0.297702691
## Physics -0.32464296 -0.499240678
## Internet -0.43673303 0.187118496
## PC -0.58516404 -0.107666761
## Economy Management -0.30422083 0.383264449
## Biology 0.25483318 -0.395803325
## Chemistry 0.12745384 -0.486209735
## Reading 0.54412403 -0.002498553
## Geography -0.04741594 0.042633809
## Foreign languages 0.20488850 0.223464512
## Medicine 0.21225026 -0.352629731
## Law -0.07751035 0.252871501
## Cars -0.58387376 0.046912232
## Art exhibitions 0.37143545 0.009747048
## Religion 0.19597972 -0.174122589
## Countryside, outdoors 0.14091867 -0.071530114
## Dancing 0.27743365 0.136486519
## Musical instruments 0.16521053 -0.134880364
## Writing 0.30297822 -0.032446839
## Passive sport -0.30096850 0.108795592
## Active sport -0.24240576 0.047405197
## Gardening 0.19439442 -0.077481786
## Celebrities 0.06494596 0.467218540
## Shopping 0.20807212 0.463704403
## Science and technology -0.36445481 -0.278443856
## Theatre 0.44547786 0.054248884
## Fun with friends -0.05316373 0.253721685
## Adrenaline sports -0.30291870 0.041430796
## Pets 0.08203608 0.095218109
ggplot(data.frame(fil_res_mdsa),aes(x=x,y=y)) + geom_text(label=rownames(fil_res_mdsa),angle=30,size=3)+labs(title="MDS", x= "x coordinate",y="y coordinate")
set.seed(58)
genre_cluster<-kmeans(fil_res_mdsa,centers=6)
mds_clusters<-
data.frame(genre=names(genre_cluster$cluster),
cluster_mds=genre_cluster$cluster) %>% arrange(cluster_mds,genre)
mds_clusters
## genre cluster_mds
## Countryside, outdoors Countryside, outdoors 1
## Gardening Gardening 1
## Geography Geography 1
## History History 1
## Musical instruments Musical instruments 1
## Pets Pets 1
## Psychology Psychology 1
## Religion Religion 1
## Celebrities Celebrities 2
## Foreign languages Foreign languages 2
## Shopping Shopping 2
## Art exhibitions Art exhibitions 3
## Dancing Dancing 3
## Reading Reading 3
## Theatre Theatre 3
## Writing Writing 3
## Active sport Active sport 4
## Adrenaline sports Adrenaline sports 4
## Economy Management Economy Management 4
## Fun with friends Fun with friends 4
## Internet Internet 4
## Law Law 4
## Passive sport Passive sport 4
## Politics Politics 4
## Cars Cars 5
## Mathematics Mathematics 5
## PC PC 5
## Physics Physics 5
## Science and technology Science and technology 5
## Biology Biology 6
## Chemistry Chemistry 6
## Medicine Medicine 6
ggplot(
data.frame(fil_res_mdsa) %>% mutate(clusters=as.factor(genre_cluster$cluster),
genres=rownames(fil_res_mdsa)),aes(x=x,y=y)) +
geom_text(aes(label=genres,color=clusters),angle=45,size=2) +
geom_point(data=as.data.frame(genre_cluster$centers),aes(x=x,y=y)
)