library(readxl)
Data <- read_excel("D:/SIIT SHS STAT/Jay Ann/JAY ANN.xls")
New names:
• `Indicator 1` -> `Indicator 1...5`
• `Indicator 2` -> `Indicator 2...6`
• `Indicator 3` -> `Indicator 3...7`
• `Indicator 4` -> `Indicator 4...8`
• `Indicator 1` -> `Indicator 1...9`
• `Indicator 2` -> `Indicator 2...10`
• `Indicator 3` -> `Indicator 3...11`
• `Indicator 4` -> `Indicator 4...12`
• `Indicator 1` -> `Indicator 1...13`
• `Indicator 2` -> `Indicator 2...14`
• `Indicator 3` -> `Indicator 3...15`
• `Indicator 4` -> `Indicator 4...16`
• `Indicator 1` -> `Indicator 1...17`
• `Indicator 2` -> `Indicator 2...18`
• `Indicator 3` -> `Indicator 3...19`
• `Indicator 4` -> `Indicator 4...20`
View(Data)
library(rmarkdown)
paged_table(Data)
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
D1 <- Data%>%
group_by(Age) %>%
summarise(count=n())%>%
mutate(Percentage =round((count/sum(count)*100),2))
paged_table(D1)
D2 <- Data%>%
group_by(Sex) %>%
summarise(count=n())%>%
mutate(Percentage =round((count/sum(count)*100),2))
paged_table(D2)
D3 <- Data%>%
group_by(`Strand`) %>%
summarise(count=n())%>%
mutate(Percentage =round((count/sum(count)*100),2))
paged_table(D3)
res_aov <- aov(`Financial` ~ Sex,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.972, p-value = 0.03151
Data is not normally distributed.
res_aov <- aov(`Socio Economic` ~ Sex,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.96136, p-value = 0.005036
Data is not normally distributed.
res_aov <- aov(`School Work` ~ Sex,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.94548, p-value = 0.000423
Data is not normally distributed.
res_aov <- aov(`Social Relation` ~ Sex,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.91761, p-value = 1.053e-05
Data is not normally distributed.
res_aov <- aov(`Financial` ~ Age,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.95886, p-value = 0.003339
Data is not normally distributed.
res_aov <- aov(`Socio Economic` ~ Age,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.95582, p-value = 0.002049
Data is not normally distributed.
res_aov <- aov(`School Work` ~ Age,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.94545, p-value = 0.0004212
Data is not normally distributed.
res_aov <- aov(`Social Relation` ~ Age,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.90954, p-value = 4.087e-06
Data is not normally distributed.
res_aov <- aov(`Financial` ~ Strand,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.97391, p-value = 0.04434
Data is not normally distributed.
res_aov <- aov(`Socio Economic` ~ Strand,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.96622, p-value = 0.01145
Data is not normally distributed.
res_aov <- aov(`School Work` ~ Strand,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.96949, p-value = 0.02019
Data is not normally distributed.
res_aov <- aov(`Social Relation` ~ Strand,
data = Data
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.93104, p-value = 5.703e-05
Data is not normally distributed.
library(readxl)
library(dplyr)
library(car)
Loading required package: carData
Attaching package: 'car'
The following object is masked from 'package:dplyr':
recode
library(tidyverse)
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ forcats 1.0.0 ✔ readr 2.1.5
✔ ggplot2 3.4.4 ✔ stringr 1.5.1
✔ lubridate 1.9.3 ✔ tibble 3.2.1
✔ purrr 1.0.2 ✔ tidyr 1.3.1
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
✖ car::recode() masks dplyr::recode()
✖ purrr::some() masks car::some()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(ggpubr)
library(rstatix)
Attaching package: 'rstatix'
The following object is masked from 'package:stats':
filter
ggboxplot(Data, x = "Sex", y = "Financial",
color = "Sex", palette = c("#00FF00", "#4E07FC"),
order = c("Male", "Female"),
ylab = "Financial", xlab = "Sex")
ggline(Data, x = "Sex", y = "Financial",
add = c("mean_se", "jitter"),
order = c("Male", "Female"),
ylab = "Financial", xlab = "Sex")
library("gplots")
Attaching package: 'gplots'
The following object is masked from 'package:stats':
lowess
plotmeans(`Financial` ~ Sex, data = Data, frame = TRUE,
xlab = "Sex", ylab = "Financial",
main="Mean Plot with 95% CI")
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
a graphical parameter
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
PlantGrowth <- Data %>%
reorder_levels(Sex, order = c("Male", "Female"))
PlantGrowth %>%
group_by(Sex) %>%
get_summary_stats(`Financial`, type = "common")
# A tibble: 2 × 11
Sex variable n min max median iqr mean sd se ci
<fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Male Financial 35 2.25 3.75 3 0.25 3.11 0.35 0.059 0.12
2 Female Financial 65 2 3.75 2.75 0.75 2.8 0.487 0.06 0.121
ggboxplot(PlantGrowth, x = "Sex", y = "Financial", fill="Sex")
res.kruskal <- PlantGrowth %>% kruskal_test(`Financial` ~ Sex)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Financial 100 10.3 1 0.0013 Kruskal-Wallis
Based on the p-value, there is significant difference between groups.
ggboxplot(Data, x = "Sex", y = "Socio Economic",
color = "Sex", palette = c("#00FF00", "#4E07FC"),
order = c("Male", "Female"),
ylab = "Socio Economic", xlab = "Sex")
ggline(Data, x = "Sex", y = "Socio Economic",
add = c("mean_se", "jitter"),
order = c("Male", "Female"),
ylab = "Socio Economic", xlab = "Sex")
library("gplots")
plotmeans(`Socio Economic` ~ Sex, data = Data, frame = TRUE,
xlab = "Sex", ylab = "Socio Economic",
main="Mean Plot with 95% CI")
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
a graphical parameter
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
PlantGrowth <- Data %>%
reorder_levels(Sex, order = c("Male", "Female"))
PlantGrowth %>%
group_by(Sex) %>%
get_summary_stats(`Socio Economic`, type = "common")
# A tibble: 2 × 11
Sex variable n min max median iqr mean sd se ci
<fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Male Socio Economic 35 1.25 3.5 2.75 0.75 2.61 0.557 0.094 0.191
2 Female Socio Economic 65 1.5 3.5 2.75 0.75 2.66 0.485 0.06 0.12
ggboxplot(PlantGrowth, x = "Sex", y = "Socio Economic", fill="Sex")
res.kruskal <- PlantGrowth %>% kruskal_test(`Socio Economic` ~ Sex)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Socio Economic 100 0.00772 1 0.93 Kruskal-Wallis
Based on the p-value, there is no significant difference between groups.
ggboxplot(Data, x = "Sex", y = "School Work",
color = "Sex", palette = c("#00FF00", "#4E07FC"),
order = c("Male", "Female"),
ylab = "School Work", xlab = "Sex")
ggline(Data, x = "Sex", y = "School Work",
add = c("mean_se", "jitter"),
order = c("Male", "Female"),
ylab = "School Work", xlab = "Sex")
library("gplots")
plotmeans(`School Work` ~ Sex, data = Data, frame = TRUE,
xlab = "Sex", ylab = "School Work",
main="Mean Plot with 95% CI")
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
a graphical parameter
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
PlantGrowth <- Data %>%
reorder_levels(Sex, order = c("Male", "Female"))
PlantGrowth %>%
group_by(Sex) %>%
get_summary_stats(`School Work`, type = "common")
# A tibble: 2 × 11
Sex variable n min max median iqr mean sd se ci
<fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Male School Work 35 2 4 3.25 0.5 3.15 0.425 0.072 0.146
2 Female School Work 65 2.5 4 3 0.25 3.14 0.342 0.042 0.085
ggboxplot(PlantGrowth, x = "Sex", y = "School Work", fill="Sex")
res.kruskal <- PlantGrowth %>% kruskal_test(`School Work` ~ Sex)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 School Work 100 0.262 1 0.609 Kruskal-Wallis
Based on the p-value, there is no significant difference between groups.
res.kruskal <- PlantGrowth %>% kruskal_test(`Social Relation` ~ Sex)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Social Relation 100 0.00264 1 0.959 Kruskal-Wallis
Based on the p-value, there is no significant difference between groups.
ggboxplot(Data, x = "Age", y = "Financial",
color = "Age", palette = c("#00FF00", "#4E07FC"),
order = c("17 - 18 years old", "19 years old and above"),
ylab = "Financial", xlab = "Age")
ggline(Data, x = "Age", y = "Financial",
add = c("mean_se", "jitter"),
order = c("17 - 18 years old", "19 years old and above"),
ylab = "Financial", xlab = "Age")
library("gplots")
plotmeans(`Financial` ~ Age, data = Data, frame = TRUE,
xlab = "Age", ylab = "Financial",
main="Mean Plot with 95% CI")
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
a graphical parameter
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
PlantGrowth <- Data %>%
reorder_levels(Age, order = c("17 - 18 years old", "19 years old and above"))
PlantGrowth %>%
group_by(Age) %>%
get_summary_stats(`Financial`, type = "common")
# A tibble: 2 × 11
Age variable n min max median iqr mean sd se ci
<fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 17 - 18 years… Financi… 96 2 3.75 3 0.75 2.89 0.463 0.047 0.094
2 19 years old … Financi… 4 2.75 3.75 3.25 0.625 3.25 0.456 0.228 0.726
ggboxplot(PlantGrowth, x = "Age", y = "Financial", fill="Age")
res.kruskal <- PlantGrowth %>% kruskal_test(`Financial` ~ Age)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Financial 100 1.95 1 0.162 Kruskal-Wallis
Based on the p-value, there is no significant difference between groups.
ggboxplot(Data, x = "Age", y = "Socio Economic",
color = "Age", palette = c("#00FF00", "#4E07FC"),
order = c("17 - 18 years old", "19 years old and above"),
ylab = "Socio Economic", xlab = "Age")
ggline(Data, x = "Age", y = "Socio Economic",
add = c("mean_se", "jitter"),
order = c("17 - 18 years old", "19 years old and above"),
ylab = "Socio Economic", xlab = "Age")
library("gplots")
plotmeans(`Socio Economic` ~ Age, data = Data, frame = TRUE,
xlab = "Age", ylab = "Socio Economic",
main="Mean Plot with 95% CI")
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
a graphical parameter
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
PlantGrowth <- Data %>%
reorder_levels(Age, order = c("17 - 18 years old", "19 years old and above"))
PlantGrowth %>%
group_by(Age) %>%
get_summary_stats(`Socio Economic`, type = "common")
# A tibble: 2 × 11
Age variable n min max median iqr mean sd se ci
<fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 17 - 18 years… Socio E… 96 1.25 3.5 2.75 0.75 2.64 0.51 0.052 0.103
2 19 years old … Socio E… 4 2 3.25 2.88 0.5 2.75 0.54 0.27 0.859
ggboxplot(PlantGrowth, x = "Age", y = "Socio Economic", fill="Age")
res.kruskal <- PlantGrowth %>% kruskal_test(`Socio Economic` ~ Age)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Socio Economic 100 0.198 1 0.656 Kruskal-Wallis
Based on the p-value, there is no significant difference between groups.
ggboxplot(Data, x = "Age", y = "School Work",
color = "Age", palette = c("#00FF00", "#4E07FC"),
order = c("17 - 18 years old", "19 years old and above"),
ylab = "School Work", xlab = "Age")
ggline(Data, x = "Age", y = "School Work",
add = c("mean_se", "jitter"),
order = c("17 - 18 years old", "19 years old and above"),
ylab = "School Work", xlab = "Age")
library("gplots")
plotmeans(`School Work` ~ Age, data = Data, frame = TRUE,
xlab = "Age", ylab = "School Work",
main="Mean Plot with 95% CI")
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
a graphical parameter
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
PlantGrowth <- Data %>%
reorder_levels(Age, order = c("17 - 18 years old", "19 years old and above"))
PlantGrowth %>%
group_by(Age) %>%
get_summary_stats(`School Work`, type = "common")
# A tibble: 2 × 11
Age variable n min max median iqr mean sd se ci
<fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 17 - 18 years… School … 96 2 4 3 0.312 3.14 0.373 0.038 0.076
2 19 years old … School … 4 2.75 3.5 3.25 0.562 3.19 0.375 0.188 0.597
ggboxplot(PlantGrowth, x = "Age", y = "School Work", fill="Age")
res.kruskal <- PlantGrowth %>% kruskal_test(`School Work` ~ Age)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 School Work 100 0.0437 1 0.834 Kruskal-Wallis
Based on the p-value, there is no significant difference between groups.
res.kruskal <- PlantGrowth %>% kruskal_test(`Social Relation` ~ Age)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Social Relation 100 0.148 1 0.701 Kruskal-Wallis
Based on the p-value, there is no significant difference between groups.
ggboxplot(Data, x = "Strand", y = "Financial",
color = "Strand", palette = c("#FC4E07", "#0000FF", "#00FF00", "#4E07FC"),
order = c("STEM", "ABM", "HUMSS", "GAS"),
ylab = "Financial", xlab = "Strand")
ggline(Data, x = "Strand", y = "Financial",
add = c("mean_se", "jitter"),
order = c("STEM", "ABM", "HUMSS", "GAS"),
ylab = "Financial", xlab = "Strand")
library("gplots")
plotmeans(`Financial` ~ Strand, data = Data, frame = TRUE,
xlab = "Strand", ylab = "Financial",
main="Mean Plot with 95% CI")
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
a graphical parameter
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
PlantGrowth <- Data %>%
reorder_levels(Strand, order = c("STEM", "ABM", "HUMSS", "GAS"))
PlantGrowth %>%
group_by(Strand) %>%
get_summary_stats(`Financial`, type = "common")
# A tibble: 4 × 11
Strand variable n min max median iqr mean sd se ci
<fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 STEM Financial 19 2 3.75 2.75 0.75 2.68 0.513 0.118 0.247
2 ABM Financial 22 2 3.75 2.75 0.688 2.89 0.468 0.1 0.207
3 HUMSS Financial 23 2.5 3.75 3.25 0.5 3.13 0.36 0.075 0.156
4 GAS Financial 36 2 3.75 2.88 0.75 2.90 0.453 0.075 0.153
ggboxplot(PlantGrowth, x = "Age", y = "Financial", fill="Age")
res.kruskal <- PlantGrowth %>% kruskal_test(`Financial` ~ Strand)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Financial 100 9.40 3 0.0244 Kruskal-Wallis
Based on the table above, there is significant difference between groups. ## Pairwise Comparisons
res1<- PlantGrowth %>%
dunn_test(`Financial` ~ Strand, p.adjust.method = "bonferroni")
res1
# A tibble: 6 × 9
.y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
* <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
1 Financial STEM ABM 19 22 1.19 0.234 1 ns
2 Financial STEM HUMSS 19 23 3.01 0.00261 0.0157 *
3 Financial STEM GAS 19 36 1.45 0.147 0.883 ns
4 Financial ABM HUMSS 22 23 1.88 0.0600 0.360 ns
5 Financial ABM GAS 22 36 0.143 0.886 1 ns
6 Financial HUMSS GAS 23 36 -1.96 0.0505 0.303 ns
ggboxplot(Data, x = "Strand", y = "Socio Economic",
color = "Strand", palette = c("#FC4E07", "#0000FF", "#00FF00", "#4E07FC"),
order = c("STEM", "ABM", "HUMSS", "GAS"),
ylab = "Socio Economic", xlab = "Strand")
ggline(Data, x = "Strand", y = "Socio Economic",
add = c("mean_se", "jitter"),
order = c("STEM", "ABM", "HUMSS", "GAS"),
ylab = "Socio Economic", xlab = "Strand")
library("gplots")
plotmeans(`Socio Economic` ~ Strand, data = Data, frame = TRUE,
xlab = "Strand", ylab = "Socio Economic",
main="Mean Plot with 95% CI")
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
a graphical parameter
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
PlantGrowth <- Data %>%
reorder_levels(Strand, order = c("STEM", "ABM", "HUMSS", "GAS"))
PlantGrowth %>%
group_by(Strand) %>%
get_summary_stats(`Socio Economic`, type = "common")
# A tibble: 4 × 11
Strand variable n min max median iqr mean sd se ci
<fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 STEM Socio Economic 19 2 3.25 2.75 0.625 2.66 0.435 0.1 0.21
2 ABM Socio Economic 22 1.5 3.5 2.62 0.75 2.64 0.581 0.124 0.258
3 HUMSS Socio Economic 23 1.25 3.25 2.75 0.625 2.68 0.496 0.103 0.214
4 GAS Socio Economic 36 1.5 3.5 2.5 0.75 2.62 0.526 0.088 0.178
ggboxplot(PlantGrowth, x = "Age", y = "Socio Economic", fill="Age")
res.kruskal <- PlantGrowth %>% kruskal_test(`Socio Economic` ~ Strand)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Socio Economic 100 0.413 3 0.938 Kruskal-Wallis
Based on the table above, there is no significant difference between groups. ## Pairwise Comparisons
res1<- PlantGrowth %>%
dunn_test(`Socio Economic` ~ Strand, p.adjust.method = "bonferroni")
res1
# A tibble: 6 × 9
.y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
* <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
1 Socio Economic STEM ABM 19 22 -0.0944 0.925 1 ns
2 Socio Economic STEM HUMSS 19 23 0.405 0.686 1 ns
3 Socio Economic STEM GAS 19 36 -0.120 0.904 1 ns
4 Socio Economic ABM HUMSS 22 23 0.520 0.603 1 ns
5 Socio Economic ABM GAS 22 36 -0.0165 0.987 1 ns
6 Socio Economic HUMSS GAS 23 36 -0.598 0.550 1 ns
ggboxplot(Data, x = "Strand", y = "School Work",
color = "Strand", palette = c("#FC4E07", "#0000FF", "#00FF00", "#4E07FC"),
order = c("STEM", "ABM", "HUMSS", "GAS"),
ylab = "School Work", xlab = "Strand")
ggline(Data, x = "Strand", y = "School Work",
add = c("mean_se", "jitter"),
order = c("STEM", "ABM", "HUMSS", "GAS"),
ylab = "School Work", xlab = "Strand")
library("gplots")
plotmeans(`School Work` ~ Strand, data = Data, frame = TRUE,
xlab = "Strand", ylab = "School Work",
main="Mean Plot with 95% CI")
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
a graphical parameter
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
PlantGrowth <- Data %>%
reorder_levels(Strand, order = c("STEM", "ABM", "HUMSS", "GAS"))
PlantGrowth %>%
group_by(Strand) %>%
get_summary_stats(`School Work`, type = "common")
# A tibble: 4 × 11
Strand variable n min max median iqr mean sd se ci
<fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 STEM School Work 19 2.5 3.75 3 0.375 3.10 0.326 0.075 0.157
2 ABM School Work 22 2.5 4 3 0 3.03 0.321 0.068 0.142
3 HUMSS School Work 23 2.5 4 3.25 0.5 3.32 0.371 0.077 0.16
4 GAS School Work 36 2 3.75 3 0.5 3.12 0.399 0.066 0.135
ggboxplot(PlantGrowth, x = "Age", y = "School Work", fill="Age")
res.kruskal <- PlantGrowth %>% kruskal_test(`School Work` ~ Strand)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 School Work 100 9.11 3 0.0279 Kruskal-Wallis
Based on the table above, there is significant difference between groups. ## Pairwise Comparisons
res1<- PlantGrowth %>%
dunn_test(`School Work` ~ Strand, p.adjust.method = "bonferroni")
res1
# A tibble: 6 × 9
.y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
* <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
1 School Work STEM ABM 19 22 -0.975 0.329 1 ns
2 School Work STEM HUMSS 19 23 1.87 0.0613 0.368 ns
3 School Work STEM GAS 19 36 0.370 0.711 1 ns
4 School Work ABM HUMSS 22 23 2.97 0.00298 0.0179 *
5 School Work ABM GAS 22 36 1.52 0.129 0.776 ns
6 School Work HUMSS GAS 23 36 -1.78 0.0751 0.451 ns
res.kruskal <- PlantGrowth %>% kruskal_test(`Social Relation` ~ Strand)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Social Relation 100 6.38 3 0.0946 Kruskal-Wallis
Based on the table above, there is no significant difference between groups. ## Pairwise Comparisons
res1<- PlantGrowth %>%
dunn_test(`Social Relation` ~ Strand, p.adjust.method = "bonferroni")
res1
# A tibble: 6 × 9
.y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
* <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
1 Social Relation STEM ABM 19 22 -1.29 0.198 1 ns
2 Social Relation STEM HUMSS 19 23 -0.481 0.630 1 ns
3 Social Relation STEM GAS 19 36 -2.26 0.0237 0.142 ns
4 Social Relation ABM HUMSS 22 23 0.853 0.394 1 ns
5 Social Relation ABM GAS 22 36 -0.880 0.379 1 ns
6 Social Relation HUMSS GAS 23 36 -1.84 0.0651 0.390 ns
library(readxl)
Data1 <- read_excel("D:/SIIT SHS STAT/Jay Ann/Jay Ann.xlsx")
view(Data1)
res_aov <- aov(`Scores` ~ Variables,
data = Data1
)
shapiro.test(res_aov$residuals)
Shapiro-Wilk normality test
data: res_aov$residuals
W = 0.97024, p-value = 2.8e-07
The data is not normally distributed.
leveneTest(`Scores` ~ Variables,
data = Data1)
Warning in leveneTest.default(y = y, group = group, ...): group coerced to
factor.
Levene's Test for Homogeneity of Variance (center = median)
Df F value Pr(>F)
group 3 3.5038 0.01555 *
396
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
ggboxplot(Data1, x = "Variables", y = "Scores",
color = "Variables", palette = c("#FC4E07", "#0000FF", "#00FF00", "#4E07FC"),
order = c("Financial", "Socio Economic", "School Work", "Social Relation"),
ylab = "Scores", xlab = "Variables")
ggline(Data1, x = "Variables", y = "Scores",
add = c("mean_se", "jitter"),
order = c("Financial", "Socio Economic", "School Work", "Social Relation"),
ylab = "Scores", xlab = "Variables")
library("gplots")
plotmeans(`Scores` ~ Variables, data = Data1, frame = FALSE,
xlab = "Variables", ylab = "Scores",
main="Mean Plot with 95% CI")
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
Warning in axis(1, at = 1:length(means), labels = legends, ...): "frame" is not
a graphical parameter
Warning in plot.xy(xy.coords(x, y), type = type, ...): "frame" is not a
graphical parameter
PlantGrowth <- Data1 %>%
reorder_levels(Variables, order = c("Financial", "Socio Economic", "School Work", "Social Relation"))
PlantGrowth %>%
group_by(Variables) %>%
get_summary_stats(`Scores`, type = "common")
# A tibble: 4 × 11
Variables variable n min max median iqr mean sd se ci
<fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Financial Scores 100 2 3.75 3 0.75 2.91 0.466 0.047 0.092
2 Socio Economic Scores 100 1.25 3.5 2.75 0.75 2.64 0.509 0.051 0.101
3 School Work Scores 100 2 4 3 0.5 3.14 0.371 0.037 0.074
4 Social Relati… Scores 100 1.5 4 3.5 0.75 3.34 0.462 0.046 0.092
The mean of teaching method, teaching quality, and students engagement is 3.002, 3.046, and 3.094, respectively.
ggboxplot(PlantGrowth, x = "Variables", y = "Scores", fill="Variables")
res.kruskal <- PlantGrowth %>% kruskal_test(`Scores` ~ Variables)
res.kruskal
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Scores 400 100. 3 1.43e-21 Kruskal-Wallis
Based on the p-value, there is significant difference was observed between the group pairs.
res1<- PlantGrowth %>%
dunn_test(`Scores` ~ Variables, p.adjust.method = "bonferroni")
res1
# A tibble: 6 × 9
.y. group1 group2 n1 n2 statistic p p.adj p.adj.signif
* <chr> <chr> <chr> <int> <int> <dbl> <dbl> <dbl> <chr>
1 Scores Financial Socio… 100 100 -3.10 1.91e- 3 1.15e- 2 *
2 Scores Financial Schoo… 100 100 3.22 1.29e- 3 7.76e- 3 **
3 Scores Financial Socia… 100 100 6.37 1.84e-10 1.11e- 9 ****
4 Scores Socio Econ… Schoo… 100 100 6.32 2.61e-10 1.56e- 9 ****
5 Scores Socio Econ… Socia… 100 100 9.48 2.62e-21 1.57e-20 ****
6 Scores School Work Socia… 100 100 3.16 1.60e- 3 9.58e- 3 **
Pairwise, there is significant difference.
Based on the provided output above, it can be seen that it is the social relation.
2.1.4 Social Relation and Sex