Add HW4 and HW5
This commit is contained in:
127
HW5.Rmd
Normal file
127
HW5.Rmd
Normal file
@@ -0,0 +1,127 @@
|
||||
---
|
||||
title: "Assignment 3"
|
||||
subtitle: "STAT3373"
|
||||
author: "Isaac Shoebottom"
|
||||
date: "Oct 16th, 2025"
|
||||
output:
|
||||
pdf_document: default
|
||||
html_document:
|
||||
df_print: paged
|
||||
---
|
||||
|
||||
```{r message=FALSE, warning=FALSE}
|
||||
library(tidyverse)
|
||||
```
|
||||
|
||||
# Question 1
|
||||
|
||||
## a)
|
||||
|
||||
```{r}
|
||||
latin_data <- tribble(
|
||||
~sunlight, ~soil, ~treatment, ~growth,
|
||||
"Sunny", "Sandy", "C", 45,
|
||||
"Sunny", "Loamy", "A", 52,
|
||||
"Sunny", "Clay", "B", 48,
|
||||
"Sunny", "Sandy", "B", 43,
|
||||
"Sunny", "Loamy", "C", 50,
|
||||
"Sunny", "Clay", "A", 49,
|
||||
"Sunny", "Sandy", "A", 47,
|
||||
"Sunny", "Loamy", "B", 51,
|
||||
"Sunny", "Clay", "C", 46,
|
||||
|
||||
"Partial Sun", "Sandy", "A", 41,
|
||||
"Partial Sun", "Loamy", "B", 44,
|
||||
"Partial Sun", "Clay", "C", 38,
|
||||
"Partial Sun", "Sandy", "B", 39,
|
||||
"Partial Sun", "Loamy", "C", 42,
|
||||
"Partial Sun", "Clay", "A", 40,
|
||||
"Partial Sun", "Sandy", "C", 40,
|
||||
"Partial Sun", "Loamy", "A", 43,
|
||||
"Partial Sun", "Clay", "B", 41,
|
||||
|
||||
"Shade", "Sandy", "B", 32,
|
||||
"Shade", "Loamy", "C", 35,
|
||||
"Shade", "Clay", "A", 33,
|
||||
"Shade", "Sandy", "C", 31,
|
||||
"Shade", "Loamy", "A", 36,
|
||||
"Shade", "Clay", "B", 34,
|
||||
"Shade", "Sandy", "A", 30,
|
||||
"Shade", "Loamy", "B", 33,
|
||||
"Shade", "Clay", "C", 32
|
||||
)
|
||||
|
||||
latin_data
|
||||
```
|
||||
|
||||
## b)
|
||||
|
||||
|
||||
```{r}
|
||||
treatment_means <- latin_data %>%
|
||||
group_by(treatment) %>%
|
||||
summarise(mean_growth = mean(growth))
|
||||
|
||||
treatment_means
|
||||
```
|
||||
|
||||
## c)
|
||||
|
||||
Mean Growth by Sunlight Level
|
||||
```{r}
|
||||
sunlight_means <- latin_data %>%
|
||||
group_by(sunlight) %>%
|
||||
summarise(mean_growth = mean(growth))
|
||||
|
||||
sunlight_means
|
||||
```
|
||||
|
||||
Mean Growth by Soil Type
|
||||
```{r}
|
||||
soil_means <- latin_data %>%
|
||||
group_by(soil) %>%
|
||||
summarise(mean_growth = mean(growth))
|
||||
|
||||
soil_means
|
||||
```
|
||||
|
||||
## d)
|
||||
|
||||
From the descriptive statistics:
|
||||
|
||||
Sunlight effects: Growth is highest under Sunny, moderate under Partial Sun, and lowest under Shade. This suggests sunlight has a strong positive effect on growth.
|
||||
|
||||
Soil effects: Loamy soil consistently produces higher growth than Sandy or Clay, indicating soil type is an important blocking factor.
|
||||
|
||||
Treatment effects: If the treatment means differ noticeably:
|
||||
|
||||
- The watering schedule with the highest mean appears most effective.
|
||||
|
||||
- Smaller differences suggest weaker treatment effects relative to blocking factors.
|
||||
|
||||
- Because the Latin square controls for sunlight and soil, observed treatment differences are less confounded.
|
||||
|
||||
## e)
|
||||
A Latin square ANOVA partitions variation into:
|
||||
|
||||
- Sunlight (row effect)
|
||||
|
||||
- Soil type (column effect)
|
||||
|
||||
- Treatment effect
|
||||
|
||||
- Error
|
||||
|
||||
Expected Findings:
|
||||
|
||||
- Sunlight effect: Likely highly significant, given the strong gradient from Sunny to Shade.
|
||||
|
||||
- Soil effect: Likely significant, especially if Loamy soil dominates.
|
||||
|
||||
- Treatment effect:
|
||||
|
||||
- Possibly significant if Daily watering shows consistently higher growth.
|
||||
|
||||
- Could be marginal if differences among watering schedules are small compared to sunlight and soil.
|
||||
|
||||
- Error variance: Expected to be relatively small due to strong blocking.
|
||||
Reference in New Issue
Block a user