Welcome Data Analyses Discussion Maps
Analyses
Urban Heat All Areas Portland Tacoma King County iNaturalist City Inventories
library(tidyverse)
library(corrplot)
library(knitr)
library(kableExtra)
library(gghalves)
library(patchwork)
library(scales)
library(glmmTMB)
library(bbmle)
library(DHARMa)

TACOMA

Purpose

The purpose of this page is to summarize an investigation of tree health categories as a binary response to urban heat (temperatures) for trees within Tacoma.

Response variables Binary dead top: no top dieback, top dieback

Read Data

data <- read.csv('https://raw.githubusercontent.com/jmhulbert/redhot/main/data/urban-data-modified.csv')

Wrangle Data

Remove dead trees

# Remove Dead Trees
data.w.dead <- data 
data <- data %>% filter(field.tree.canopy.symptoms!="Tree is dead") %>% filter(field.dieback.percent<100) %>% droplevels()
data$binary.tree.canopy.symptoms <- as.factor(data$binary.tree.canopy.symptoms)
levels(data$binary.tree.canopy.symptoms)
## [1] "Healthy"   "Unhealthy"

Filter to Tacoma Data

data <- data %>% filter(Area=="Tacoma") %>% droplevels()

Visualize Tacoma Data

ggplot(data,aes(binary.tree.canopy.symptoms,DN_AF1))+geom_violin()+coord_flip()+theme_bw()

p1 <- ggplot(data,aes(binary.tree.canopy.symptoms))+geom_histogram(stat="count")+theme_bw()+coord_flip()
## Warning in geom_histogram(stat = "count"): Ignoring unknown parameters:
## `binwidth`, `bins`, and `pad`
p2 <- ggplot(data,aes(reclassified.tree.canopy.symptoms))+geom_histogram(stat="count")+theme_bw()+coord_flip()
## Warning in geom_histogram(stat = "count"): Ignoring unknown parameters:
## `binwidth`, `bins`, and `pad`
p1 + p2

p3 <-ggplot(data,aes(binary.tree.canopy.symptoms,DN_AF1, fill=binary.tree.canopy.symptoms ))+geom_boxplot(alpha=0.5)+theme_bw()+coord_flip() + scale_fill_manual(name="Tree Condition",values=c("#7fcdbb","#fe9929"))+guides(fill=FALSE) +labs(x="Tree Condition",y=NULL)
## Warning: The `<scale>` argument of `guides()` cannot be `FALSE`. Use "none" instead as
## of ggplot2 3.3.4.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
p4 <-ggplot(data,aes(DN_AF1,fill=binary.tree.canopy.symptoms))+geom_density(alpha=0.5) + scale_fill_manual(name="Tree Condition",values=c("#7fcdbb","#fe9929")) +theme_bw() +labs(x="Afternoon Temperature") +guides(fill=FALSE)
p3 / p4

Analyses

data$top.dieback <- as.factor(data$top.dieback)
data$thinning <- as.factor(data$thinning)

Fit Models

binomial.daily <- glmmTMB(binary.tree.canopy.symptoms ~ mean.temp.daily ,family=binomial,data=data)
binomial.am <- glmmTMB(binary.tree.canopy.symptoms ~ DN_AM1 ,data=data,family=binomial)
binomial.af <- glmmTMB(binary.tree.canopy.symptoms ~ DN_AF1 ,data=data,family=binomial)
binomial.pm <- glmmTMB(binary.tree.canopy.symptoms ~ DN_PM1,data=data,family=binomial)

Best Fit Comparison

AICtab(binomial.daily,binomial.am,binomial.af,binomial.pm)
##                dAIC df
## binomial.pm    0.0  2 
## binomial.am    1.0  2 
## binomial.af    1.7  2 
## binomial.daily 1.9  2

PM was the best fit model for Tacoma trees

Evening Temperatures

Response 1.0: healthy / unhealthy

binomial.PM <- glmmTMB(binary.tree.canopy.symptoms ~ DN_PM1,data=data,family=binomial)

Summary

summary(binomial.PM)
##  Family: binomial  ( logit )
## Formula:          binary.tree.canopy.symptoms ~ DN_PM1
## Data: data
## 
##      AIC      BIC   logLik deviance df.resid 
##    458.3    466.0   -227.2    454.3      341 
## 
## 
## Conditional model:
##              Estimate Std. Error z value Pr(>|z|)
## (Intercept) -11.40993    8.14686  -1.401    0.161
## DN_PM1        0.12950    0.09652   1.342    0.180
levels(data$binary.tree.canopy.symptoms)
## [1] "Healthy"   "Unhealthy"

Response 2.0: healthy / top-dieback

data.top <- data %>% filter(reclassified.tree.canopy.symptoms=="Healthy"|reclassified.tree.canopy.symptoms=="Dead Top") %>% droplevels()
top.dieback.binomial.PM <- glmmTMB(top.dieback ~ DN_PM1,data=data.top,family=binomial)

Summary

summary(top.dieback.binomial.PM)
##  Family: binomial  ( logit )
## Formula:          top.dieback ~ DN_PM1
## Data: data.top
## 
##      AIC      BIC   logLik deviance df.resid 
##    180.1    187.1    -88.1    176.1      239 
## 
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept) -15.9566    14.1225   -1.13    0.259
## DN_PM1        0.1654     0.1670    0.99    0.322
levels(data$top.dieback)
## [1] "No"  "Yes"

Response 3.0: healthy / thinning

data.thin <- data %>% filter(reclassified.tree.canopy.symptoms=="Healthy"|reclassified.tree.canopy.symptoms=="Thinning Canopy") %>% droplevels()
thinning.binomial.PM <- glmmTMB(thinning ~ DN_PM1,data=data.thin,family=binomial)

Summary

summary(thinning.binomial.PM)
##  Family: binomial  ( logit )
## Formula:          thinning ~ DN_PM1
## Data: data.thin
## 
##      AIC      BIC   logLik deviance df.resid 
##    278.6    285.8   -137.3    274.6      266 
## 
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept) -5.12051   10.63340  -0.482    0.630
## DN_PM1       0.04493    0.12604   0.356    0.721
levels(data$thinning)
## [1] "No"  "Yes"

Afternoon Temperatures

Response 1.0: healthy / unhealthy

binomial.af <- glmmTMB(binary.tree.canopy.symptoms ~ DN_AF1,data=data,family=binomial)

Summary

summary(binomial.af)
##  Family: binomial  ( logit )
## Formula:          binary.tree.canopy.symptoms ~ DN_AF1
## Data: data
## 
##      AIC      BIC   logLik deviance df.resid 
##    460.0    467.7   -228.0    456.0      341 
## 
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)  2.62180    7.08026   0.370    0.711
## DN_AF1      -0.03493    0.07972  -0.438    0.661
levels(data$binary.tree.canopy.symptoms)
## [1] "Healthy"   "Unhealthy"

Response 2.0: healthy / top-dieback

data.top <- data %>% filter(reclassified.tree.canopy.symptoms=="Healthy"|reclassified.tree.canopy.symptoms=="Dead Top") %>% droplevels()
top.dieback.binomial.af <- glmmTMB(top.dieback ~ DN_AF1,data=data.top,family=binomial)

Summary

summary(top.dieback.binomial.af)
##  Family: binomial  ( logit )
## Formula:          top.dieback ~ DN_AF1
## Data: data.top
## 
##      AIC      BIC   logLik deviance df.resid 
##    179.9    186.8    -87.9    175.9      239 
## 
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept)  10.8724    10.8406   1.003    0.316
## DN_AF1       -0.1450     0.1223  -1.185    0.236
levels(data$top.dieback)
## [1] "No"  "Yes"

Response 3.0: healthy / thinning

data.thin <- data %>% filter(reclassified.tree.canopy.symptoms=="Healthy"|reclassified.tree.canopy.symptoms=="Thinning Canopy") %>% droplevels()
thinning.binomial.af <- glmmTMB(thinning ~ DN_AF1,data=data.thin,family=binomial)

Summary

summary(thinning.binomial.af)
##  Family: binomial  ( logit )
## Formula:          thinning ~ DN_AF1
## Data: data.thin
## 
##      AIC      BIC   logLik deviance df.resid 
##    278.6    285.8   -137.3    274.6      266 
## 
## 
## Conditional model:
##             Estimate Std. Error z value Pr(>|z|)
## (Intercept) -4.33937   10.05036  -0.432    0.666
## DN_AF1       0.03384    0.11302   0.299    0.765
levels(data$thinning)
## [1] "No"  "Yes"

Summary

There was no evidence for a relationship between tree health and afternoon temperatures in Tacoma.

Area Response Explanatory df.resid Estimate Std.Error z-val Pr(>z) Signif.
Tacoma healthy/unhealthy DN_PM 341 0.12950 0.09652 1.342 0.180
Tacoma no/dead-top DN_PM 239 0.1654 0.1670 0.99 0.322
Tacoma no/thinning DN_PM 266 0.04493 0.12604 0.356 0.721