Practical Task 8

{r} # libraries library(tidyr) library(dplyr) library(effects) library(ggplot2) library(readr)

data

mustard <- read_csv(“c:/users/dell/downloads/Mustard.csv”)

{r} # summary summary(Mustard)

EDA

growth medium

ggplot(Mustard, aes(x = medium, y = weight)) + geom_boxplot() + labs(title = “Impact of Growth Medium on Mustard Yield”, x = “Growth Medium”, y = “Yield (grams)”)

The boxplot illustrates notable variations in mustard yield across diverse growth media. Specifically, soil and cotton wool exhibit elevated median yields in contrast to newspaper and sawdust. Outlying data points highlight distinctive responses associated with particular growth media, underscoring the substantial influence of the chosen medium on mustard yield.

frequency of watering

ggplot(Mustard, aes(x = watering, y = weight)) + geom_boxplot() + labs(title = “Impact of Watering Frequency on Mustard Yield”, x = “Watering Frequency”, y = “Yield (grams)”)

The boxplot demonstrates a distinct connection between the frequency of watering and the yield of mustard. As the watering frequency escalates from 1 to 5 times within a span of 14 days, a discernible pattern of increased median yields becomes evident. The presence of outliers indicates variations in plant responses to diverse watering schedules, underscoring the significance of frequency in impacting mustard yield.

type of light

ggplot(Mustard, aes(x = light, y = weight)) + geom_boxplot() + labs(title = “Impact of Light Type on Mustard Yield”, x = “Light Type”, y = “Yield (grams)”)

The boxplot suggests possible fluctuations in mustard crop output based on various light conditions. Although there are discernible distinctions, the overall influence of light type seems less conspicuous when contrasted with other variables. Outliers imply that particular mustard plants demonstrate distinct reactions to certain light conditions, but additional scrutiny is required to validate the significance of these variations.

ANOVA TEST

For Growth Medium

{r, echo=FALSE} # ANOVA for Growth Medium anova_growth_medium <- aov(weight ~ medium, data = Mustard) summary(anova_growth_medium)

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

{r, echo=FALSE} # ANOVA for Watering Frequency anova_watering <- aov(weight ~ watering, data = Mustard) summary(anova_watering)

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

{r, echo=FALSE} # ANOVA for Light Type anova_light <- aov(weight ~ light, data = Mustard) summary(anova_light)

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.

{r, echo=FALSE} # Extracting p-value from ANOVA summary p_value <- anova(anova_growth_medium)[[“Pr(>F)”]][1]