OCN 683 - Homework 13

Sarah Pennington

The attached file contains data on each seedling in the experiment. The column definitions are as follows:

ID Seedling experimental identification number.

BLOCK Experimental block, due to variation in germination timing.

POPULATION Source of seeds, collected on Oahu Island.

DROUGHT Experimental water treatment: control (watered every other day to 100% field capacity) and drought (watered every other day to 80% field capacity).

FATE: Harvested after press drought treatment, or subjected to terminal drought with no water until the seedling died.

DEAD Binary mortality (1 = dead; 0 = alive).

HEIGHT Seedling height at harvest (cm).

SHOOT Dry shoot biomass at harvest (g).

ROOT: Dry root biomass at harvest (g).

LONGEVITY Number of days in terminal drought with no water before dying.

TERMINAL_GWC : Soil gravimetric water content (% field capacity) at the time of mortality in terminal drought.

MAR Historical mean annual rainfall at the site from which the seeds were collected(cm)

MET collected (mm) Historical mean annual evapotranspiration at the site from which the seeds were

All of these predictors could be important for species diversity on islands, and the point of the analysis is to figure out which ones actually have support, using a comparative approach. We will focus on island-level richness
ohia<- read_csv("ohia_merged.csv")
## Rows: 617 Columns: 13
## ── Column specification ────────────────────────────────────────────────────────
## Delimiter: ","
## chr (4): Population, Block, Drought, Fate
## dbl (9): ID, Dead, Height, Shoot, Root, Longevity, Terminal_GWC, MAR, MET
## 
## ℹ Use `spec()` to retrieve the full column specification for this data.
## ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
1. Using the seedlings that were harvested after the press drought treatment, analyze how seedling height varies among treatments and populations. Specifically, set up models to test whether populations differ in height, whether the press drought treatment affects height, and whether populations differ in how press drought affects height.
#Only want harvested living seedlings
ohia_living <- ohia %>% filter(Dead == 0)

#Analyze how seedling height varies among treatments and populations
  # Set up models to test whether populations differ in height
  # Whether the press drought treatment affects height
  # Whether populations differ in how press drought affects height
ggplot(ohia_living, aes(Drought, Height)) + geom_boxplot() + facet_wrap(~Population)
## Warning: Removed 2 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

#Does height very between populations (random) and drought(fixed). Also have to account for block. 
pop.model <- lmer(Height ~ Drought + (1|Population) + (1|Block), data = ohia_living)
summary(pop.model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Height ~ Drought + (1 | Population) + (1 | Block)
##    Data: ohia_living
## 
## REML criterion at convergence: 492.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.5327 -0.6145 -0.1329  0.3996  5.2509 
## 
## Random effects:
##  Groups     Name        Variance Std.Dev.
##  Population (Intercept) 0.17525  0.4186  
##  Block      (Intercept) 0.08289  0.2879  
##  Residual               1.25668  1.1210  
## Number of obs: 155, groups:  Population, 16; Block, 9
## 
## Fixed effects:
##                 Estimate Std. Error        df t value Pr(>|t|)    
## (Intercept)      1.75566    0.19709   9.13461   8.908 8.41e-06 ***
## Droughtdrought  -0.07667    0.19003 145.80239  -0.403    0.687    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## Droghtdrght -0.357
print(anova(pop.model)) 
## Type III Analysis of Variance Table with Satterthwaite's method
##          Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## Drought 0.20458 0.20458     1 145.8  0.1628 0.6872
  #Height not significantly differ by drought 
print(ranova(pop.model))
## ANOVA-like table for random-effects: Single term deletions
## 
## Model:
## Height ~ Drought + (1 | Population) + (1 | Block)
##                  npar  logLik    AIC    LRT Df Pr(>Chisq)  
## <none>              5 -246.32 502.64                       
## (1 | Population)    4 -248.86 505.73 5.0842  1    0.02414 *
## (1 | Block)         4 -247.07 502.15 1.5040  1    0.22006  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  #Height significantly differ by population!
plot_model(pop.model, type = 're')
## [[1]]

## 
## [[2]]

#Do populations differ in how drought stress effects height? 

pop.interaction <- lmer(Height ~ Drought + (1+Drought|Population) + (1|Block), data = ohia_living)
## boundary (singular) fit: see help('isSingular')
summary(pop.interaction)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Height ~ Drought + (1 + Drought | Population) + (1 | Block)
##    Data: ohia_living
## 
## REML criterion at convergence: 490.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.5679 -0.6001 -0.1459  0.3756  4.9434 
## 
## Random effects:
##  Groups     Name           Variance Std.Dev. Corr
##  Population (Intercept)    0.07870  0.2805       
##             Droughtdrought 0.14131  0.3759   1.00
##  Block      (Intercept)    0.09173  0.3029       
##  Residual                  1.22274  1.1058       
## Number of obs: 155, groups:  Population, 16; Block, 9
## 
## Fixed effects:
##                Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)      1.7797     0.1807  7.9271   9.849 1.01e-05 ***
## Droughtdrought  -0.1373     0.2174 17.2756  -0.632    0.536    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## Droghtdrght -0.137
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
print(anova(pop.interaction)) 
## Type III Analysis of Variance Table with Satterthwaite's method
##          Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Drought 0.48793 0.48793     1 17.276   0.399 0.5359
  #Height not significantly differ by drought 
print(ranova(pop.interaction))
## boundary (singular) fit: see help('isSingular')
## Warning: Model failed to converge with 1 negative eigenvalue: -8.5e+01
## ANOVA-like table for random-effects: Single term deletions
## 
## Model:
## Height ~ Drought + (1 + Drought | Population) + (1 | Block)
##                                       npar  logLik    AIC    LRT Df Pr(>Chisq)
## <none>                                   7 -245.31 504.63                     
## Drought in (1 + Drought | Population)    5 -246.32 502.64 2.0168  2    0.36480
## (1 | Block)                              6 -248.08 508.16 5.5281  1    0.01871
##                                        
## <none>                                 
## Drought in (1 + Drought | Population)  
## (1 | Block)                           *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  #Populations didn't differ in drought stress effect on height overall.

plot_model(pop.interaction, type= 're')
## [[1]]

## 
## [[2]]

1. Next, set up models to test whether historical rainfall at a site predicts the height of seedlings, and whether historical rainfall at a site predicts the effect of press drought on height.
ggplot(ohia_living, aes(MAR, Height)) + geom_boxplot() + facet_wrap(~Population)
## Warning: Continuous x aesthetic
## ℹ did you forget `aes(group = ...)`?
## Warning: Removed 2 rows containing non-finite outside the scale range
## (`stat_boxplot()`).

ohia$mar.scaled <- scale(ohia$MAR)
ohia$met.scaled <- scale(ohia$MET)

ohia_living <- ohia %>% filter(Dead == 0)

#Rainfall predicts height given drought or not? 
mar.model <- lmer(Height ~ Drought*mar.scaled + (1+Drought|Population) + (1|Block), data = ohia_living)
## boundary (singular) fit: see help('isSingular')
## Warning: Model failed to converge with 1 negative eigenvalue: -1.0e+02
summary(mar.model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Height ~ Drought * mar.scaled + (1 + Drought | Population) +  
##     (1 | Block)
##    Data: ohia_living
## 
## REML criterion at convergence: 495.6
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.6530 -0.5846 -0.1451  0.3893  4.7803 
## 
## Random effects:
##  Groups     Name           Variance Std.Dev. Corr
##  Population (Intercept)    0.0000   0.0000       
##             Droughtdrought 0.4209   0.6487    NaN
##  Block      (Intercept)    0.1503   0.3877       
##  Residual                  1.2526   1.1192       
## Number of obs: 155, groups:  Population, 16; Block, 9
## 
## Fixed effects:
##                           Estimate Std. Error      df t value Pr(>|t|)    
## (Intercept)                 1.8154     0.1889  6.9241   9.611 2.98e-05 ***
## Droughtdrought             -0.1970     0.2661 17.5300  -0.740    0.469    
## mar.scaled                 -0.1042     0.1362 64.5981  -0.765    0.447    
## Droughtdrought:mar.scaled  -0.1791     0.2717 13.3091  -0.659    0.521    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Drghtd mr.scl
## Droghtdrght -0.264              
## mar.scaled   0.103 -0.017       
## Drghtdrgh:. -0.038  0.100 -0.347
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
print(anova(mar.model)) 
## Type III Analysis of Variance Table with Satterthwaite's method
##                     Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Drought            0.68640 0.68640     1 17.530  0.5480 0.4689
## mar.scaled         1.94489 1.94489     1 18.682  1.5527 0.2281
## Drought:mar.scaled 0.54436 0.54436     1 13.309  0.4346 0.5210
  #Neither mean annual rainfall or the interaction between MAR and Drought pressure explained differences in mean height. 

plot(allEffects(mar.model))
## Warning in Analyze.model(focal.predictors, mod, xlevels, default.levels, : the
## predictor mar.scaled is a one-column matrix that was converted to a vector

plot_model(mar.model, type = "eff", terms = "mar.scaled")

plot_model(mar.model, type = "eff", terms = "Drought")

1. Finally, set up models to test whether historical evapotranspiration at a site predicts the height of seedlings, and whether historical evapotranspiration at a site predicts the effect of press drought on height.
#Evapotranspriation predicts height given drought or not? 
met.model <- lmer(Height ~ Drought*met.scaled + (1+Drought|Population) + (1|Block), data = ohia_living)
## boundary (singular) fit: see help('isSingular')
## Warning: Model failed to converge with 1 negative eigenvalue: -4.8e+01
summary(met.model)
## Linear mixed model fit by REML. t-tests use Satterthwaite's method [
## lmerModLmerTest]
## Formula: Height ~ Drought * met.scaled + (1 + Drought | Population) +  
##     (1 | Block)
##    Data: ohia_living
## 
## REML criterion at convergence: 494.5
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.5684 -0.6217 -0.1018  0.3573  4.8843 
## 
## Random effects:
##  Groups     Name           Variance Std.Dev. Corr
##  Population (Intercept)    0.0000   0.0000       
##             Droughtdrought 0.4349   0.6595    NaN
##  Block      (Intercept)    0.1157   0.3401       
##  Residual                  1.2463   1.1164       
## Number of obs: 155, groups:  Population, 16; Block, 9
## 
## Fixed effects:
##                           Estimate Std. Error       df t value Pr(>|t|)    
## (Intercept)                1.80777    0.17564  8.14517  10.293 5.99e-06 ***
## Droughtdrought            -0.15416    0.26630 15.19644  -0.579    0.571    
## met.scaled                -0.19972    0.12208 78.85387  -1.636    0.106    
## Droughtdrought:met.scaled  0.06926    0.25009 11.01247   0.277    0.787    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) Drghtd mt.scl
## Droghtdrght -0.285              
## met.scaled   0.087 -0.037       
## Drghtdrgh:. -0.006  0.034 -0.369
## optimizer (nloptwrap) convergence code: 0 (OK)
## boundary (singular) fit: see help('isSingular')
print(anova(met.model)) 
## Type III Analysis of Variance Table with Satterthwaite's method
##                     Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Drought            0.41768 0.41768     1 15.196  0.3351 0.5711
## met.scaled         1.76338 1.76338     1 12.649  1.4149 0.2561
## Drought:met.scaled 0.09559 0.09559     1 11.012  0.0767 0.7869
  #Neither MET or the interaction between MET and Drought pressure explained differences in mean height. 
plot(allEffects(met.model))
## Warning in Analyze.model(focal.predictors, mod, xlevels, default.levels, : the
## predictor met.scaled is a one-column matrix that was converted to a vector

plot_model(met.model, type = "eff", terms = "met.scaled")

2. Using the seedlings that were fated to be harvested after the press drought treatment, analyze how survival during the press drought is affected by the various potential predictors. Specifically, set up models to test whether populations vary in probability of mortality (i.e., the response column DEAD), whether the press drought treatment affects mean mortality, and whether populations vary in how mortality is affected by the press drought treatment.
#Only want seedlings fated for harvest
ohia_harvest <- ohia %>% filter(Fate == "harvest")

#Population/drought effect on mortality 
  #whether populations vary in probability of mortality
dead.pop <-glmer(Dead~ Drought + (1|Population) + (1|Block), data = ohia_harvest, family = binomial)
  #whether the press drought treatment affects mean mortality
dead.drought <-glmer(Dead~ Drought + (1|Block), data = ohia_harvest, family = binomial)
summary(dead.drought)
## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: binomial  ( logit )
## Formula: Dead ~ Drought + (1 | Block)
##    Data: ohia_harvest
## 
##      AIC      BIC   logLik deviance df.resid 
##    525.6    537.9   -259.8    519.6      448 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -3.8278 -0.8935  0.3264  0.6181  1.8382 
## 
## Random effects:
##  Groups Name        Variance Std.Dev.
##  Block  (Intercept) 1.252    1.119   
## Number of obs: 451, groups:  Block, 9
## 
## Fixed effects:
##                Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      0.4472     0.4132   1.082    0.279    
## Droughtdrought   1.0067     0.2196   4.584 4.57e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr)
## Droghtdrght -0.236
  #whether populations vary in how mortality is affected by the press drought treatment
dead.mod <- glmer(Dead~ Drought + (1+Drought|Population) + (1|Block), data = ohia_harvest, family = binomial)
  
print(anova(dead.mod, dead.pop))#not sig different so it seems that populations don't vary in how mortality is affected by the press drought treatment
## Data: ohia_harvest
## Models:
## dead.pop: Dead ~ Drought + (1 | Population) + (1 | Block)
## dead.mod: Dead ~ Drought + (1 + Drought | Population) + (1 | Block)
##          npar    AIC    BIC  logLik deviance Chisq Df Pr(>Chisq)
## dead.pop    4 522.41 538.86 -257.21   514.41                    
## dead.mod    6 525.36 550.03 -256.68   513.36  1.05  2     0.5916
print(anova(dead.pop, dead.drought))#Populations do vary in probability of mortality
## Data: ohia_harvest
## Models:
## dead.drought: Dead ~ Drought + (1 | Block)
## dead.pop: Dead ~ Drought + (1 | Population) + (1 | Block)
##              npar    AIC    BIC  logLik deviance  Chisq Df Pr(>Chisq)  
## dead.drought    3 525.56 537.89 -259.78   519.56                       
## dead.pop        4 522.41 538.86 -257.21   514.41 5.1433  1    0.02334 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(allEffects(dead.drought))

plot_model(dead.pop, type= 're')
## [[1]]

## 
## [[2]]

#####2. Next, set up models to test whether historical rainfall at a site predicts mortality, and whether historical rainfall at a site predicts the effect of press drought on mortality.

  #whether MAR varies probability of mortality
dead.mar <-glmer(Dead ~ Drought + mar.scaled + (1+Drought|Population) + (1|Block), data = ohia_harvest, family = binomial, control=glmerControl(optimizer = "bobyqa"))
## boundary (singular) fit: see help('isSingular')
anova(dead.mar)
## Analysis of Variance Table
##            npar Sum Sq Mean Sq F value
## Drought       1 15.576  15.576  15.576
## mar.scaled    1 14.287  14.287  14.287
  #MAR and drought effect 
dead.drought.mar <-glmer(Dead ~ Drought*mar.scaled + (1+Drought|Population) + (1|Block), data = ohia_harvest, family = binomial,  control=glmerControl(optimizer = "bobyqa"))
## boundary (singular) fit: see help('isSingular')
  #Just drought 
dead.mod <- glmer(Dead~ Drought + (1+Drought|Population) + (1|Block), data = ohia_harvest, family = binomial, control=glmerControl(optimizer = "bobyqa"))
  
print(anova(dead.mar, dead.drought.mar))
## Data: ohia_harvest
## Models:
## dead.mar: Dead ~ Drought + mar.scaled + (1 + Drought | Population) + (1 | Block)
## dead.drought.mar: Dead ~ Drought * mar.scaled + (1 + Drought | Population) + (1 | Block)
##                  npar    AIC    BIC  logLik deviance  Chisq Df Pr(>Chisq)
## dead.mar            7 518.97 547.75 -252.48   504.97                     
## dead.drought.mar    8 520.19 553.08 -252.10   504.19 0.7748  1     0.3787
#not sig different, rainfall at collected site didn't predict changes in dead given drought conditions

print(anova(dead.mod, dead.mar))#mortality was impacted by rainfall at collected site
## Data: ohia_harvest
## Models:
## dead.mod: Dead ~ Drought + (1 + Drought | Population) + (1 | Block)
## dead.mar: Dead ~ Drought + mar.scaled + (1 + Drought | Population) + (1 | Block)
##          npar    AIC    BIC  logLik deviance  Chisq Df Pr(>Chisq)   
## dead.mod    6 525.36 550.03 -256.68   513.36                        
## dead.mar    7 518.97 547.75 -252.48   504.97 8.3953  1   0.003762 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(allEffects(dead.mar))
## Warning in Analyze.model(focal.predictors, mod, xlevels, default.levels, : the
## predictor mar.scaled is a one-column matrix that was converted to a vector
## Warning in Analyze.model(focal.predictors, mod, xlevels, default.levels, : the
## predictor mar.scaled is a one-column matrix that was converted to a vector

#####2. Finally, set up models to test whether historical evapotranspiration at a site predicts mortality, and whether historical evapotranspiration at a site predicts the effect of press drought on mortality.

  #whether MAR varies probability of mortality
dead.met <-glmer(Dead ~ Drought + met.scaled + (1+Drought|Population) + (1|Block), data = ohia_harvest, family = binomial, control=glmerControl(optimizer = "bobyqa"))

  #MAR and drought effect 
dead.drought.met <-glmer(Dead ~ Drought*met.scaled + (1+Drought|Population) + (1|Block), data = ohia_harvest, family = binomial,  control=glmerControl(optimizer = "bobyqa"))

  #Just drought 
dead.mod <- glmer(Dead~ Drought + (1+Drought|Population) + (1|Block), data = ohia_harvest, family = binomial, control=glmerControl(optimizer = "bobyqa"))
  
print(anova(dead.met, dead.drought.met))
## Data: ohia_harvest
## Models:
## dead.met: Dead ~ Drought + met.scaled + (1 + Drought | Population) + (1 | Block)
## dead.drought.met: Dead ~ Drought * met.scaled + (1 + Drought | Population) + (1 | Block)
##                  npar    AIC    BIC  logLik deviance  Chisq Df Pr(>Chisq)  
## dead.met            7 524.25 553.03 -255.13   510.25                       
## dead.drought.met    8 523.51 556.40 -253.75   507.51 2.7471  1    0.09743 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#not sig different, evapotranspiration at collected site didn't predict changes in dead given drought conditions

print(anova(dead.mod, dead.met))#mortality was not impacted by rainfall at collected site
## Data: ohia_harvest
## Models:
## dead.mod: Dead ~ Drought + (1 + Drought | Population) + (1 | Block)
## dead.met: Dead ~ Drought + met.scaled + (1 + Drought | Population) + (1 | Block)
##          npar    AIC    BIC  logLik deviance Chisq Df Pr(>Chisq)  
## dead.mod    6 525.36 550.03 -256.68   513.36                      
## dead.met    7 524.25 553.03 -255.13   510.25  3.11  1    0.07781 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
plot(allEffects(dead.met))
## Warning in Analyze.model(focal.predictors, mod, xlevels, default.levels, : the
## predictor met.scaled is a one-column matrix that was converted to a vector
## Warning in Analyze.model(focal.predictors, mod, xlevels, default.levels, : the
## predictor met.scaled is a one-column matrix that was converted to a vector

#####3. Using the seedlings that were fated for the terminal drought experiment (i.e., the seedlings that were not harvested), analyze how longevity during terminal drought is affected by the various potential predictors. Specifically, set up models to test whether populations vary in longevity, whether the press drought treatment affects longevity, and whether populations vary in how longevity is affected by the press drought treatment. Next, set up models to test whether historical rainfall at a site predicts longevity, and whether historical rainfall at a site predicts the effect of press drought on longevity. Finally, set up models to test whether historical evapotranspiration at a site predicts longevity, and whether historical evapotranspiration at a site predicts the effect of press drought on longevity.

#Only want seedlings in drought experiment
ohia_drought <- ohia %>% filter(Fate == "terminaldrought") 

#Drought treatment affects longevity, and whether populations vary in how longevity is affected by the press drought treatment.
pop.interaction <- lmer(Longevity ~ Drought + (1+Drought|Population) + (1|Block), data = ohia_drought)
print(anova(pop.interaction))
## Type III Analysis of Variance Table with Satterthwaite's method
##         Sum Sq Mean Sq NumDF  DenDF F value Pr(>F)
## Drought 10.272  10.272     1 6.5671  0.1019 0.7594
print(ranova(pop.interaction))
## ANOVA-like table for random-effects: Single term deletions
## 
## Model:
## Longevity ~ Drought + (1 + Drought | Population) + (1 | Block)
##                                       npar  logLik    AIC     LRT Df Pr(>Chisq)
## <none>                                   7 -637.92 1289.8                      
## Drought in (1 + Drought | Population)    5 -638.34 1286.7 0.84193  2     0.6564
## (1 | Block)                              6 -638.88 1289.8 1.91424  1     0.1665
    #not significant interaction 
pop.model <- lmer(Longevity ~ Drought + (1|Population) + (1|Block), data = ohia_drought)
print(anova(pop.model))
## Type III Analysis of Variance Table with Satterthwaite's method
##         Sum Sq Mean Sq NumDF DenDF F value Pr(>F)
## Drought 2.6813  2.6813     1 153.1  0.0257 0.8728
print(ranova(pop.model))  
## ANOVA-like table for random-effects: Single term deletions
## 
## Model:
## Longevity ~ Drought + (1 | Population) + (1 | Block)
##                  npar  logLik    AIC     LRT Df Pr(>Chisq)    
## <none>              5 -638.34 1286.7                          
## (1 | Population)    4 -652.19 1312.4 27.6923  1  1.422e-07 ***
## (1 | Block)         4 -639.02 1286.0  1.3455  1     0.2461    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  ###Population has a significant impact on longevity 
plot_model(pop.model, type ='re')
## [[1]]

## 
## [[2]]

#Rainfall and longevity: 
mar.mod <-lmer( Longevity~ Drought*mar.scaled + (1+Drought|Population) + (1|Block), data = ohia_drought)
print(anova(mar.mod))
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF  DenDF F value  Pr(>F)  
## Drought             18.86   18.86     1 7.2419  0.1882 0.67705  
## mar.scaled         607.53  607.53     1 8.8769  6.0631 0.03637 *
## Drought:mar.scaled 109.55  109.55     1 4.7168  1.0933 0.34633  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  #Rainfall at site does significantly impact mortality 
plot(allEffects(mar.mod))
## Warning in Analyze.model(focal.predictors, mod, xlevels, default.levels, : the
## predictor mar.scaled is a one-column matrix that was converted to a vector

#Evapotranspiration and longevity 
met.mod <-lmer( Longevity~ Drought*met.scaled + (1+Drought|Population) + (1|Block), data = ohia_drought)
print(anova(met.mod))
## Type III Analysis of Variance Table with Satterthwaite's method
##                    Sum Sq Mean Sq NumDF   DenDF F value  Pr(>F)  
## Drought              0.00    0.00     1  5.1364  0.0000 0.99704  
## met.scaled         866.70  866.70     1 10.9407  8.4260 0.01445 *
## Drought:met.scaled  31.49   31.49     1  3.0115  0.3061 0.61851  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
  #Evapotranspiration at site does significantly impact mortality 
plot(allEffects(met.mod))
## Warning in Analyze.model(focal.predictors, mod, xlevels, default.levels, : the
## predictor met.scaled is a one-column matrix that was converted to a vector