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
The tables above provides the distributions of respondents in terms of sex, year level, and strand. It can be seen that there are 58 females and 42 males; 23 of which are from ABM, 22 from GAS, 31 from HUMSS, and 24 from STEM.
Call:
lm(formula = `Physical Health` ~ `Mental Health`, data = Data)
Coefficients:
(Intercept) `Mental Health`
1.1373 0.6103
From this, we may deduce that the data fail to satisfy two assumptions – Linearity and Homogeneity of Variance.
Loading required package: carData
Attaching package: 'car'
The following object is masked from 'package:dplyr':
recode
── 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
Attaching package: 'rstatix'
The following object is masked from 'package:stats':
filter
Shapiro-Wilk normality test
data: Data$`Physical Health`
W = 0.95947, p-value = 0.003686
Since p-value = 0.003686 < 0.05, it is conclusive that we reject the null hypothesis. That is, we cannot assume normality.
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 1 0.2379 0.6268
98
The p-value is greater than the 0.05 level of significance. Thus, the homogeneity assumption of the variance is met.
Attaching package: 'gplots'
The following object is masked from 'package:stats':
lowess
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
# 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 Female Physical Health 58 2 3.8 3 0.4 2.92 0.4 0.053 0.105
2 Male Physical Health 42 2.2 4 2.8 0.2 2.90 0.383 0.059 0.119
The mean of female and male is 2.917 and 2.905, respectively.
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Physical Health 100 0.0830 1 0.773 Kruskal-Wallis
Based on the p-value, there is no significant difference on the physical health when grouped according to sex.
Shapiro-Wilk normality test
data: Data$`Mental Health`
W = 0.95781, p-value = 0.002816
Since p-value = 0.002816 < 0.05, it is conclusive that we reject the null hypothesis. That is, we cannot assume normality.
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 1 0.8262 0.3656
98
The p-value is greater than the 0.05 level of significance. Thus, the homogeneity assumption of the variance is met.
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
# 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 Female Mental Health 58 2 3.8 3 0.4 2.91 0.352 0.046 0.092
2 Male Mental Health 42 1.8 4 2.9 0.35 2.90 0.44 0.068 0.137
The mean of female and male is 2.910 and 2.905, respectively.
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Mental Health 100 0.00325 1 0.955 Kruskal-Wallis
Based on the p-value, there is no significant difference on the physical health when grouped according to sex.
Shapiro-Wilk normality test
data: Data$`Physical Health`
W = 0.95947, p-value = 0.003686
Since p-value = 0.003686 < 0.05, it is conclusive that we reject the null hypothesis. That is, we cannot assume normality.
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 0.072 0.9748
96
The p-value is greater than the 0.05 level of significance. Thus, the homogeneity assumption of the variance is met.
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
# 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 Physical Health 24 2.6 4 3 0.3 3.13 0.371 0.076 0.157
2 ABM Physical Health 23 2.2 3.6 2.8 0.4 2.78 0.366 0.076 0.158
3 HUMSS Physical Health 31 2 3.6 2.8 0.4 2.86 0.384 0.069 0.141
4 GAS Physical Health 22 2.2 3.6 3 0.35 2.88 0.374 0.08 0.166
The mean of STEM, ABM, HUMSS, and GAS is 3.133, 2.783, 2.858, and 2.882, respectively.
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Physical Health 100 11.1 3 0.0114 Kruskal-Wallis
Based on the p-value, there is significant difference was observed between the group pairs.
# 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 Physical Heal… STEM ABM 24 23 -3.14 0.00170 0.0102 *
2 Physical Heal… STEM HUMSS 24 31 -2.58 0.00984 0.0591 ns
3 Physical Heal… STEM GAS 24 22 -1.91 0.0559 0.335 ns
4 Physical Heal… ABM HUMSS 23 31 0.777 0.437 1 ns
5 Physical Heal… ABM GAS 23 22 1.18 0.239 1 ns
6 Physical Heal… HUMSS GAS 31 22 0.493 0.622 1 ns
There is significant difference between STEM and ABM, STEM and HUMSS.
Shapiro-Wilk normality test
data: Data$`Mental Health`
W = 0.95781, p-value = 0.002816
Since p-value = 0.002816 < 0.05, it is conclusive that we reject the null hypothesis. That is, we cannot assume normality.
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 0.3016 0.8242
96
The p-value is greater than the 0.05 level of significance. Thus, the homogeneity assumption of the variance is met.
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
# 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 Mental Health 24 2.4 4 3 0.4 3.02 0.377 0.077 0.159
2 ABM Mental Health 23 2 3.8 2.8 0.4 2.87 0.416 0.087 0.18
3 HUMSS Mental Health 31 1.8 3.6 2.8 0.4 2.81 0.363 0.065 0.133
4 GAS Mental Health 22 2.2 3.8 3 0.35 2.97 0.392 0.084 0.174
The mean of STEM, ABM, HUMSS, and GAS is 3.017, 2.870, 2.806, and 2.973, respectively.
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Mental Health 100 5.62 3 0.132 Kruskal-Wallis
Based on the p-value, there is no significant difference was observed between the group pairs.
# 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 Mental Health STEM ABM 24 23 -1.42 0.154 0.926 ns
2 Mental Health STEM HUMSS 24 31 -2.15 0.0314 0.188 ns
3 Mental Health STEM GAS 24 22 -0.439 0.660 1 ns
4 Mental Health ABM HUMSS 23 31 -0.616 0.538 1 ns
5 Mental Health ABM GAS 23 22 0.959 0.338 1 ns
6 Mental Health HUMSS GAS 31 22 1.63 0.102 0.614 ns
There is significant difference between STEM and HUMSS.
Shapiro-Wilk normality test
data: Data1$Scores
W = 0.96029, p-value = 2.126e-05
Since p-value = 2.126e-05 < 0.05, it is conclusive that we reject the null hypothesis. That is, we cannot assume normality.
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 1 0.012 0.913
198
The p-value is greater than the 0.05 level of significance. Thus, the homogeneity assumption of the variance is met.
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
# A tibble: 2 × 11
Variables variable n min max median iqr mean sd se ci
<fct> <fct> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 Physical Heal… Scores 100 2 4 2.9 0.4 2.91 0.391 0.039 0.078
2 Mental Health Scores 100 1.8 4 3 0.4 2.91 0.389 0.039 0.077
The mean of physical health and mental health is 2.912 and 2.908, respectively.
# A tibble: 1 × 6
.y. n statistic df p method
* <chr> <int> <dbl> <int> <dbl> <chr>
1 Scores 200 0.00675 1 0.935 Kruskal-Wallis
Based on the p-value, there is no significant difference between physical health and mental health.
Based on the provided output above, we can say that it is the physical health.