library(tidyverse)
<- "https://raw.githubusercontent.com/jlacasa/stat705_fall2024/main/classes/data/lotus_part2.csv"
url <- read.csv(url)
dd
%>%
dd filter(species %in% c("A")) %>%
ggplot(aes(doy, crown_g))+
geom_point(aes(fill = trt), shape = 21, size =3.5)+
scale_fill_manual(values = c("#DB504A", "#43AA8B"))+
labs(x = "Day of the Year",
y = "Crown biomass (g)",
fill = "Treatment")+
theme_classic()+
theme(aspect.ratio = 1)
Day 12 - 09/16/2024
From last class
- Comments about the projects.
- Different options for statistical notation.
Modeling
- Clover data
- Remember the data from Assignment 1?
str(dd)
'data.frame': 84 obs. of 13 variables:
$ species : chr "A" "A" "A" "A" ...
$ trt : chr "ctrl" "ctrl" "ctrl" "ctrl" ...
$ doy : int 155 155 155 155 155 155 155 155 155 155 ...
$ stm.length_cm: num 31.6 30.7 25.2 20.8 27.1 ...
$ flowers_g : num 0 0 0 0 0 0 0 0 0 0 ...
$ gr.leaves_g : num 0.442 0.364 0.337 0.196 0.324 ...
$ dead.leaves_g: num 0 0 0 0 0 0 0 0 0 0 ...
$ stm_g : num 0.666 0.605 0.587 0.222 0.45 ...
$ crown_g : num 0.0935 0.1625 0.1145 0.0472 0.0959 ...
$ agb_g : num 1.108 0.968 0.924 0.417 0.774 ...
$ main.roots_g : num 0.256 0.269 0.258 0.182 0.273 ...
$ adv.roots_g : num 0 0 0 0 0 0 0 0 0 0 ...
$ moment : chr "pre-flooding" "pre-flooding" "pre-flooding" "pre-flooding" ...
Possible models?
<- lm(crown_g ~ trt + doy, data = dd)
m summary(m)
Call:
lm(formula = crown_g ~ trt + doy, data = dd)
Residuals:
Min 1Q Median 3Q Max
-0.40020 -0.13449 -0.00894 0.09488 0.78319
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.359492 0.137887 -9.859 1.6e-15 ***
trtflood -0.030954 0.043359 -0.714 0.477
doy 0.009197 0.000692 13.291 < 2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1967 on 81 degrees of freedom
Multiple R-squared: 0.6861, Adjusted R-squared: 0.6784
F-statistic: 88.53 on 2 and 81 DF, p-value: < 2.2e-16
<- lm(crown_g ~ trt * doy, data = dd)
m summary(m)
Call:
lm(formula = crown_g ~ trt * doy, data = dd)
Residuals:
Min 1Q Median 3Q Max
-0.35287 -0.13701 -0.01415 0.09433 0.73550
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) -1.5809069 0.1908532 -8.283 2.25e-12 ***
trtflood 0.4123418 0.2706453 1.524 0.132
doy 0.0103322 0.0009681 10.673 < 2e-16 ***
trtflood:doy -0.0022714 0.0013692 -1.659 0.101
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 0.1946 on 80 degrees of freedom
Multiple R-squared: 0.6966, Adjusted R-squared: 0.6852
F-statistic: 61.21 on 3 and 80 DF, p-value: < 2.2e-16