Practical task 8

Preparing the data

# Loading necessary libraries
library(ggplot2)
library(tidyr)
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(effects)
## Loading required package: carData
## lattice theme set by effectsTheme()
## See ?effectsTheme for details.
# Loading the dataset
library(readr)
Mustard <- read_csv("~/Documents/DATA ANALYTICS/Mustard.csv")
## Rows: 108 Columns: 4
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (2): light, medium
## dbl (2): weight, watering
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.

Seeing the summary statistics

# Displaying summary statistics
summary(Mustard)
##      weight         light              watering    medium         
##  Min.   :0.060   Length:108         Min.   :1   Length:108        
##  1st Qu.:0.980   Class :character   1st Qu.:1   Class :character  
##  Median :1.780   Mode  :character   Median :3   Mode  :character  
##  Mean   :1.879                      Mean   :3                     
##  3rd Qu.:2.400                      3rd Qu.:5                     
##  Max.   :5.600                      Max.   :5                     
##  NA's   :3

Exploratory analysis

For Growth Medium

## Warning: Removed 3 rows containing non-finite values (`stat_boxplot()`).

The boxplot reveals significant differences in mustard yield among different growth media. Notably, soil and cotton wool show higher median yields compared to newspaper and sawdust. Outliers indicate unique responses to specific growth media, suggesting that the choice of medium has a substantial impact on mustard yield.

For Watering Frequency

## Warning: Continuous x aesthetic
## ℹ did you forget `aes(group = ...)`?
## Warning: Removed 3 rows containing non-finite values (`stat_boxplot()`).

The boxplot illustrates a clear association between watering frequency and mustard yield. As the frequency increases from 1 to 5 times over 14 days, there is a noticeable trend of higher median yields. Outliers suggest variations in plant responses to different watering schedules, emphasizing the importance of frequency in influencing mustard yield.

For Light Type

## Warning: Removed 3 rows containing non-finite values (`stat_boxplot()`).

The boxplot indicates potential variations in mustard yield under different types of light. While there might be some differences, the overall impact of light type appears less pronounced compared to other factors. Outliers suggest that certain mustard plants exhibit unique responses to specific light types, but further investigation is needed to confirm the significance of these differences.

ANOVA TEST

For Growth Medium

##              Df Sum Sq Mean Sq F value Pr(>F)    
## medium        3  85.48  28.494   41.16 <2e-16 ***
## Residuals   101  69.93   0.692                   
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 3 observations deleted due to missingness

The factor “medium” has a significant effect on mustard yield. The F value is 41.16, and the p-value (Pr(>F)) is extremely small (<2e-16), indicating that the differences in mustard yield among the growth mediums are unlikely due to random chance.

For Watering Frequency

##              Df Sum Sq Mean Sq F value   Pr(>F)    
## watering      1  38.76   38.76   34.22 5.87e-08 ***
## Residuals   103 116.66    1.13                     
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 3 observations deleted due to missingness

The factor “watering” has a significant effect on mustard yield. The F value is 34.22, and the p-value (Pr(>F)) is extremely small (5.87e-08), indicating that the differences in mustard yield due to watering frequency are unlikely due to random chance.

For Light Type

##              Df Sum Sq Mean Sq F value Pr(>F)  
## light         2   7.76   3.878   2.679 0.0735 .
## Residuals   102 147.66   1.448                 
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 3 observations deleted due to missingness

The factor “light” has a significant effect on mustard yield. The F value is 2.679, and the p-value (Pr(>F)) is 0.0735, which is below the commonly used significance level of 0.05. It suggests that the differences in mustard yield due to light type may be statistically significant.

General interpretation

In summary, all three factors (growth medium, watering frequency, and light type) significantly affect mustard yield. The p-values are very small for growth medium and watering frequency, indicating high significance, while the p-value for light type is below 0.05 but not extremely small.