Order Now
R Programming Solution on ANOVA as a Paired T - Test

R Programming Solution on ANOVA as a Paired T - Test

  • 22nd Dec, 2022
  • 16:42 PM

setwd("~/Assignments/Job 2")
rm(list = ls())

# Load libraries:

# Read the data:
data <- read.csv('length (Autosaved).csv')

# Convert the structure for ANOVA analysis:
data <- melt(data, id = c('Month'))

# Two-way interaction plot
interaction.plot(x.factor = data$variable, trace.factor = data$Month, 
                 response = data$value, fun = mean, 
                 type = "b", legend = TRUE, 
                 xlab = "Treatment", ylab = "Month",
                 pch=c(1,19), col = c("#00AFBB", "#E7B800"))

# Two lines are not parallel thus implying no interaction between Month and treatment factors.

# Perform a two way ANOVA:
anova.result <- aov(value ~ Month + variable, 
                    data = data)

# Thus at 5% level of significance we can conclude that there is a significant statistical difference 
# between the lengths in September to February the following year.

Share this post

assignment helpassignment helperassignment expertsassignment writing services