# import an excel file
mydata <- read_excel("C:/Users/Eneja/Desktop/anketa10.xlsx")
# delete first row in which the questions are written
mydata <- mydata[-1,]
# add an ID variable
mydata$ID <- 1:nrow(mydata)
mydata <- mydata[,c(93, 1:92)]
head(mydata)
## # A tibble: 6 × 93
## ID Q1 Q2 Q3 Q4 Q5 Q6a Q6b Q6c Q6d Q7a_1 Q7b_1 Q7c_1 Q7d_1 Q7e_1 Q7f_1 Q8a Q8b Q8c Q8d Q9a
## <int> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <chr> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <chr> <chr> <chr> <chr> <chr>
## 1 1 7 2 -2 -2 -2 1 5 5 5 7 10 16 16 16 80 3 5 2 4 5
## 2 2 6 2 -2 -2 -2 3 4 5 3 0 22 59 0 23 57 4 4 1 4 5
## 3 3 5 2 -2 -2 -2 4 4 3 3 0 26 63 17 0 100 4 2 2 4 4
## 4 4 7 1 3 4 2 5 4 3 2 82 0 85 63 85 100 5 4 1 4 5
## 5 5 7 2 -2 -2 -2 4 2 4 5 0 0 0 0 25 50 5 1 1 1 5
## 6 6 7 1 3 4 2 4 4 4 2 0 0 -1 0 0 70 4 4 1 2 5
## # … with 72 more variables: Q9b <chr>, Q9c <chr>, Q9d <chr>, Q10a <chr>, Q10b <chr>, Q10c <chr>, Q10d <chr>, Q10e <chr>,
## # Q10f <chr>, Q10g <chr>, Q10h <chr>, Q11 <chr>, Q11_9_text <chr>, Q12a <chr>, Q12b <chr>, Q12c <chr>, Q12d <chr>, Q12e <chr>,
## # Q12f <chr>, Q13a <chr>, Q13b <chr>, Q13c <chr>, Q13d <chr>, Q13e <chr>, Q14a <chr>, Q14b <chr>, Q14c <chr>, Q14d <chr>,
## # Q14e <chr>, Q15a <chr>, Q15b <chr>, Q15c <chr>, Q15d <chr>, Q15e <chr>, Q16a <chr>, Q16b <chr>, Q16c <chr>, Q16d <chr>,
## # Q16e <chr>, Q17a <chr>, Q17b <chr>, Q17c <chr>, Q17d <chr>, Q17e <chr>, Q18a <chr>, Q18b <chr>, Q18c <chr>, Q18d <chr>,
## # Q18e <chr>, Q19 <chr>, Q20 <chr>, Q21 <chr>, Q22 <chr>, Q22_4_text <chr>, Q23 <chr>, Q24a <chr>, Q24b <chr>, Q24c <chr>,
## # Q24d <chr>, Q24e <chr>, Q24f <chr>, Q24g <chr>, Q24h <chr>, Q24i <chr>, Q24j <chr>, Q24k <chr>, Q24l <chr>, …
Description:
#For those who did not move only one slider for question 7, insert 50 (midpoint - half savings, half loans) as the selected value
mydata$Q7a_1 <- ifelse((mydata$Q7a_1==-1)&(mydata$Q7b_1!=-1)&(mydata$Q7c_1!=-1)&(mydata$Q7d_1!=-1)&(mydata$Q7e_1!=-1)&(mydata$Q7f_1!=-1),50, mydata$Q7a_1)
mydata$Q7b_1 <- ifelse((mydata$Q7a_1!=-1)&(mydata$Q7b_1==-1)&(mydata$Q7c_1!=-1)&(mydata$Q7d_1!=-1)&(mydata$Q7e_1!=-1)&(mydata$Q7f_1!=-1),50,mydata$Q7b_1)
mydata$Q7c_1 <- ifelse((mydata$Q7a_1!=-1)&(mydata$Q7b_1!=-1)&(mydata$Q7c_1==-1)&(mydata$Q7d_1!=-1)&(mydata$Q7e_1!=-1)&(mydata$Q7f_1!=-1),50,mydata$Q7c_1)
mydata$Q7d_1 <- ifelse((mydata$Q7a_1!=-1)&(mydata$Q7b_1!=-1)&(mydata$Q7c_1!=-1)&(mydata$Q7d_1==-1)&(mydata$Q7e_1!=-1)&(mydata$Q7f_1!=-1),50,mydata$Q7d_1)
mydata$Q7e_1 <- ifelse((mydata$Q7a_1!=-1)&(mydata$Q7b_1!=-1)&(mydata$Q7c_1!=-1)&(mydata$Q7d_1!=-1)&(mydata$Q7e_1==-1)&(mydata$Q7f_1!=-1),50,mydata$Q7e_1)
mydata$Q7f_1 <- ifelse((mydata$Q7a_1!=-1)&(mydata$Q7b_1!=-1)&(mydata$Q7c_1!=-1)&(mydata$Q7d_1!=-1)&(mydata$Q7e_1!=-1)&(mydata$Q7f_1==-1),50,mydata$Q7f_1)
#Identify values -1,-3 and replace them with NA. Identify also the -2
# -1 means: The person has not answered the specific question
# -2 means: Person did not respond because it did not satisfy if sentence
# -3 means: Person stopped answering questionnaire before coming to this sentence
mydata[mydata == -1] <- NA
mydata[mydata == -3] <- NA
# Get rid of those that are under 18 and over 27
mydata_t1<-mydata[!(mydata$Q2=="-2"),]
#solve some problems with 1ka (illogical -2 values)
mydata_t1 <- mydata_t1[!(mydata_t1$Q13a=="-2"),]
mydata_dropNA<-mydata_t1
mydata_dropNA <- na.omit(mydata_dropNA)
# convert character to integer, except the variables where Other was typed in
mydata_dropNA <- mydata_dropNA %>%
mutate_at(c(2:33), as.integer)
mydata_dropNA <- mydata_dropNA %>%
mutate_at(c(35:74), as.integer)
mydata_dropNA <- mydata_dropNA %>%
mutate_at(c(76:88), as.integer)
mydata_dropNA <- mydata_dropNA %>%
mutate_at(c(89:93), as.integer)
## Warning in mask$eval_all_mutate(quo): NAs introduced by coercion
mydata_dropNA$Q1 <- mydata_dropNA$Q1 + 16
Transform fo factors
mydata_dropNA$Sex_F <- factor(mydata_dropNA$Q19,
levels = c(1, 2,3),
labels = c("Female", "Male", "Other"))
mydata_dropNA$Region_F <- factor(mydata_dropNA$Q20,
levels = c(1,2, 3, 4, 5, 6, 7, 8, 9),
labels = c("Ljubljana z okolico","Štajerska","Prekmurje", "Dolenjska","Primorska" , "Gorenjska" , "Goriška", "Koroška" , "Notranjska"))
mydata_dropNA$Status_F <- factor(mydata_dropNA$Q22,
levels = c(1,2, 3),
labels = c("Single","In a relationship","Married"))
mydata_dropNA$Children_F <- factor(mydata_dropNA$Q23,
levels = c(2, 1),
labels = c("No", "Yes"))
mydata_dropNA$Education_F <- factor(mydata_dropNA$Q25,
levels = c(1,2,3,4,5),
labels = c("Primary school", "High school", "Vocational School", "Undergraduate", "Post-Graduate"))
mydata_dropNA$Employed_F <- factor(mydata_dropNA$Q26,
levels = c(2, 1),
labels = c("No", "Yes"))
mydata_dropNA$Knowledge_F <- factor(mydata_dropNA$Q28,
levels = c(1, 2, 3, 4),
labels = c("Have", "Dont_have","Dont_have", "Dont_have"))
levels(mydata_dropNA$Knowledge_F) <- c("Have", "Dont_have","Dont_have", "Dont_have")
head(mydata_dropNA)
## # A tibble: 6 × 100
## ID Q1 Q2 Q3 Q4 Q5 Q6a Q6b Q6c Q6d Q7a_1 Q7b_1 Q7c_1 Q7d_1 Q7e_1 Q7f_1 Q8a Q8b Q8c Q8d Q9a
## <int> <dbl> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int> <int>
## 1 1 23 2 -2 -2 -2 1 5 5 5 7 10 16 16 16 80 3 5 2 4 5
## 2 2 22 2 -2 -2 -2 3 4 5 3 0 22 59 0 23 57 4 4 1 4 5
## 3 3 21 2 -2 -2 -2 4 4 3 3 0 26 63 17 0 100 4 2 2 4 4
## 4 4 23 1 3 4 2 5 4 3 2 82 0 85 63 85 100 5 4 1 4 5
## 5 5 23 2 -2 -2 -2 4 2 4 5 0 0 0 0 25 50 5 1 1 1 5
## 6 6 23 1 3 4 2 4 4 4 2 0 0 50 0 0 70 4 4 1 2 5
## # … with 79 more variables: Q9b <int>, Q9c <int>, Q9d <int>, Q10a <int>, Q10b <int>, Q10c <int>, Q10d <int>, Q10e <int>,
## # Q10f <int>, Q10g <int>, Q10h <int>, Q11 <int>, Q11_9_text <chr>, Q12a <int>, Q12b <int>, Q12c <int>, Q12d <int>, Q12e <int>,
## # Q12f <int>, Q13a <int>, Q13b <int>, Q13c <int>, Q13d <int>, Q13e <int>, Q14a <int>, Q14b <int>, Q14c <int>, Q14d <int>,
## # Q14e <int>, Q15a <int>, Q15b <int>, Q15c <int>, Q15d <int>, Q15e <int>, Q16a <int>, Q16b <int>, Q16c <int>, Q16d <int>,
## # Q16e <int>, Q17a <int>, Q17b <int>, Q17c <int>, Q17d <int>, Q17e <int>, Q18a <int>, Q18b <int>, Q18c <int>, Q18d <int>,
## # Q18e <int>, Q19 <int>, Q20 <int>, Q21 <int>, Q22 <int>, Q22_4_text <chr>, Q23 <int>, Q24a <int>, Q24b <int>, Q24c <int>,
## # Q24d <int>, Q24e <int>, Q24f <int>, Q24g <int>, Q24h <int>, Q24i <int>, Q24j <int>, Q24k <int>, Q24l <int>, …
summary(mydata_dropNA[c("Q12f", "Q12a", "Q10a", "Q10f","Q10g")])
## Q12f Q12a Q10a Q10f Q10g
## Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000 Min. :1.000
## 1st Qu.:3.000 1st Qu.:2.000 1st Qu.:3.000 1st Qu.:3.000 1st Qu.:3.000
## Median :3.000 Median :3.000 Median :4.000 Median :4.000 Median :4.000
## Mean :3.246 Mean :2.693 Mean :3.706 Mean :3.689 Mean :3.557
## 3rd Qu.:4.000 3rd Qu.:3.000 3rd Qu.:4.000 3rd Qu.:4.000 3rd Qu.:4.000
## Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000 Max. :5.000
library(Hmisc)
rcorr(as.matrix(mydata_dropNA[ , c("Q12f", "Q12a", "Q10a", "Q10f","Q10g")]),
type = "pearson")
## Q12f Q12a Q10a Q10f Q10g
## Q12f 1.00 0.37 0.20 0.17 0.01
## Q12a 0.37 1.00 0.19 0.20 0.09
## Q10a 0.20 0.19 1.00 0.26 0.02
## Q10f 0.17 0.20 0.26 1.00 0.33
## Q10g 0.01 0.09 0.02 0.33 1.00
##
## n= 309
##
##
## P
## Q12f Q12a Q10a Q10f Q10g
## Q12f 0.0000 0.0003 0.0021 0.9296
## Q12a 0.0000 0.0008 0.0004 0.1102
## Q10a 0.0003 0.0008 0.0000 0.7763
## Q10f 0.0021 0.0004 0.0000 0.0000
## Q10g 0.9296 0.1102 0.7763 0.0000
mydata_std <- as.data.frame(scale(mydata_dropNA[c("Q12f", "Q12a", "Q10a", "Q10f","Q10g")]))
library(factoextra)
#Finding Eudlidean distances, based on 6 Cluster variables, then saving them into object Distances
Distances <- get_dist(mydata_std,
method = "euclidian")
Distances2 <- Distances^2
fviz_dist(Distances2) #Showing matrix of distances
library(factoextra)
get_clust_tendency(mydata_std, #Hopkins statistics
n = nrow(mydata_std) - 1,
graph = FALSE)
## $hopkins_stat
## [1] 0.5365047
##
## $plot
## NULL
library(dplyr)
WARD <- mydata_std %>% #Selecting variables
get_dist(method = "euclidean") %>% #Selecting distance
hclust(method = "ward.D2") #Selecting algorithm
WARD
##
## Call:
## hclust(d = ., method = "ward.D2")
##
## Cluster method : ward.D2
## Distance : euclidean
## Number of objects: 309
library(factoextra)
fviz_dend(WARD) #Dendrogram
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as of ggplot2 3.3.4.
## ℹ The deprecated feature was likely used in the factoextra package.
## Please report the issue at <]8;;https://github.com/kassambara/factoextra/issueshttps://github.com/kassambara/factoextra/issues]8;;>.
set.seed(1)
#install.packages("NbClust")
library(NbClust)
OptNumber <- mydata_std[c("Q12f", "Q12a", "Q10a", "Q10f","Q10g")] %>%
#scale() %>%
NbClust(distance = "euclidean",
min.nc = 2, max.nc = 10,
method = "ward.D2",
index = "all")
## *** : The Hubert index is a graphical method of determining the number of clusters.
## In the plot of Hubert index, we seek a significant knee that corresponds to a
## significant increase of the value of the measure i.e the significant peak in Hubert
## index second differences plot.
##
## *** : The D index is a graphical method of determining the number of clusters.
## In the plot of D index, we seek a significant knee (the significant peak in Dindex
## second differences plot) that corresponds to a significant increase of the value of
## the measure.
##
## *******************************************************************
## * Among all indices:
## * 6 proposed 2 as the best number of clusters
## * 9 proposed 3 as the best number of clusters
## * 2 proposed 4 as the best number of clusters
## * 2 proposed 7 as the best number of clusters
## * 4 proposed 10 as the best number of clusters
##
## ***** Conclusion *****
##
## * According to the majority rule, the best number of clusters is 3
##
##
## *******************************************************************
mydata_std$ClusterWard <- cutree(WARD,
k = 4) #Number of groups
head(mydata_std[c( "ClusterWard")])
## ClusterWard
## 1 1
## 2 1
## 3 1
## 4 2
## 5 3
## 6 3
#Calculating positions of initial leaders
Initial_leaders <- aggregate(mydata_std[, c("Q12f", "Q12a", "Q10a", "Q10f","Q10g")],
by = list(mydata_std$ClusterWard),
FUN = mean)
Initial_leaders
## Group.1 Q12f Q12a Q10a Q10f Q10g
## 1 1 0.46680896 0.84433703 0.1711896 0.5834527 0.4412628
## 2 2 -0.80102794 -0.95014985 -1.8107988 -1.0007866 -0.1160526
## 3 3 -0.07326677 -0.08358824 0.1897904 -0.4610423 -0.6686174
## 4 4 -0.17242822 -0.82240671 0.6564186 0.6265551 0.6906379
library(factoextra)
kmeans_clu <- hkmeans(mydata_std, #Data
k = 4, #Number of groups
hc.metric = "euclidean", #Distance for hierar. clus.
hc.method = "ward.D2") #Algorithm for hierar. clus.
kmeans_clu
## Hierarchical K-means clustering with 4 clusters of sizes 105, 41, 108, 55
##
## Cluster means:
## Q12f Q12a Q10a Q10f Q10g ClusterWard
## 1 0.46680896 0.8443370 0.1711896 0.5834527 0.44126283 1.000000
## 2 -0.83840688 -0.9968851 -1.8328144 -0.8751368 0.02533057 2.097561
## 3 -0.01503778 -0.0078471 0.2024982 -0.5478557 -0.75196831 2.972222
## 4 -0.23665779 -0.8533747 0.6418305 0.6142997 0.61529868 3.909091
##
## Clustering vector:
## [1] 1 1 1 2 3 3 3 3 4 1 3 1 1 3 3 4 4 2 2 1 1 1 3 2 3 3 1 3 2 2 4 4 3 3 1 1 1 2 2 1 3 4 1 3 1 1 1 1 1 1 4 1 1 4 3 3 4 3 3 4 3 2
## [63] 4 1 3 1 1 3 1 1 3 1 3 3 1 1 1 2 4 1 4 1 1 3 1 4 3 1 1 3 1 1 1 1 4 1 3 3 1 1 1 3 4 3 3 1 2 1 3 1 3 1 3 3 1 3 2 4 3 4 1 1 2 2
## [125] 1 1 1 3 3 4 3 4 1 3 3 4 4 3 2 3 1 2 1 1 3 3 3 1 3 4 4 3 3 4 3 1 4 1 4 3 1 1 3 3 1 3 4 2 1 4 4 3 1 1 3 1 3 1 3 2 4 3 2 1 3 3
## [187] 1 2 1 3 1 3 1 1 2 3 3 2 3 3 2 3 3 1 1 3 3 3 3 3 2 3 1 3 4 3 1 1 1 3 4 1 1 3 2 3 3 3 2 3 2 3 1 2 3 3 1 1 2 3 1 1 2 4 4 4 3 4
## [249] 1 4 2 2 2 1 2 1 3 3 3 3 1 4 4 1 2 3 4 1 3 1 4 4 1 2 4 3 1 3 3 1 2 2 2 4 4 1 1 2 3 4 3 4 4 4 4 1 4 3 3 2 3 4 1 1 3 3 4 4 3
##
## Within cluster sum of squares by cluster:
## [1] 227.7933 220.3647 372.5455 129.3344
## (between_SS / total_SS = 50.5 %)
##
## Available components:
##
## [1] "cluster" "centers" "totss" "withinss" "tot.withinss" "betweenss" "size" "iter"
## [9] "ifault" "data" "hclust"
library(factoextra)
fviz_cluster(kmeans_clu,
palette = "Set1",
repel = FALSE,
ggtheme = theme_bw())
mydata_std$ClusterK_Means <- kmeans_clu$cluster
head(mydata_std[c( "ClusterWard", "ClusterK_Means")])
## ClusterWard ClusterK_Means
## 1 1 1
## 2 1 1
## 3 1 1
## 4 2 2
## 5 3 3
## 6 3 3
#Checking for reclassifications
table(mydata_std$ClusterWard)
##
## 1 2 3 4
## 105 40 114 50
table(mydata_std$ClusterK_Means)
##
## 1 2 3 4
## 105 41 108 55
table(mydata_std$ClusterWard, mydata_std$ClusterK_Means)
##
## 1 2 3 4
## 1 105 0 0 0
## 2 0 37 3 0
## 3 0 4 105 5
## 4 0 0 0 50
Centroids <- kmeans_clu$centers
Centroids
## Q12f Q12a Q10a Q10f Q10g ClusterWard
## 1 0.46680896 0.8443370 0.1711896 0.5834527 0.44126283 1.000000
## 2 -0.83840688 -0.9968851 -1.8328144 -0.8751368 0.02533057 2.097561
## 3 -0.01503778 -0.0078471 0.2024982 -0.5478557 -0.75196831 2.972222
## 4 -0.23665779 -0.8533747 0.6418305 0.6142997 0.61529868 3.909091
library(ggplot2)
library(tidyr)
##
## Attaching package: 'tidyr'
## The following object is masked from 'package:magrittr':
##
## extract
Figure <- as.data.frame(Centroids)
Figure$id <- 1:nrow(Figure)
Figure <- pivot_longer(Figure, cols = c(Q12f, Q12a, Q10a, Q10f, Q10g))
Figure$Groups <- factor(Figure$id,
levels = c(1, 2, 3, 4),
labels = c("1", "2", "3", "4"))
Figure$nameFactor <- factor(Figure$name,
levels = c("Q12f", "Q12a", "Q10a", "Q10f","Q10g"),
labels = c("Transparency", "Reputation", "B_Consultant", "Bank_website", "Literature"))
ggplot(Figure, aes(x = nameFactor, y = value)) +
geom_hline(yintercept = 0) +
theme_bw() +
geom_point(aes(shape = Groups, col = Groups), size = 3) +
geom_line(aes(group = id), linewidth = 1) +
ylab("Averages") +
xlab("Cluster variables")+
ylim(-2.0, 1.5)
#Checking if clustering variables successfully differentiate between groups
fit <- aov(cbind(Q12f, Q12a, Q10a, Q10f, Q10g) ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Response Q12f :
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 54.805 18.2685 22.006 6.302e-13 ***
## Residuals 305 253.195 0.8301
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response Q12a :
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 155.66 51.887 103.88 < 2.2e-16 ***
## Residuals 305 152.34 0.499
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response Q10a :
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 167.89 55.963 121.82 < 2.2e-16 ***
## Residuals 305 140.11 0.459
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response Q10f :
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 120.31 40.105 65.173 < 2.2e-16 ***
## Residuals 305 187.69 0.615
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Response Q10g :
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 102.36 34.121 50.608 < 2.2e-16 ***
## Residuals 305 205.64 0.674
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Ali ste si kdaj izposodili več kot 300 EUR?
aggregate(mydata_dropNA$Q2,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 1.819048
## 2 2 1.512195
## 3 3 1.740741
## 4 4 1.672727
fit <- aov(mydata_dropNA$Q2 ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 2.96 0.9875 5.135 0.00177 **
## Residuals 305 58.66 0.1923
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Če bi si v prihodnosti želeli kupiti naslednje izdelke ali storitve, kako bi jih financirali? (Pri tem 0 pomeni v celoti iz tekočih prihodkov in prihrankov, 100 v celoti iz posojil, vmesne možnosti pa kombinacijo po vaši izbiri).
#ODG: Nepremičnine (stanovanja, hiše ipd.)
aggregate(mydata_dropNA$Q7f_1,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 74.36190
## 2 2 60.36585
## 3 3 70.00926
## 4 4 76.25455
fit <- aov(mydata_dropNA$Q7f_1 ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 7416 2472.0 3.167 0.0247 *
## Residuals 305 238047 780.5
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Če bi si moral izposoditi do 25.000 EUR, kako verjetno bi si jih izposodil iz naslednjih virov?
#ODG: Banka
aggregate(mydata_dropNA$Q8a,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 4.314286
## 2 2 3.000000
## 3 3 4.074074
## 4 4 4.000000
fit <- aov(mydata_dropNA$Q8a ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 51.96 17.321 19.28 1.79e-11 ***
## Residuals 305 274.04 0.898
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Če bi si moral izposoditi več kot 25.000 EUR, kako verjetno bi si jih izposodil iz naslednjih virov?
#ODG: Banka
aggregate(mydata_dropNA$Q9a,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 4.600000
## 2 2 3.707317
## 3 3 4.296296
## 4 4 4.436364
fit <- aov(mydata_dropNA$Q9a ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 24.21 8.072 9.195 7.67e-06 ***
## Residuals 305 267.73 0.878
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#V kakšni meri se strinjate z naslednjimi trditvami?Več informacij o financah, bi iskal/a ...
#ODG:pri bančnem svetovalcu.
aggregate(mydata_dropNA$Q10a,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 3.876190
## 2 2 1.878049
## 3 3 3.907407
## 4 4 4.345455
fit <- aov(mydata_dropNA$Q10a ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 166.9 55.64 121.8 <2e-16 ***
## Residuals 305 139.3 0.46
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#V kakšni meri se strinjate z naslednjimi trditvami?Več informacij o financah, bi iskal/a ...
#ODG:pri družinskih članih.
aggregate(mydata_dropNA$Q10b,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 3.752381
## 2 2 3.146341
## 3 3 3.888889
## 4 4 3.890909
fit <- aov(mydata_dropNA$Q10b ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 18.11 6.036 6.333 0.000354 ***
## Residuals 305 290.70 0.953
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#V kakšni meri se strinjate z naslednjimi trditvami?Več informacij o financah, bi iskal/a ...
#ODG:na uradnih spletnih virih banke (spletna stran, družbena omrežja).
aggregate(mydata_dropNA$Q10f,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 4.295238
## 2 2 2.780488
## 3 3 3.120370
## 4 4 4.327273
fit <- aov(mydata_dropNA$Q10f ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 129.8 43.25 65.17 <2e-16 ***
## Residuals 305 202.4 0.66
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#V kakšni meri se strinjate z naslednjimi trditvami?Več informacij o financah, bi iskal/a ...
#ODG:v izobraževalni literaturi o financah.
aggregate(mydata_dropNA$Q10g,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 4.057143
## 2 2 3.585366
## 3 3 2.703704
## 4 4 4.254545
fit <- aov(mydata_dropNA$Q10g ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 131.7 43.90 50.61 <2e-16 ***
## Residuals 305 264.6 0.87
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#V kakšni meri se strinjate z naslednjimi trditvami?Več informacij o financah, bi iskal/a ...
#ODG:na internetu.
aggregate(mydata_dropNA$Q10h,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 4.076190
## 2 2 3.829268
## 3 3 3.648148
## 4 4 4.145455
fit <- aov(mydata_dropNA$Q10h ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 13.62 4.539 5.04 0.00201 **
## Residuals 305 274.66 0.901
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Na lestvici označite, v kakšni meri se strinjate ali ne strinjate z naslednjimi trditvami:
#ODG:Banke imajo med mladimi dober ugled posojilodajalcev denarja.
aggregate(mydata_dropNA$Q12a,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 3.485714
## 2 2 1.756098
## 3 3 2.685185
## 4 4 1.890909
fit <- aov(mydata_dropNA$Q12a ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 137.4 45.79 103.9 <2e-16 ***
## Residuals 305 134.4 0.44
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Na lestvici označite, v kakšni meri se strinjate ali ne strinjate z naslednjimi trditvami:
#ODG:Menim, da bančna posojila predstavljajo priložnost za mojo prihodnost.
aggregate(mydata_dropNA$Q12b,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 3.780952
## 2 2 2.756098
## 3 3 3.268519
## 4 4 3.327273
fit <- aov(mydata_dropNA$Q12b ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 34.33 11.442 12.08 1.71e-07 ***
## Residuals 305 288.84 0.947
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Na lestvici označite, v kakšni meri se strinjate ali ne strinjate z naslednjimi trditvami:
#ODG:Postopek jemanja bančnega posojila dojemam kot pozitiven.
aggregate(mydata_dropNA$Q12c,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 3.247619
## 2 2 2.292683
## 3 3 2.861111
## 4 4 3.054545
fit <- aov(mydata_dropNA$Q12c ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 28.47 9.490 10.65 1.12e-06 ***
## Residuals 305 271.80 0.891
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Na lestvici označite, v kakšni meri se strinjate ali ne strinjate z naslednjimi trditvami:
#ODG:Posojilo bi vzel pri banki, pri kateri nimam odprtega računa, če bi mi dala ugodnejšo ponudbo za posojilo v primerjavi z banko, kjer ga imam.
aggregate(mydata_dropNA$Q12d,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 3.980952
## 2 2 3.731707
## 3 3 3.842593
## 4 4 4.254545
fit <- aov(mydata_dropNA$Q12d ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 8.4 2.8001 2.917 0.0344 *
## Residuals 305 292.8 0.9599
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Na lestvici označite, v kakšni meri se strinjate ali ne strinjate z naslednjimi trditvami:
#ODG:Banke mi zagotovijo vse informacije, ki jih potrebujem za vzem posojila pri njih.
aggregate(mydata_dropNA$Q12f,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 3.695238
## 2 2 2.439024
## 3 3 3.231481
## 4 4 3.018182
fit <- aov(mydata_dropNA$Q12f ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 50.77 16.922 22.01 6.3e-13 ***
## Residuals 305 234.54 0.769
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Kako pomembni so naslednji dejavniki pri izbiri, od koga bi si izposodili denar?
#ODG:Jasnost pogojev odplačevanja posojila/pogodbe
aggregate(mydata_dropNA$Q13a,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 4.619048
## 2 2 4.390244
## 3 3 4.453704
## 4 4 4.727273
fit <- aov(mydata_dropNA$Q13a ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 4.28 1.4256 3.101 0.027 *
## Residuals 305 140.20 0.4597
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Kako pomembni so naslednji dejavniki pri izbiri, od koga bi si izposodili denar?
#ODG:Stroški izposoje
aggregate(mydata_dropNA$Q13c,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 4.542857
## 2 2 4.292683
## 3 3 4.481481
## 4 4 4.709091
fit <- aov(mydata_dropNA$Q13c ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 4.3 1.4329 2.976 0.0319 *
## Residuals 305 146.8 0.4815
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Kako jasni so po vašem mnenju pogoji izposoje denarja iz naslednjih virov?
#ODG:Banka
aggregate(mydata_dropNA$Q15a,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 4.371429
## 2 2 3.243902
## 3 3 3.907407
## 4 4 3.945455
fit <- aov(mydata_dropNA$Q15a ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 38.93 12.978 18.16 7.24e-11 ***
## Residuals 305 217.99 0.715
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Kako jasni so po vašem mnenju pogoji izposoje denarja iz naslednjih virov?
#ODG:Družina
aggregate(mydata_dropNA$Q15b,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 3.180952
## 2 2 3.902439
## 3 3 3.462963
## 4 4 3.600000
fit <- aov(mydata_dropNA$Q15b ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 17.2 5.750 4.183 0.00637 **
## Residuals 305 419.2 1.375
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Kako jasni so po vašem mnenju pogoji izposoje denarja iz naslednjih virov?
#ODG:Prijatelji
aggregate(mydata_dropNA$Q15c,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 2.638095
## 2 2 3.439024
## 3 3 2.796296
## 4 4 2.890909
fit <- aov(mydata_dropNA$Q15c ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 19.3 6.445 4.299 0.00545 **
## Residuals 305 457.2 1.499
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Kako jasni so po vašem mnenju pogoji izposoje denarja iz naslednjih virov?
#ODG:Komercialna posojila (obročno odplačevanje pri prodajalcu)
aggregate(mydata_dropNA$Q15d,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 3.780952
## 2 2 3.097561
## 3 3 3.462963
## 4 4 3.563636
fit <- aov(mydata_dropNA$Q15d ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 14.79 4.931 5.969 0.000576 ***
## Residuals 305 251.95 0.826
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Kako jasni so po vašem mnenju pogoji izposoje denarja iz naslednjih virov?
#ODG:Obročno odplačevanje z bančno kartico
aggregate(mydata_dropNA$Q15e,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 3.790476
## 2 2 3.268293
## 3 3 3.629630
## 4 4 3.745455
fit <- aov(mydata_dropNA$Q15e ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 8.58 2.8589 3.944 0.00877 **
## Residuals 305 221.06 0.7248
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Kako prilagodljivi so po vašem mnenju pogoji odplačevanja pri izposojanju denarja iz naslednjih virov?
#ODG:Banka
aggregate(mydata_dropNA$Q16a,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 2.428571
## 2 2 2.121951
## 3 3 2.712963
## 4 4 2.381818
fit <- aov(mydata_dropNA$Q16a ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 11.93 3.975 3.847 0.01 **
## Residuals 305 315.19 1.033
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Kako preprost (hiter) je postopek pridobivanja posojila iz naslednjih virov?
#ODG:Banka
aggregate(mydata_dropNA$Q17a,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 2.580952
## 2 2 2.170732
## 3 3 2.722222
## 4 4 2.436364
fit <- aov(mydata_dropNA$Q17a ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 9.9 3.304 3.183 0.0242 *
## Residuals 305 316.6 1.038
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Kako ugodno (obresti) je po vašem mnenju izposojanje denarja iz naslednjih virov?
#ODG: Komercialna posojila (obročno odplačevanje pri prodajalcu)
aggregate(mydata_dropNA$Q18d,
by = list(mydata_std$ClusterK_Means),
FUN = "mean")
## Group.1 x
## 1 1 2.666667
## 2 2 2.219512
## 3 3 2.685185
## 4 4 2.636364
fit <- aov(mydata_dropNA$Q18d ~ as.factor(ClusterK_Means),
data = mydata_std)
summary(fit)
## Df Sum Sq Mean Sq F value Pr(>F)
## as.factor(ClusterK_Means) 3 7.24 2.412 3.113 0.0266 *
## Residuals 305 236.38 0.775
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# Iz katere slovenske regije prihajate?
chi_square <- chisq.test(mydata_dropNA$Region_F, as.factor(mydata_std$ClusterK_Means))
## Warning in chisq.test(mydata_dropNA$Region_F, as.factor(mydata_std$ClusterK_Means)): Chi-squared approximation may be incorrect
chi_square
##
## Pearson's Chi-squared test
##
## data: mydata_dropNA$Region_F and as.factor(mydata_std$ClusterK_Means)
## X-squared = 41.08, df = 24, p-value = 0.01632
addmargins(chi_square$observed)
##
## mydata_dropNA$Region_F 1 2 3 4 Sum
## Ljubljana z okolico 45 18 56 22 141
## Štajerska 15 6 8 9 38
## Prekmurje 0 4 0 4 8
## Dolenjska 19 8 25 7 59
## Primorska 7 2 7 1 17
## Gorenjska 8 2 4 6 20
## Goriška 3 1 2 0 6
## Koroška 6 0 3 1 10
## Notranjska 2 0 3 4 9
## Sum 105 41 108 54 308
addmargins(round(chi_square$expected, 2))
##
## mydata_dropNA$Region_F 1 2 3 4 Sum
## Ljubljana z okolico 48.07 18.77 49.44 24.72 141.00
## Štajerska 12.95 5.06 13.32 6.66 37.99
## Prekmurje 2.73 1.06 2.81 1.40 8.00
## Dolenjska 20.11 7.85 20.69 10.34 58.99
## Primorska 5.80 2.26 5.96 2.98 17.00
## Gorenjska 6.82 2.66 7.01 3.51 20.00
## Goriška 2.05 0.80 2.10 1.05 6.00
## Koroška 3.41 1.33 3.51 1.75 10.00
## Notranjska 3.07 1.20 3.16 1.58 9.01
## Sum 105.01 40.99 108.00 53.99 307.99
round(chi_square$res, 2)
##
## mydata_dropNA$Region_F 1 2 3 4
## Ljubljana z okolico -0.44 -0.18 0.93 -0.55
## Štajerska 0.57 0.42 -1.46 0.91
## Prekmurje -1.65 2.84 -1.67 2.19
## Dolenjska -0.25 0.05 0.95 -1.04
## Primorska 0.50 -0.17 0.43 -1.15
## Gorenjska 0.45 -0.41 -1.14 1.33
## Goriška 0.67 0.23 -0.07 -1.03
## Koroška 1.40 -1.15 -0.27 -0.57
## Notranjska -0.61 -1.09 -0.09 1.93
library(effectsize)
effectsize::cramers_v(mydata_dropNA$Region_F, mydata_std$ClusterK_Means)
## Cramer's V (adj.) | 95% CI
## --------------------------------
## 0.14 | [0.00, 1.00]
##
## - One-sided CIs: upper bound fixed at [1.00].
# Iz katere slovenske regije prihajate?
chi_square <- chisq.test(mydata_dropNA$Region_F, as.factor(mydata_std$ClusterK_Means))
## Warning in chisq.test(mydata_dropNA$Region_F, as.factor(mydata_std$ClusterK_Means)): Chi-squared approximation may be incorrect
chi_square
##
## Pearson's Chi-squared test
##
## data: mydata_dropNA$Region_F and as.factor(mydata_std$ClusterK_Means)
## X-squared = 41.08, df = 24, p-value = 0.01632
addmargins(chi_square$observed)
##
## mydata_dropNA$Region_F 1 2 3 4 Sum
## Ljubljana z okolico 45 18 56 22 141
## Štajerska 15 6 8 9 38
## Prekmurje 0 4 0 4 8
## Dolenjska 19 8 25 7 59
## Primorska 7 2 7 1 17
## Gorenjska 8 2 4 6 20
## Goriška 3 1 2 0 6
## Koroška 6 0 3 1 10
## Notranjska 2 0 3 4 9
## Sum 105 41 108 54 308
addmargins(round(chi_square$expected, 2))
##
## mydata_dropNA$Region_F 1 2 3 4 Sum
## Ljubljana z okolico 48.07 18.77 49.44 24.72 141.00
## Štajerska 12.95 5.06 13.32 6.66 37.99
## Prekmurje 2.73 1.06 2.81 1.40 8.00
## Dolenjska 20.11 7.85 20.69 10.34 58.99
## Primorska 5.80 2.26 5.96 2.98 17.00
## Gorenjska 6.82 2.66 7.01 3.51 20.00
## Goriška 2.05 0.80 2.10 1.05 6.00
## Koroška 3.41 1.33 3.51 1.75 10.00
## Notranjska 3.07 1.20 3.16 1.58 9.01
## Sum 105.01 40.99 108.00 53.99 307.99
round(chi_square$res, 2)
##
## mydata_dropNA$Region_F 1 2 3 4
## Ljubljana z okolico -0.44 -0.18 0.93 -0.55
## Štajerska 0.57 0.42 -1.46 0.91
## Prekmurje -1.65 2.84 -1.67 2.19
## Dolenjska -0.25 0.05 0.95 -1.04
## Primorska 0.50 -0.17 0.43 -1.15
## Gorenjska 0.45 -0.41 -1.14 1.33
## Goriška 0.67 0.23 -0.07 -1.03
## Koroška 1.40 -1.15 -0.27 -0.57
## Notranjska -0.61 -1.09 -0.09 1.93
library(effectsize)
effectsize::cramers_v(mydata_dropNA$Region_F, mydata_std$ClusterK_Means)
## Cramer's V (adj.) | 95% CI
## --------------------------------
## 0.14 | [0.00, 1.00]
##
## - One-sided CIs: upper bound fixed at [1.00].
#Navedite svojo najvišjo doseženo izobrazbo.
chi_square <- chisq.test(mydata_dropNA$Education_F , as.factor(mydata_std$ClusterK_Means))
## Warning in chisq.test(mydata_dropNA$Education_F, as.factor(mydata_std$ClusterK_Means)): Chi-squared approximation may be incorrect
chi_square
##
## Pearson's Chi-squared test
##
## data: mydata_dropNA$Education_F and as.factor(mydata_std$ClusterK_Means)
## X-squared = 26.047, df = 12, p-value = 0.01057
addmargins(chi_square$observed)
##
## mydata_dropNA$Education_F 1 2 3 4 Sum
## Primary school 0 1 1 0 2
## High school 28 15 44 18 105
## Vocational School 5 5 12 3 25
## Undergraduate 66 19 42 24 151
## Post-Graduate 6 1 9 10 26
## Sum 105 41 108 55 309
addmargins(round(chi_square$expected, 2))
##
## mydata_dropNA$Education_F 1 2 3 4 Sum
## Primary school 0.68 0.27 0.70 0.36 2.01
## High school 35.68 13.93 36.70 18.69 105.00
## Vocational School 8.50 3.32 8.74 4.45 25.01
## Undergraduate 51.31 20.04 52.78 26.88 151.01
## Post-Graduate 8.83 3.45 9.09 4.63 26.00
## Sum 105.00 41.01 108.01 55.01 309.03
round(chi_square$res, 2)
##
## mydata_dropNA$Education_F 1 2 3 4
## Primary school -0.82 1.43 0.36 -0.60
## High school -1.29 0.29 1.21 -0.16
## Vocational School -1.20 0.92 1.10 -0.69
## Undergraduate 2.05 -0.23 -1.48 -0.55
## Post-Graduate -0.95 -1.32 -0.03 2.50
library(effectsize)
effectsize::cramers_v(mydata_dropNA$Education_F , mydata_std$ClusterK_Means)
## Cramer's V (adj.) | 95% CI
## --------------------------------
## 0.12 | [0.00, 1.00]
##
## - One-sided CIs: upper bound fixed at [1.00].
#Navedite svojo najvišjo doseženo izobrazbo.
chi_square <- chisq.test(mydata_dropNA$Knowledge_F, as.factor(mydata_std$ClusterK_Means))
chi_square
##
## Pearson's Chi-squared test
##
## data: mydata_dropNA$Knowledge_F and as.factor(mydata_std$ClusterK_Means)
## X-squared = 12.581, df = 3, p-value = 0.005637
addmargins(chi_square$observed)
##
## mydata_dropNA$Knowledge_F 1 2 3 4 Sum
## Have 58 32 53 37 180
## Dont_have 47 9 55 18 129
## Sum 105 41 108 55 309
addmargins(round(chi_square$expected, 2))
##
## mydata_dropNA$Knowledge_F 1 2 3 4 Sum
## Have 61.17 23.88 62.91 32.04 180
## Dont_have 43.83 17.12 45.09 22.96 129
## Sum 105.00 41.00 108.00 55.00 309
round(chi_square$res, 2)
##
## mydata_dropNA$Knowledge_F 1 2 3 4
## Have -0.40 1.66 -1.25 0.88
## Dont_have 0.48 -1.96 1.48 -1.04
library(effectsize)
effectsize::cramers_v(mydata_dropNA$Knowledge_F, mydata_std$ClusterK_Means)
## Cramer's V (adj.) | 95% CI
## --------------------------------
## 0.18 | [0.00, 1.00]
##
## - One-sided CIs: upper bound fixed at [1.00].