Looking at the relationship between percent reproducitve apices and reproducitve dry weight.

Seems interesting as a possible field technique where you could estimate percent reproductive dry weight by counting reproductive apices in the field without collecting them.

Setting up

alldata<-read.csv(
      "https://raw.githubusercontent.com/Cmwegener/thesis/master/data/field/CB_field_data_plus.csv",
    header = TRUE
  )

alldata$Date<-as.Date(alldata$date, format = c("%m/%d/%Y"))

Subset data by site

HS<-subset(alldata, site.old == "HS")
BY<-subset(alldata, site.old == "BY")
ND<-subset(alldata, site.old == "ND")
PC<-subset(alldata, site.old == "PC")

Graph

a <-
  ggplot(data = HS, mapping = aes(x = perc.ra, y = perc.rdw)) + geom_point() + stat_smooth(method =
                                                                                         lm) + ggtitle("Horseshoe Bay") + theme(plot.title = element_text(size = 12, face = "plain")) +
  theme(axis.text = element_text(size = 12),
        axis.title = element_text(size = 12, face = "plain")) + ylab(" ") + xlab(" ") + theme(
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.background = element_blank(),
          axis.line = element_line(colour = "black")
        )
b <-
  ggplot(data = BY, mapping = aes(x = perc.ra, y = perc.rdw)) + geom_point() + stat_smooth(method =
                                                                                         lm) + ggtitle("Brickyard Park") + theme(plot.title = element_text(size = 12, face = "plain")) +
  theme(axis.text = element_text(size = 12),
        axis.title = element_text(size = 12, face = "plain")) + ylab(" ") + xlab(" ") + theme(
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.background = element_blank(),
          axis.line = element_line(colour = "black")
        )
c <-
  ggplot(data = ND, mapping = aes(x = perc.ra, y = perc.rdw)) + geom_point() + stat_smooth(method =
                                                                                         lm) + ggtitle("Point Chauncy") + theme(plot.title = element_text(size = 12, face = "plain")) +
  theme(axis.text = element_text(size = 12),
        axis.title = element_text(size = 12, face = "plain")) + ylab(" ") + xlab(" ") + theme(
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.background = element_blank(),
          axis.line = element_line(colour = "black")
        )
d <-
  ggplot(data = PC, mapping = aes(x = perc.ra, y = perc.rdw)) + geom_point() +
  stat_smooth(method = lm) + ggtitle("Paradise Cay") + theme(plot.title = element_text(size = 12, face = "plain")) +
  theme(axis.text = element_text(size = 12),
        axis.title = element_text(size = 12, face = "plain")) + ylab(" ") + xlab(" ") + theme(
          panel.grid.major = element_blank(),
          panel.grid.minor = element_blank(),
          panel.background = element_blank(),
          axis.line = element_line(colour = "black")
        )

fig<-ggarrange(d, c, b, a, ncol = 4, nrow = 1)
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 39 rows containing non-finite values (stat_smooth).
## Warning: Removed 39 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 27 rows containing non-finite values (stat_smooth).
## Warning: Removed 27 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 14 rows containing non-finite values (stat_smooth).
## Warning: Removed 14 rows containing missing values (geom_point).
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 18 rows containing non-finite values (stat_smooth).
## Warning: Removed 18 rows containing missing values (geom_point).
annotate_figure(fig,
                top = text_grob("Percent Reproductive Apices vs Percent Reproductive Dry weight", color = "black", face = "plain", size = 14), left = text_grob("Percent Reproductive Dry Weight", color = "black", rot = 90, size=12), bottom = text_grob("Percent Reproductive Apcies", color = "black", rot = 0, size=12))

I’m not sure if separating them by site is necessary so I’m going to look at all of them together Linear equation

lm_eqn <- function(alldata) {
  m <- lm(perc.ra ~ perc.rdw, alldata)
  
  eq <-
    substitute(
      italic(percent_reproductive_dry_weight) == a + b %.% italic(percent_reproductive_apices) * "," ~  ~ italic(r) ^
        2 ~ "=" ~ r2,
      list(
        a = format(unname(coef(m)[1]), digits = 2),
        b = format(unname(coef(m)[2]), digits = 2),
        r2 = format(summary(m)$r.squared, digits = 3)
      )
    )
  as.character(as.expression(eq))
  
}

Graph with linear equation

alldata %>% ggplot(aes(x = perc.ra, y = perc.rdw)) +
  ylim(0,100)+
  ylab("Percent reproductive apices")+
  xlab("Percent reproductive dry weight")+
  geom_point(alpha = 0.5) +
  geom_smooth(method = lm) +
  geom_text(
    x = 50,
    y = 95,
    label = lm_eqn(alldata),
    parse = TRUE) 
## `geom_smooth()` using formula 'y ~ x'
## Warning: Removed 98 rows containing non-finite values (stat_smooth).
## Warning: Removed 98 rows containing missing values (geom_point).

Double check those points at 100% ra