Duration 10:34

Interaction plots for 2 factor Factorial experiment in RStudio

2 789 watched
0
30
Published 17 May 2021

#interactionplot #RStudio #twowayinteraction In this tutorial, I am going to show you how to create and edit interaction plots in R studio for 2 factors factorial experiment. Below is the code I used in the video. I took an example from agriculture research and used hypothetical data for analysis. Please note that angle brackets are not allowed in youtube video descriptions, so I left notes below where the angle brackets need to be inserted within the code. #install package "daewr" install.packages(daewr) #install package "gvlma" install.packages(gvlma) #installpackage "agricolae" install.packages(agricolae) #setting working directory setwd("C:/Users/ANUJ/Desktop/RStudio analysis series/interaction among factors") #reading the file anuj (insert angled bracket here)-read.csv("onion.csv", header = TRUE) attach(anuj) anuj #assigning the factors anuj$primingagent=as.factor(primingagent) anuj$concentration=as.factor(concentration) #check assumptions of ANOVA require(gvlma) fit=lm(germination~primingagent*concentration, data = anuj) gvlma(fit) boxplot(germination) #factorial anova library(daewr) testforanova (insert angled bracket here)- aov( lm(germination ~ primingagent*concentration, data = anuj )) summary(testforanova) #means factor wise model.tables( testforanova, type = "means", se = T ) #Duncan test (Ranking the treatments means) require(agricolae) attach(anuj) anuj comparison (insert angled bracket here)- with (anuj,duncan.test(germination,concentration,9,5.2)) comparison #interaction between factors plot with(anuj, (interaction.plot(primingagent, concentration, germination, type = "b", pch = c(18,24,22), leg.bty = "o",col = "blue", main = "Interaction Plot of concentration and primingagent", xlab = "Priming agents",ylab = "Germination %"))) with(anuj, (interaction.plot(concentration, primingagent, germination, type = "b", pch = c(18,24,22), leg.bty = "o",col = "blue", main = "Interaction Plot of concentration and primingagent", xlab = "Concentration (ppm)",ylab = "Germination %")))

Category

Show more

Comments - 4