One-Way ANOVA (Y=Continuous, X>2)

Anova = Analysis of Variance

### Read the Excel File
library(readxl)
time_data <- read_excel("C:\\Users\\samy_\\Desktop\\R_Python_Machine Learning DataSets\\time_data.xlsx")
colnames(time_data)
## [1] "emp1" "emp2" "emp3"
#View(time_data)

########### Step 1: Normality Test ######################################

# In order to do normality test stack the data
stacked_data <- stack(time_data)
#View(stacked_data)
attach(stacked_data)

shapiro.test(values)
## 
##  Shapiro-Wilk normality test
## 
## data:  values
## W = 0.99432, p-value = 0.3268
qqnorm(values)

# p-value = 0.3268 > 0.05 so p high null fly => It follows normal distribution

########### Step 2: Anova Test ########################################
# Null Hyp: Means are equal
# Alternative Hyp: Means are not equal

Anova_results <- aov(values~ind, data = stacked_data)
summary(Anova_results)
##              Df Sum Sq Mean Sq F value   Pr(>F)    
## ind           2    180   89.93   7.402 0.000729 ***
## Residuals   297   3608   12.15                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
# p-value = 0.0007 < 0.05 so p low null go => accept alternate Hyp = means are not equal