Set up

read in relevant files

I took the dfs Diana sent me and read them in here.

remove dead and lost

We only had 66 removed. This seems a bit high to me and I wonder if the scallops that were removed weren’t marked in coloration? or if something else strange happened. But rolling with this for now. From Diana there should be 66 deaths across these groups.

## [1] 462  15
## [1] 396  15
## [1] 35

look at data

## `geom_smooth()` using formula = 'y ~ x'

strange specimens

based on our conversation with Brittany, it seems safe to assume that measurements where growth is below 0 are mostly a reflection of sampling error and not actual loss in shell max height over the experiment. There I would like to make the assumption that any - values here are really a reflection of 0 growth. In some sense we are flooring percent change in height to 0. At this point all specimens marked as dead or lost have been removed so this shouldn’t effect those and all other specimens with missing data are NA for change in height so they wont be included in this either.

Another approach to this would be to add the value of the most negative number to the whole column so that the lowest % change is 0 % change, but this makes less sense to me in the context of this data set.

height.all.w.negatives<-height.all
height.all$`percentage change height` <- replace(height.all$`percentage change height`, which(height.all$`percentage change height` < 0), 0)

height.all$prop.change.height<-height.all$`percentage change height`/100
height.all %>% 
  ggplot(aes(prop.change.height, group = species, fill=species)) +
    geom_boxplot()
## Warning: Removed 35 rows containing non-finite values (`stat_boxplot()`).

height.all %>% 
  ggplot(aes(x=temp.average, y=prop.change.height,color = species, fill=species)) +
    geom_point()+
    geom_smooth(method = loess) #sweet no longer any below 0 
## `geom_smooth()` using formula = 'y ~ x'
## Warning: Removed 35 rows containing non-finite values (`stat_smooth()`).
## Warning: Removed 35 rows containing missing values (`geom_point()`).

add a pH where minimum pH is 0 (to avoid weird intercepts later on)

Not totally sure if this is necessary for temperature too - did not do it here.

## [1] 7.39

Individual Species Groups

mercenaria

check structure

Non normal, majorly skewed many at 0

## 'data.frame':    115 obs. of  17 variables:
##  $ tank                    : Factor w/ 16 levels "H1","H10","H11",..: 1 1 1 1 1 1 1 1 1 2 ...
##  $ Sample_ID_20220415      : chr  "b47" "b39" "b38" "b43" ...
##  $ Max_heigh_mm            : num  11.4 11.4 12.4 11.9 10.2 ...
##  $ Max_height_mm           : num  17.4 17.2 18.3 17.2 15 ...
##  $ percentage change height: num  53.6 49.9 47.5 44.7 46 ...
##  $ ph                      : Factor w/ 4 levels "7.4","7.6","7.8",..: 2 2 2 2 2 2 2 2 2 4 ...
##  $ temp                    : Factor w/ 3 levels "6","9","12": 3 3 3 3 3 3 3 3 3 2 ...
##  $ died                    : chr  NA NA NA NA ...
##  $ species                 : chr  "mercenaria" "mercenaria" "mercenaria" "mercenaria" ...
##  $ temp.average            : num  12.1 12.1 12.1 12.1 12.1 ...
##  $ temp.stdev              : num  0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.63 ...
##  $ pH.average.YSI          : num  7.57 7.57 7.57 7.57 7.57 7.57 7.57 7.57 7.57 8 ...
##  $ pH.stdev.YSI            : num  0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.07 ...
##  $ pH.average              : num  7.59 7.59 7.59 7.59 7.59 7.59 7.59 7.59 7.59 8 ...
##  $ pH.stdev                : num  0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.05 ...
##  $ prop.change.height      : num  0.536 0.499 0.475 0.447 0.46 ...
##  $ pH.normalized           : num  0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.61 ...

## 
##  Shapiro-Wilk normality test
## 
## data:  mercenaria$prop.change.height
## W = 0.85068, p-value = 2.09e-09
##    vars   n mean  sd median trimmed  mad min  max range skew kurtosis   se
## X1    1 115 0.18 0.2   0.13    0.16 0.19   0 0.71  0.71 0.97    -0.08 0.02
## [1] 0
## [1] 115  17

linear model

‘normal’ linear mixed effect model

first we will try this and see how it looks as per Brittany’s suggestion. This will not specify a family, most similar to what I did way back when with CCA.

best fit includes temp, observed vs expected is off QQ line, residual vs predicted is wacky. We can see if other models look better or worse.

height.1 <- lmer(prop.change.height~temp.average*pH.normalized+(1|tank), data = mercenaria, na.action = na.fail)

simulationOutput1<-simulateResiduals(height.1)

dd1<-dredge(height.1, rank=AIC)
## Warning in dredge(height.1, rank = AIC): comparing models fitted by REML
## Fixed term is "(Intercept)"
dd1
## Global model call: lmer(formula = prop.change.height ~ temp.average * pH.normalized + 
##     (1 | tank), data = mercenaria, na.action = na.fail)
## ---
## Model selection table 
##     (Int)   pH.nrm tmp.avr pH.nrm:tmp.avr df  logLik    AIC delta weight
## 3 -0.5860          0.08597                 4 123.013 -238.0  0.00  0.909
## 4 -0.6048  0.04371 0.08646                 5 121.657 -233.3  4.71  0.086
## 8 -0.5182 -0.22050 0.07669         0.0302  6 119.730 -227.5 10.56  0.005
## 1  0.1918                                  3 113.432 -220.9 17.16  0.000
## 2  0.2023 -0.03208                         4 112.839 -217.7 20.35  0.000
## Models ranked by AIC(x) 
## Random terms (all models): 
##   1 | tank
top_model1<-get.models(dd1, subset = 1)[[1]]
top_model1
## Linear mixed model fit by REML ['lmerMod']
## Formula: prop.change.height ~ temp.average + (1 | tank)
##    Data: mercenaria
## REML criterion at convergence: -246.0258
## Random effects:
##  Groups   Name        Std.Dev.
##  tank     (Intercept) 0.07756 
##  Residual             0.06728 
## Number of obs: 115, groups:  tank, 16
## Fixed Effects:
##  (Intercept)  temp.average  
##     -0.58596       0.08597
simulationOutput.top<-simulateResiduals(top_model1)
plot(simulationOutput.top)
## qu = 0.75, log(sigma) = -2.835707 : outer Newton did not converge fully.

#plot(top_model1)
tab_model(top_model1) 
  prop.change.height
Predictors Estimates CI p
(Intercept) -0.59 -0.77 – -0.40 <0.001
temp average 0.09 0.07 – 0.11 <0.001
Random Effects
σ2 0.00
τ00 tank 0.01
ICC 0.57
N tank 16
Observations 115
Marginal R2 / Conditional R2 0.750 / 0.893
testZeroInflation(top_model1)

## 
##  DHARMa zero-inflation test via comparison to expected zeros with
##  simulation under H0 = fitted model
## 
## data:  simulationOutput
## ratioObsSim = Inf, p-value < 2.2e-16
## alternative hypothesis: two.sided
plotResiduals(top_model1, mercenaria$ph)

plotResiduals(top_model1, mercenaria$temp)

plot_model(top_model1, 
                   axis.labels=c("Temp"),
                   show.values=TRUE, show.p=TRUE,
                   title="Effect of Temp on Mercenaria Growth")+
  theme_classic()

tab_model(top_model1, 
                  show.re.var= TRUE, 
                  pred.labels =c("(Intercept)", "Temp"),
                  dv.labels= "Effect of Temp on Mercenaria Growth")
  Effect of Temp on Mercenaria Growth
Predictors Estimates CI p
(Intercept) -0.59 -0.77 – -0.40 <0.001
Temp 0.09 0.07 – 0.11 <0.001
Random Effects
σ2 0.00
τ00 tank 0.01
ICC 0.57
N tank 16
Observations 115
Marginal R2 / Conditional R2 0.750 / 0.893
formal plot

i dont think we want three lines here because we only have one predictor? might need to think through this a bit more. cant make a plot with both since pH isnt in model.

effect_top_model.temp<-effects::effect(term="temp.average", mod=top_model1)
effect_top_model.temp<-as.data.frame(effect_top_model.temp)

effect_temp <- ggplot() + 
  #geom_point(data=effect_top_model.ph, aes(x=temp.average, y=fit), color="black") +
  geom_line(data=effect_top_model.temp, aes(x=temp.average, y=fit), color="black") +
  geom_ribbon(data= effect_top_model.temp, aes(x=temp.average, ymin=lower, ymax=upper), alpha= 0.3, fill="gray") +
  geom_point(data=mercenaria, mapping = aes(x=temp.average, y=prop.change.height, color=pH.average), size=3) +
  labs(x="Average Temperature (C)", y="Proportional Change in Height", color = "Average pH")+
  theme_classic()+
  scale_color_viridis(direction = -1, option = "cividis")
effect_temp

#mercenaria.model.plot<-ggarrange(effect_temp,
             # labels = c("A"),
              #ncol = 1, nrow = 1)
ggsave("02_output/02_plots/height_mercenaria_linear.png", effect_temp, width = 5, height = 4, dpi = 300)

effect_temp_swap <- ggplot() + 
  #geom_point(data=effect_top_model.ph, aes(x=temp.average, y=fit), color="black") +
  #geom_line(data=effect_top_model.temp, aes(x=temp.average, y=fit), color="black") +
 # geom_ribbon(data= effect_top_model.temp, aes(x=temp.average, ymin=lower, ymax=upper), alpha= 0.3, fill="gray") +
  geom_point(data=mercenaria, mapping = aes(x=pH.average, y=prop.change.height, color=temp.average), size=3) +
  labs(x="Average pH", y="Proportional Change in Height", color = "Average Temperature (C)")+
  theme_classic()+
  scale_color_viridis( option = "plasma")
effect_temp_swap

mercenaria.model.plot<-ggarrange(effect_temp,effect_temp_swap,
             labels = c("A", "B"),
              ncol = 2, nrow = 1)
ggsave("02_output/02_plots/height_mercenaria_linear_both_swap.png", mercenaria.model.plot, width = 14, height = 4, dpi = 300)

mya

check structure

This distribution looks pretty normal.

## 'data.frame':    150 obs. of  17 variables:
##  $ tank                    : Factor w/ 16 levels "H1","H10","H11",..: 1 1 1 1 1 1 1 1 1 2 ...
##  $ Sample_ID_20220415      : chr  "r39" "r40" "r37" "r38" ...
##  $ Max_heigh_mm            : num  13.8 16.5 17.1 13.8 14.3 ...
##  $ Max_height_mm           : num  19.9 21.6 22.2 15.6 15 ...
##  $ percentage change height: num  44.62 31.04 30.25 12.68 4.76 ...
##  $ ph                      : Factor w/ 4 levels "7.4","7.6","7.8",..: 2 2 2 2 2 2 2 2 2 4 ...
##  $ temp                    : Factor w/ 3 levels "6","9","12": 3 3 3 3 3 3 3 3 3 2 ...
##  $ died                    : chr  NA NA NA NA ...
##  $ species                 : chr  "mya" "mya" "mya" "mya" ...
##  $ temp.average            : num  12.1 12.1 12.1 12.1 12.1 ...
##  $ temp.stdev              : num  0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.42 0.63 ...
##  $ pH.average.YSI          : num  7.57 7.57 7.57 7.57 7.57 7.57 7.57 7.57 7.57 8 ...
##  $ pH.stdev.YSI            : num  0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.04 0.07 ...
##  $ pH.average              : num  7.59 7.59 7.59 7.59 7.59 7.59 7.59 7.59 7.59 8 ...
##  $ pH.stdev                : num  0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.07 0.05 ...
##  $ prop.change.height      : num  0.4462 0.3104 0.3025 0.1268 0.0476 ...
##  $ pH.normalized           : num  0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.2 0.61 ...

## 
##  Shapiro-Wilk normality test
## 
## data:  mya$prop.change.height
## W = 0.98778, p-value = 0.2124
##    vars   n mean   sd median trimmed  mad min  max range skew kurtosis   se
## X1    1 150 0.25 0.12   0.26    0.25 0.14   0 0.54  0.54 0.01    -0.66 0.01

linear model

‘normal’ linear mixed effect model

first we will try this and see how it looks as per Brittany’s suggestion. This will not specify a family, most similar to what I did way back when with CCA.

best fit includes none, which seems to make sense based on visual inspection of the data. residuals etc look pretty good but I will try a couple other families. I assume this will be best.

height.1 <- lmer(prop.change.height~temp.average*pH.normalized+(1|tank), data = mya, na.action = na.fail)

simulationOutput1<-simulateResiduals(height.1)

dd1<-dredge(height.1, rank=AIC)
## Warning in dredge(height.1, rank = AIC): comparing models fitted by REML
## Fixed term is "(Intercept)"
dd1
## Global model call: lmer(formula = prop.change.height ~ temp.average * pH.normalized + 
##     (1 | tank), data = mya, na.action = na.fail)
## ---
## Model selection table 
##     (Int)   pH.nrm tmp.avr pH.nrm:tmp.avr df  logLik    AIC delta weight
## 1 0.25580                                  3 104.546 -203.1  0.00  0.574
## 3 0.06027          0.02171                 4 105.076 -202.2  0.94  0.359
## 2 0.27070 -0.04520                         4 103.025 -198.0  5.04  0.046
## 4 0.07204 -0.02659 0.02137                 5 103.197 -196.4  6.70  0.020
## 8 0.06910 -0.01642 0.02171      -0.001191  6 100.568 -189.1 13.96  0.001
## Models ranked by AIC(x) 
## Random terms (all models): 
##   1 | tank
top_model1<-get.models(dd1, subset = 1)[[1]]
top_model1
## Linear mixed model fit by REML ['lmerMod']
## Formula: prop.change.height ~ (1 | tank)
##    Data: mya
## REML criterion at convergence: -209.0921
## Random effects:
##  Groups   Name        Std.Dev.
##  tank     (Intercept) 0.05255 
##  Residual             0.11148 
## Number of obs: 150, groups:  tank, 16
## Fixed Effects:
## (Intercept)  
##      0.2558
simulationOutput.top<-simulateResiduals(top_model1)
plot(simulationOutput.top)

#plot(top_model1)
tab_model(top_model1) 
  prop.change.height
Predictors Estimates CI p
(Intercept) 0.26 0.22 – 0.29 <0.001
Random Effects
σ2 0.01
τ00 tank 0.00
ICC 0.18
N tank 16
Observations 150
Marginal R2 / Conditional R2 0.000 / 0.182
testZeroInflation(top_model1)

## 
##  DHARMa zero-inflation test via comparison to expected zeros with
##  simulation under H0 = fitted model
## 
## data:  simulationOutput
## ratioObsSim = Inf, p-value < 2.2e-16
## alternative hypothesis: two.sided
plotResiduals(top_model1, mya$ph)

plotResiduals(top_model1, mya$temp)

#plot_model(top_model1, 
                  # axis.labels=c("Temp"),
                   #show.values=TRUE, show.p=TRUE,
                  # title="Effect of Temp on mya Growth")+
 # theme_classic()

tab_model(top_model1, 
                  show.re.var= TRUE, 
                  pred.labels =c("(Intercept)"),
                  dv.labels= "Effect of Temp on mya Growth")
  Effect of Temp on mya Growth
Predictors Estimates CI p
(Intercept) 0.26 0.22 – 0.29 <0.001
Random Effects
σ2 0.01
τ00 tank 0.00
ICC 0.18
N tank 16
Observations 150
Marginal R2 / Conditional R2 0.000 / 0.182
formal plot

i dont think we want three lines here because we only have one predictor? might need to think through this a bit more

#effect_top_model.temp<-effects::effect(term="temp.average", mod=top_model1)
#effect_top_model.temp<-as.data.frame(effect_top_model.temp)

effect_none <- ggplot() + 
  #geom_point(data=effect_top_model.ph, aes(x=temp.average, y=fit), color="black") +
  #geom_line(data=effect_top_model.temp, aes(x=temp.average, y=fit), color="black") +
  #geom_ribbon(data= effect_top_model.temp, aes(x=temp.average, ymin=lower, ymax=upper), alpha= 0.3, fill="gray") +
  geom_point(data=mya, mapping = aes(x=temp.average, y=prop.change.height, color=pH.average), size=3) +
  labs(x="Average Temperature (C)", y="Proportional Change in Height", color = "Average pH")+
  theme_classic()+
  scale_color_viridis(direction = -1, option = "cividis")
effect_none

#mya.model.plot<-ggarrange(effect_temp,
             # labels = c("A"),
              #ncol = 1, nrow = 1)
ggsave("02_output/02_plots/height_mya_none_linear.png", effect_none, width = 5, height = 4, dpi = 300)

effect_none_pH <- ggplot() + 
  #geom_point(data=effect_top_model.ph, aes(x=temp.average, y=fit), color="black") +
  #geom_line(data=effect_top_model.temp, aes(x=temp.average, y=fit), color="black") +
  #geom_ribbon(data= effect_top_model.temp, aes(x=temp.average, ymin=lower, ymax=upper), alpha= 0.3, fill="gray") +
  geom_point(data=mya, mapping = aes(x=pH.average, y=prop.change.height, color=temp.average), size=3) +
  labs(x="Average Temperature (C)", y="Proportional Change in Height", color = "Average Temperature (C)")+
  theme_classic()+
  scale_color_viridis(option = "plasma")
effect_none_pH

mya.model.plot<-ggarrange(effect_none_pH,effect_none,
             labels = c("A", "B"),
              ncol = 2, nrow = 1)
ggsave("02_output/02_plots/height_mya_linear_both_swap.png", mya.model.plot, width = 14, height = 4, dpi = 300)

juvenile arctica

check structure

This distribution looks pretty normal, although it looks like there is one outlier above 1 (g69). Could possibly make max growth = 1 but I think I will leave for now.

## 'data.frame':    66 obs. of  17 variables:
##  $ tank                    : Factor w/ 16 levels "H1","H10","H11",..: 1 1 1 1 2 2 2 2 3 3 ...
##  $ Sample_ID_20220415      : chr  "g32" "g29" "g30" "g31" ...
##  $ Max_heigh_mm            : num  15 13.3 14.2 16.2 14.4 ...
##  $ Max_height_mm           : num  27.7 25.5 23.9 28.7 23.3 ...
##  $ percentage change height: num  84.4 92.3 67.6 77.3 61.5 ...
##  $ ph                      : Factor w/ 4 levels "7.4","7.6","7.8",..: 2 2 2 2 4 4 4 4 4 4 ...
##  $ temp                    : Factor w/ 3 levels "6","9","12": 3 3 3 3 2 2 2 2 1 1 ...
##  $ died                    : chr  NA NA NA NA ...
##  $ species                 : chr  "juv.arctica" "juv.arctica" "juv.arctica" "juv.arctica" ...
##  $ temp.average            : num  12.06 12.06 12.06 12.06 9.19 ...
##  $ temp.stdev              : num  0.42 0.42 0.42 0.42 0.63 0.63 0.63 0.63 0.78 0.78 ...
##  $ pH.average.YSI          : num  7.57 7.57 7.57 7.57 8 8 8 8 8.02 8.02 ...
##  $ pH.stdev.YSI            : num  0.04 0.04 0.04 0.04 0.07 0.07 0.07 0.07 0.06 0.06 ...
##  $ pH.average              : num  7.59 7.59 7.59 7.59 8 8 8 8 8.05 8.05 ...
##  $ pH.stdev                : num  0.07 0.07 0.07 0.07 0.05 0.05 0.05 0.05 0.05 0.05 ...
##  $ prop.change.height      : num  0.844 0.923 0.676 0.773 0.615 ...
##  $ pH.normalized           : num  0.2 0.2 0.2 0.2 0.61 ...

## 
##  Shapiro-Wilk normality test
## 
## data:  juv.arctica$prop.change.height
## W = 0.96809, p-value = 0.1012
##    vars  n mean  sd median trimmed  mad  min  max range skew kurtosis   se
## X1    1 63 0.68 0.2   0.65    0.67 0.21 0.31 1.28  0.97 0.52    -0.25 0.03
## [1] 0
## [1] 4

linear model

‘normal’ linear mixed effect model

first we will try this and see how it looks as per Brittany’s suggestion. This will not specify a family, most similar to what I did way back when with CCA.

best fit includes temp, which seems to make sense based on visual inspection of the data & the biology of arctica. residuals etc look pretty good but I will try a couple other families. I assume this will be best.

height.1 <- lmer(prop.change.height~temp.average*pH.normalized+(1|tank), data = juv.arctica, na.action = na.fail)

simulationOutput1<-simulateResiduals(height.1)

dd1<-dredge(height.1, rank=AIC)
## Warning in dredge(height.1, rank = AIC): comparing models fitted by REML
## Fixed term is "(Intercept)"
dd1
## Global model call: lmer(formula = prop.change.height ~ temp.average * pH.normalized + 
##     (1 | tank), data = juv.arctica, na.action = na.fail)
## ---
## Model selection table 
##    (Int)    pH.nrm tmp.avr pH.nrm:tmp.avr df logLik   AIC delta weight
## 3 0.1139           0.06312                 4 20.757 -33.5  0.00  0.907
## 4 0.1168 -0.008728 0.06311                 5 19.328 -28.7  4.86  0.080
## 8 0.2720 -0.472700 0.04530        0.05378  6 17.829 -23.7  9.86  0.007
## 1 0.6843                                   3 14.719 -23.4 10.08  0.006
## 2 0.7163 -0.095120                         4 14.031 -20.1 13.45  0.001
## Models ranked by AIC(x) 
## Random terms (all models): 
##   1 | tank
top_model1<-get.models(dd1, subset = 1)[[1]]
top_model1
## Linear mixed model fit by REML ['lmerMod']
## Formula: prop.change.height ~ temp.average + (1 | tank)
##    Data: juv.arctica
## REML criterion at convergence: -41.5131
## Random effects:
##  Groups   Name        Std.Dev.
##  tank     (Intercept) 0.02806 
##  Residual             0.15696 
## Number of obs: 63, groups:  tank, 16
## Fixed Effects:
##  (Intercept)  temp.average  
##      0.11391       0.06312
simulationOutput.top<-simulateResiduals(top_model1)
plot(simulationOutput.top)

#plot(top_model1)
tab_model(top_model1) 
  prop.change.height
Predictors Estimates CI p
(Intercept) 0.11 -0.08 – 0.31 0.250
temp average 0.06 0.04 – 0.08 <0.001
Random Effects
σ2 0.02
τ00 tank 0.00
ICC 0.03
N tank 16
Observations 63
Marginal R2 / Conditional R2 0.383 / 0.402
testZeroInflation(top_model1)

## 
##  DHARMa zero-inflation test via comparison to expected zeros with
##  simulation under H0 = fitted model
## 
## data:  simulationOutput
## ratioObsSim = NaN, p-value = 1
## alternative hypothesis: two.sided
plotResiduals(top_model1, juv.arctica$ph)

plotResiduals(top_model1, juv.arctica$temp)

plot_model(top_model1, 
                   axis.labels=c("Temp"),
                   show.values=TRUE, show.p=TRUE,
                   title="Effect of Temp on Juvenile Arctica Growth")+
  theme_classic()

tab_model(top_model1, 
                  show.re.var= TRUE, 
                  pred.labels =c("(Intercept)", "Temp"),
                  dv.labels= "Effect of Temp on Juvenile Arctica Growth")
  Effect of Temp on Juvenile Arctica Growth
Predictors Estimates CI p
(Intercept) 0.11 -0.08 – 0.31 0.250
Temp 0.06 0.04 – 0.08 <0.001
Random Effects
σ2 0.02
τ00 tank 0.00
ICC 0.03
N tank 16
Observations 63
Marginal R2 / Conditional R2 0.383 / 0.402
formal plot

i dont think we want three lines here because we only have one predictor? might need to think through this a bit more

effect_top_model.temp<-effects::effect(term="temp.average", mod=top_model1)
effect_top_model.temp<-as.data.frame(effect_top_model.temp)

effect_temp <- ggplot() + 
  #geom_point(data=effect_top_model.ph, aes(x=temp.average, y=fit), color="black") +
  geom_line(data=effect_top_model.temp, aes(x=temp.average, y=fit), color="black") +
  geom_ribbon(data= effect_top_model.temp, aes(x=temp.average, ymin=lower, ymax=upper), alpha= 0.3, fill="gray") +
  geom_point(data=juv.arctica, mapping = aes(x=temp.average, y=prop.change.height, color=pH.average), size=3) +
  labs(x="Average Temperature (C)", y="Proportional Change in Height", color="Average pH")+
  theme_classic()+
  scale_color_viridis(direction = -1, option = "cividis")
effect_temp

#juv.arctica.model.plot<-ggarrange(effect_temp,
             # labels = c("A"),
              #ncol = 1, nrow = 1)
ggsave("02_output/02_plots/height_juv.arctica_temp_linear.png", effect_temp, width = 5, height = 4, dpi = 300)

effect_temp_swap <- ggplot() + 
  #geom_point(data=effect_top_model.ph, aes(x=temp.average, y=fit), color="black") +
  #geom_line(data=effect_top_model.temp, aes(x=temp.average, y=fit), color="black") +
  #geom_ribbon(data= effect_top_model.temp, aes(x=temp.average, ymin=lower, ymax=upper), alpha= 0.3, fill="gray") +
  geom_point(data=juv.arctica, mapping = aes(x=pH.average, y=prop.change.height, color=temp.average), size=3) +
  labs(x="Average pH", y="Proportional Change in Height", color="Average Temperature (C)")+
  theme_classic()+
  scale_color_viridis(option = "plasma")
effect_temp_swap

juv.arctica.model.plot<-ggarrange(effect_temp_swap,effect_temp,
             labels = c("A", "B"),
              ncol = 2, nrow = 1)
ggsave("02_output/02_plots/height_juv.arctica_linear_both_swap.png", juv.arctica.model.plot, width = 14, height = 4, dpi = 300)