Packages

library(psych)
library(dplyr)
library(ggplot2)

Read Data

df <- read.csv("trial_data.csv")

Select the specific columns

df1 <- df %>% 
 select(Rep, Block, Plot, Entry, Plant.Height, Ear.Heigth) %>% 
 mutate(Rep = as.factor(Rep), Block = as.factor(Block),
        Plot = as.factor(Plot), Entry = as.factor(Entry))

Summary Statistics

Numeric Variables

descriptive <- df1 %>% 
 select_if(is.numeric) %>% describe 
knitr::kable(apply(descriptive, 2, round, 2))
vars n mean sd median trimmed mad min max range skew kurtosis se
Plant.Height 1 88 198.59 25.11 198 199.03 23.72 122 258 136 -0.25 0.50 2.68
Ear.Heigth 2 88 107.91 19.19 104 106.50 14.83 76 168 92 0.84 0.97 2.05
plot(df1$Plant.Height, col = "blue", pch = 20)

ggplot(df1, aes(x = Ear.Heigth, y = Plant.Height ))+
 geom_point(color = "blue") +
 geom_smooth(se = FALSE, aes(color = Rep))

ggplot(df1, aes(x = Plant.Height))+
 geom_histogram()#+

 #geom_smooth()
ggplot(df1, aes(x = Ear.Heigth))+
 geom_histogram()

par(mfrow = c(1,2))
qqnorm(df1$Plant.Height)
qqnorm(df1$Ear.Heigth)

df1 %>% 
 group_by(Block) %>% 
 summarise(Average = mean(Plant.Height)) %>% 
 arrange(desc(Average)) %>% 
 ggplot(aes(x = Block,y = Average, fill = Block))+
 geom_bar(stat = "identity", show.legend = F)+
 coord_flip()+
 labs(title = "Average Plant Height per Block")

df1 %>% 
 group_by(Block) %>% 
 summarise(Average = mean(Ear.Heigth)) %>% 
 arrange(desc(Average)) %>% 
 ggplot(aes(x = Block,y = Average, fill = Block))+
 geom_bar(stat = "identity", show.legend = F)+
 coord_flip()+
 labs(title = "Average Ear Height per Block")

Inferential Statistics

Plant Height

Hypothesis

\(H_o:\) Blocking Was not Necessary
\(H_1:\) Blocking Was Necessary

model <- aov(Plant.Height ~ Block, data = df1)
summary(model)
##             Df Sum Sq Mean Sq F value  Pr(>F)   
## Block       21  22953  1093.0   2.262 0.00634 **
## Residuals   66  31896   483.3                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

The calculated p-value is less than 0.05. We reject the null hypothesis. At 95% level of significance and putting into consideration other factors, blocking was necessary.

Ear Height

Hypothesis

\(H_o:\) Blocking Was not Necessary
\(H_1:\) Blocking Was Necessary

kruskal.test(Ear.Heigth ~ Block, data = df1)
## 
##  Kruskal-Wallis rank sum test
## 
## data:  Ear.Heigth by Block
## Kruskal-Wallis chi-squared = 36.803, df = 21, p-value = 0.01773

The calculated p-value is less than 0.05. We reject the null hypothesis. At 95% level of significance and putting into consideration other factors, blocking was necessary.