library(readxl)
library(ggpubr)
## Loading required package: ggplot2
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
library(effectsize)
library(effsize)
A6Q32<- read_excel("C:/Users/NITHIN KUMAR/OneDrive/Desktop/Form 1098-T/A6Q32.xlsx")
colnames(A6Q32) <- c("exercise", "bodyweight_kg")
A6Q32 %>%
group_by(exercise) %>%
summarise(
Mean = mean(bodyweight_kg, na.rm = TRUE),
Median = median(bodyweight_kg, na.rm = TRUE),
SD = sd(bodyweight_kg, na.rm = TRUE),
N = n()
)
## # A tibble: 2 × 5
## exercise Mean Median SD N
## <chr> <dbl> <dbl> <dbl> <int>
## 1 cardio 74.7 73.3 7.57 25
## 2 nocardio 70.8 69.5 7.35 25
hist(A6Q32$bodyweight_kg[A6Q32$exercise == "cardio"],
main = "Histogram of cardio",
xlab = "Value",
ylab = "Frequency",
col = "lightblue",
border = "black",
breaks = 10)

hist(A6Q32$bodyweight_kg[A6Q32$exercise == "nocardio"],
main = "Histogram of nocardio",
xlab = "Value",
ylab = "Frequency",
col = "lightgreen",
border = "black",
breaks = 10)

#Group 1: cardio
#The first variable looks normally distributed.
#The data is symmetrical.
#The data has a proper bell curve.
#Group 2: NOCARDIO
#The second variable looks normally distributed.
#The data is POSTIVE SKEWED.
#The data has a proper bell curve.
ggboxplot(A6Q32, x = "exercise", y = "bodyweight_kg",
color = "exercise",
palette = "jco",
add = "jitter")

#Boxplot 1: Nocardio
#There are NO dots outside the boxplot.
#The dots are close to the whiskers.
#The dots are not very far away from the whiskers.
#The outliers are balanced.
#Based on these findings, the boxplot is normal.
#Boxplot 2: Cardio
#There are NO dots outside the boxplot.
#The dots are close to the whiskers.
#The dots are not very far away from the whiskers.
#The outliers are balanced.
#Based on these findings, the boxplot is normal
shapiro.test(A6Q32$bodyweight_kg[A6Q32$exercise == "nocardio"])
##
## Shapiro-Wilk normality test
##
## data: A6Q32$bodyweight_kg[A6Q32$exercise == "nocardio"]
## W = 0.97686, p-value = 0.8166
shapiro.test(A6Q32$bodyweight_kg[A6Q32$exercise == "cardio"])
##
## Shapiro-Wilk normality test
##
## data: A6Q32$bodyweight_kg[A6Q32$exercise == "cardio"]
## W = 0.96745, p-value = 0.5812
#Group 1: nocardio
#The first group is normally distributed, (p = 0.8166).
#Group 2: cardio
#The second group is normally distributed, (p = 0.5812).
t.test(bodyweight_kg ~ exercise, data = A6Q32, var.equal = TRUE)
##
## Two Sample t-test
##
## data: bodyweight_kg by exercise
## t = 1.8552, df = 48, p-value = 0.06971
## alternative hypothesis: true difference in means between group cardio and group nocardio is not equal to 0
## 95 percent confidence interval:
## -0.3280454 8.1605622
## sample estimates:
## mean in group cardio mean in group nocardio
## 74.73336 70.81710
#An Independent T-Test was conducted to determine if there was a difference in OutcomeVariable between nocardio and cardio.
#nocardio scores (M = 70.8, SD = 7.35) were significantly different from cardio scores (M = 74.7, SD = 7.57), t(df#) = 48, p =0.06971.