Saturday, 5 March 2016

Effect of Pests on Sugar Cane Yield using ANOVA with R

Today, I used R to evaluate the variation in sugar cane weight caused by different pests. The goal was to understand the fundamentals of ANOVA (Analysis of Variation ) and how to interpret the results.
Sugar cane data came from a 1934 study published in the Indian Journal of Statistics. Pests were measured to have a statistically significant impact on sugar cane yield. A Post hoc Tukey test showed that, between the different types of pests, there were no significant differences. 

Comparison of Sugar Cane Samples 
The boxplot was the best option to graphically represent the data. The difference in mean between the control and the remaining samples strongly suggests that the pests had a significant effect on the yeild. An ANOVA on these results found a significant variation among conditions, F ratio > 1, P-value < 0.05.

Analysis of Variation Results 

At a confidence coefficient of 0.95, or 95%, a post hoc Tukey test showed that the sugar yield did not change significantly depending on the type of pests. The Tukey test supported observations from the boxplot, showing that only the control group was significantly different from the remaining groups. In simpler terms, I cannot be 95% sure there is a difference in yeild between various types of pests.

Tukey Test Results

The coding is as follows:

#Variation in Sugar Yeild from Pests
#By Matthew Mano (matthewm3109@gmail.com)

#Import dataset 
sugar<-read.csv("sugar.csv")
#Rename variables and remove unnecessary ones 
sugar$X1[sugar$X1==1]="Control"
sugar$X1[sugar$X1==2]="TopShoot Borer"
sugar$X1[sugar$X1==3]="Stem Borer"
sugar$X1[sugar$X1==5]="Root Borer"
sugar$X1[sugar$X1==6]="Termites"
sugar<-sugar[!((sugar$X1==7)|(sugar$X1==8)|(sugar$X1==4)|(sugar$X1==9)|(sugar$X1==10)|(sugar$X1==11)),]
#Create a Boxplot 
boxplot(X64.5~X1,data=sugar,main="Influence of Pests on Sugar Cane Yield",xlab="Pests",ylab="Sugar Cane Weight (lb)",col="gray88")
#Analysis of Variation 
sugarc<-aov(X64.5 ~ X1, data = sugar
summary(sugarc)
#TukeyHSD
TukeyHSD(sugarc)

The link for the dataset is attached: http://bit.ly/1LELKm1



P. C. Mahalanobis and S. S. Bose, “A Statistical Note on the Effect of Pests on the Yield of Sugarcane and the Quality of Cane-Juice,” The Indian Journal of Statistics, vol. 1, no. 4, pp. 399–406, 1934.