Q1Model_RMarkdown_Basal

####Packages

#BASAL AREA CALCULATED BY SUBSITE AREA

#MODEL OPTIONS ##OPTION 1: Lmer, with log-transformed basal area, since we are lots of small values, reduces skew.

#Linear model + log transform
modelgst_basub <- lmer(
  log(basal_area_ha) ~ GreenSpace + (1 | Plot),
  data = subsite_table
)

#Residuals
resid_gamma <- residuals(modelgst_basub, type = "pearson")
qqnorm(resid_gamma); qqline(resid_gamma)

hist(resid_gamma)

plot(resid_gamma)

#check effect of green space type on species richness using model outputs
Anova(modelgst_basub)
Analysis of Deviance Table (Type II Wald chisquare tests)

Response: log(basal_area_ha)
            Chisq Df Pr(>Chisq)    
GreenSpace 57.928  5  3.255e-11 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Green space statistically significant portion of the variation
#push out model summary as csv file for plotting
tbl.basub <- tidy(modelgst_basub)
tbl.basub <- tbl.basub %>%
  mutate(p.value = 2 * (1 - pt(abs(statistic), df = df.residual(modelgst_basub))))
tbl.basub
# A tibble: 8 × 7
  effect   group    term                  estimate std.error statistic   p.value
  <chr>    <chr>    <chr>                    <dbl>     <dbl>     <dbl>     <dbl>
1 fixed    <NA>     (Intercept)            -0.0891     0.231    -0.385  7.01e- 1
2 fixed    <NA>     GreenSpaceInstitutio…   1.15       0.296     3.88   1.96e- 4
3 fixed    <NA>     GreenSpacePark          2.16       0.317     6.80   9.89e-10
4 fixed    <NA>     GreenSpacePublic Rig…   1.81       0.284     6.36   7.40e- 9
5 fixed    <NA>     GreenSpaceResidential   1.17       0.284     4.12   8.18e- 5
6 fixed    <NA>     GreenSpaceVacant Lot    1.19       0.347     3.43   9.00e- 4
7 ran_pars Plot     sd__(Intercept)         0.328     NA        NA     NA       
8 ran_pars Residual sd__Observation         0.840     NA        NA     NA       
#tukey test to check pairwise comparisons of species richness of each green space type
Pairwise.basub <- emmeans(modelgst_basub, pairwise ~ GreenSpace, type = "response")
# Summary of pairwise comparisons
summary(Pairwise.basub$contrasts)
 contrast                              ratio     SE   df null t.ratio p.value
 Commercial / Institutional            0.317 0.0942 77.8    1  -3.869  0.0030
 Commercial / Park                     0.116 0.0369 81.4    1  -6.768  <.0001
 Commercial / (Public Right-Of-Way)    0.164 0.0468 78.8    1  -6.343  <.0001
 Commercial / Residential              0.310 0.0884 78.8    1  -4.108  0.0013
 Commercial / Vacant Lot               0.304 0.1060 79.8    1  -3.416  0.0124
 Institutional / Park                  0.365 0.1120 82.8    1  -3.288  0.0180
 Institutional / (Public Right-Of-Way) 0.517 0.1390 76.8    1  -2.452  0.1516
 Institutional / Residential           0.977 0.2630 76.8    1  -0.085  1.0000
 Institutional / Vacant Lot            0.957 0.3240 81.3    1  -0.131  1.0000
 Park / (Public Right-Of-Way)          1.418 0.4130 79.1    1   1.199  0.8360
 Park / Residential                    2.679 0.7800 79.1    1   3.384  0.0137
 Park / Vacant Lot                     2.623 0.9410 84.4    1   2.687  0.0886
 (Public Right-Of-Way) / Residential   1.890 0.4790 74.5    1   2.512  0.1338
 (Public Right-Of-Way) / Vacant Lot    1.849 0.6060 81.9    1   1.875  0.4247
 Residential / Vacant Lot              0.979 0.3210 81.9    1  -0.065  1.0000

Degrees-of-freedom method: kenward-roger 
P value adjustment: tukey method for comparing a family of 6 estimates 
Tests are performed on the log scale 
#summarizing pairwise differences across green space types
summary(Pairwise.basub) 
$emmeans
 GreenSpace          response    SE   df lower.CL upper.CL
 Commercial             0.915 0.212 93.5    0.577     1.45
 Institutional          2.882 0.612 91.9    1.890     4.39
 Park                   7.899 1.900 94.1    4.904    12.72
 Public Right-Of-Way    5.571 1.070 89.1    3.801     8.16
 Residential            2.948 0.567 89.1    2.012     4.32
 Vacant Lot             3.012 0.854 95.0    1.716     5.29

Degrees-of-freedom method: kenward-roger 
Confidence level used: 0.95 
Intervals are back-transformed from the log scale 

$contrasts
 contrast                              ratio     SE   df null t.ratio p.value
 Commercial / Institutional            0.317 0.0942 77.8    1  -3.869  0.0030
 Commercial / Park                     0.116 0.0369 81.4    1  -6.768  <.0001
 Commercial / (Public Right-Of-Way)    0.164 0.0468 78.8    1  -6.343  <.0001
 Commercial / Residential              0.310 0.0884 78.8    1  -4.108  0.0013
 Commercial / Vacant Lot               0.304 0.1060 79.8    1  -3.416  0.0124
 Institutional / Park                  0.365 0.1120 82.8    1  -3.288  0.0180
 Institutional / (Public Right-Of-Way) 0.517 0.1390 76.8    1  -2.452  0.1516
 Institutional / Residential           0.977 0.2630 76.8    1  -0.085  1.0000
 Institutional / Vacant Lot            0.957 0.3240 81.3    1  -0.131  1.0000
 Park / (Public Right-Of-Way)          1.418 0.4130 79.1    1   1.199  0.8360
 Park / Residential                    2.679 0.7800 79.1    1   3.384  0.0137
 Park / Vacant Lot                     2.623 0.9410 84.4    1   2.687  0.0886
 (Public Right-Of-Way) / Residential   1.890 0.4790 74.5    1   2.512  0.1338
 (Public Right-Of-Way) / Vacant Lot    1.849 0.6060 81.9    1   1.875  0.4247
 Residential / Vacant Lot              0.979 0.3210 81.9    1  -0.065  1.0000

Degrees-of-freedom method: kenward-roger 
P value adjustment: tukey method for comparing a family of 6 estimates 
Tests are performed on the log scale 

##OPTION 2: Gamma with log link, but I believe since we have so many small values, this is not the best option? I also get a warning when running the model (warning means the Gamma GLMM didn’t converge cleanly)

#Gamma with log link
modelgst_basub1 <- glmer(basal_area_ha ~ GreenSpace + (1 | Plot), data = subsite_table, family = Gamma(link = "log"))
Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
Model failed to converge with max|grad| = 0.0147709 (tol = 0.002, component 1)
summary(modelgst_basub1)
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: Gamma  ( log )
Formula: basal_area_ha ~ GreenSpace + (1 | Plot)
   Data: subsite_table

      AIC       BIC    logLik -2*log(L)  df.resid 
    500.3     521.2    -242.1     484.3        93 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-1.2967 -0.6666 -0.1832  0.5650  4.3880 

Random effects:
 Groups   Name        Variance Std.Dev.
 Plot     (Intercept) 0.1234   0.3513  
 Residual             0.4981   0.7058  
Number of obs: 101, groups:  Plot, 22

Fixed effects:
                              Estimate Std. Error t value Pr(>|z|)    
(Intercept)                   0.240812   0.004912   49.03   <2e-16 ***
GreenSpaceInstitutional       1.226580   0.004909  249.88   <2e-16 ***
GreenSpacePark                2.083658   0.005081  410.13   <2e-16 ***
GreenSpacePublic Right-Of-Way 1.573543   0.004916  320.11   <2e-16 ***
GreenSpaceResidential         0.933804   0.005075  183.99   <2e-16 ***
GreenSpaceVacant Lot          1.394668   0.004920  283.47   <2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) GrnSpI GrnSpP GSPR-O GrnSpR
GrnSpcInstt -0.001                            
GreenSpcPrk  0.000  0.000                     
GrnSpPR-O-W  0.000  0.001  0.000              
GrnSpcRsdnt  0.000  0.001 -0.250  0.000       
GrnSpcVcntL  0.000  0.000  0.000  0.000  0.000
optimizer (Nelder_Mead) convergence code: 0 (OK)
Model failed to converge with max|grad| = 0.0147709 (tol = 0.002, component 1)
print(modelgst_basub1)
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: Gamma  ( log )
Formula: basal_area_ha ~ GreenSpace + (1 | Plot)
   Data: subsite_table
      AIC       BIC    logLik -2*log(L)  df.resid 
 500.2804  521.2014 -242.1402  484.2804        93 
Random effects:
 Groups   Name        Std.Dev.
 Plot     (Intercept) 0.3513  
 Residual             0.7058  
Number of obs: 101, groups:  Plot, 22
Fixed Effects:
                  (Intercept)        GreenSpaceInstitutional  
                       0.2408                         1.2266  
               GreenSpacePark  GreenSpacePublic Right-Of-Way  
                       2.0837                         1.5735  
        GreenSpaceResidential           GreenSpaceVacant Lot  
                       0.9338                         1.3947  
optimizer (Nelder_Mead) convergence code: 0 (OK) ; 0 optimizer warnings; 1 lme4 warnings 
#Residuals
resid_gamma1 <- residuals(modelgst_basub1, type = "pearson")
qqnorm(resid_gamma1); qqline(resid_gamma1)

hist(resid_gamma1)

plot(resid_gamma1)

#check effect of green space type on species richness using model outputs
Anova(modelgst_basub1)
Analysis of Deviance Table (Type II Wald chisquare tests)

Response: basal_area_ha
            Chisq Df Pr(>Chisq)    
GreenSpace 500908  5  < 2.2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Green space statistically significant portion of the variation
#push out model summary as csv file for plotting
tbl.basub1 <- tidy(modelgst_basub1)
tbl.basub1 <- tbl.basub1 %>%
  mutate(p.value = ifelse(p.value < 0.0001, "<0.0001", round(p.value, 4)))
tbl.basub1
# A tibble: 8 × 7
  effect   group    term                    estimate std.error statistic p.value
  <chr>    <chr>    <chr>                      <dbl>     <dbl>     <dbl> <chr>  
1 fixed    <NA>     (Intercept)                0.241   0.00491      49.0 <0.0001
2 fixed    <NA>     GreenSpaceInstitutional    1.23    0.00491     250.  <0.0001
3 fixed    <NA>     GreenSpacePark             2.08    0.00508     410.  <0.0001
4 fixed    <NA>     GreenSpacePublic Right…    1.57    0.00492     320.  <0.0001
5 fixed    <NA>     GreenSpaceResidential      0.934   0.00508     184.  <0.0001
6 fixed    <NA>     GreenSpaceVacant Lot       1.39    0.00492     283.  <0.0001
7 ran_pars Plot     sd__(Intercept)            0.351  NA            NA   <NA>   
8 ran_pars Residual sd__Observation            0.706  NA            NA   <NA>   
#tukey test to check pairwise comparisons of species richness of each green space type
Pairwise.basub1 <- emmeans(modelgst_basub1, pairwise ~ GreenSpace, type = "response")
# Summary of pairwise comparisons
summary(Pairwise.basub1$contrasts)
 contrast                              ratio       SE  df null  z.ratio p.value
 Commercial / Institutional            0.293 0.001440 Inf    1 -249.875  <.0001
 Commercial / Park                     0.124 0.000632 Inf    1 -410.127  <.0001
 Commercial / (Public Right-Of-Way)    0.207 0.001020 Inf    1 -320.114  <.0001
 Commercial / Residential              0.393 0.001990 Inf    1 -183.989  <.0001
 Commercial / Vacant Lot               0.248 0.001220 Inf    1 -283.473  <.0001
 Institutional / Park                  0.424 0.003000 Inf    1 -121.306  <.0001
 Institutional / (Public Right-Of-Way) 0.707 0.004910 Inf    1  -49.961  <.0001
 Institutional / Residential           1.340 0.009460 Inf    1   41.484  <.0001
 Institutional / Vacant Lot            0.845 0.005870 Inf    1  -24.185  <.0001
 Park / (Public Right-Of-Way)          1.665 0.011800 Inf    1   72.146  <.0001
 Park / Residential                    3.158 0.025400 Inf    1  143.221  <.0001
 Park / Vacant Lot                     1.992 0.014100 Inf    1   97.427  <.0001
 (Public Right-Of-Way) / Residential   1.896 0.013400 Inf    1   90.533  <.0001
 (Public Right-Of-Way) / Vacant Lot    1.196 0.008320 Inf    1   25.722  <.0001
 Residential / Vacant Lot              0.631 0.004460 Inf    1  -65.203  <.0001

P value adjustment: tukey method for comparing a family of 6 estimates 
Tests are performed on the log scale 
#summarizing pairwise differences across green space types
summary(Pairwise.basub1) 
$emmeans
 GreenSpace          response      SE  df asymp.LCL asymp.UCL
 Commercial              1.27 0.00625 Inf      1.26      1.28
 Institutional           4.34 0.03010 Inf      4.28      4.40
 Park                   10.22 0.07220 Inf     10.08     10.36
 Public Right-Of-Way     6.14 0.04260 Inf      6.05      6.22
 Residential             3.24 0.02290 Inf      3.19      3.28
 Vacant Lot              5.13 0.03570 Inf      5.06      5.20

Confidence level used: 0.95 
Intervals are back-transformed from the log scale 

$contrasts
 contrast                              ratio       SE  df null  z.ratio p.value
 Commercial / Institutional            0.293 0.001440 Inf    1 -249.875  <.0001
 Commercial / Park                     0.124 0.000632 Inf    1 -410.127  <.0001
 Commercial / (Public Right-Of-Way)    0.207 0.001020 Inf    1 -320.114  <.0001
 Commercial / Residential              0.393 0.001990 Inf    1 -183.989  <.0001
 Commercial / Vacant Lot               0.248 0.001220 Inf    1 -283.473  <.0001
 Institutional / Park                  0.424 0.003000 Inf    1 -121.306  <.0001
 Institutional / (Public Right-Of-Way) 0.707 0.004910 Inf    1  -49.961  <.0001
 Institutional / Residential           1.340 0.009460 Inf    1   41.484  <.0001
 Institutional / Vacant Lot            0.845 0.005870 Inf    1  -24.185  <.0001
 Park / (Public Right-Of-Way)          1.665 0.011800 Inf    1   72.146  <.0001
 Park / Residential                    3.158 0.025400 Inf    1  143.221  <.0001
 Park / Vacant Lot                     1.992 0.014100 Inf    1   97.427  <.0001
 (Public Right-Of-Way) / Residential   1.896 0.013400 Inf    1   90.533  <.0001
 (Public Right-Of-Way) / Vacant Lot    1.196 0.008320 Inf    1   25.722  <.0001
 Residential / Vacant Lot              0.631 0.004460 Inf    1  -65.203  <.0001

P value adjustment: tukey method for comparing a family of 6 estimates 
Tests are performed on the log scale 

#BASAL AREA CALCULATED BY SUBSITE AREA

#MODEL OPTIONS ##OPTION 1: Lmer, with log-transformed basal area, since we are lots of small values, reduces skew. Same as basal area by subsite

#Linear model + log transform
modelgst_bapa <- lmer(
  log(basal_area_plant_ha) ~ GreenSpace + (1 | Plot),
  data = subsite_table
)

#Residuals
resid_gamma <- residuals(modelgst_bapa, type = "pearson")
qqnorm(resid_gamma); qqline(resid_gamma)

hist(resid_gamma)

plot(resid_gamma)

#check effect of green space type on species richness using model outputs
Anova(modelgst_bapa)
Analysis of Deviance Table (Type II Wald chisquare tests)

Response: log(basal_area_plant_ha)
            Chisq Df Pr(>Chisq)    
GreenSpace 50.636  5  1.027e-09 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Green space statistically significant portion of the variation
#push out model summary as csv file for plotting
tbl.bapa <- tidy(modelgst_bapa)
tbl.bapa <- tbl.basub %>%
  mutate(p.value = 2 * (1 - pt(abs(statistic), df = df.residual(modelgst_bapa))))
tbl.bapa
# A tibble: 8 × 7
  effect   group    term                  estimate std.error statistic   p.value
  <chr>    <chr>    <chr>                    <dbl>     <dbl>     <dbl>     <dbl>
1 fixed    <NA>     (Intercept)            -0.0891     0.231    -0.385  7.01e- 1
2 fixed    <NA>     GreenSpaceInstitutio…   1.15       0.296     3.88   1.96e- 4
3 fixed    <NA>     GreenSpacePark          2.16       0.317     6.80   9.89e-10
4 fixed    <NA>     GreenSpacePublic Rig…   1.81       0.284     6.36   7.40e- 9
5 fixed    <NA>     GreenSpaceResidential   1.17       0.284     4.12   8.18e- 5
6 fixed    <NA>     GreenSpaceVacant Lot    1.19       0.347     3.43   9.00e- 4
7 ran_pars Plot     sd__(Intercept)         0.328     NA        NA     NA       
8 ran_pars Residual sd__Observation         0.840     NA        NA     NA       
#tukey test to check pairwise comparisons of species richness of each green space type
Pairwise.bapa <- emmeans(modelgst_bapa, pairwise ~ GreenSpace, type = "response")
# Summary of pairwise comparisons
summary(Pairwise.bapa$contrasts)
 contrast                              ratio     SE   df null t.ratio p.value
 Commercial / Institutional            0.612 0.1810 78.3    1  -1.663  0.5598
 Commercial / Park                     0.330 0.1040 82.3    1  -3.508  0.0093
 Commercial / (Public Right-Of-Way)    0.189 0.0536 79.4    1  -5.875  <.0001
 Commercial / Residential              0.712 0.2020 79.4    1  -1.198  0.8363
 Commercial / Vacant Lot               0.793 0.2750 80.8    1  -0.667  0.9850
 Institutional / Park                  0.539 0.1640 83.8    1  -2.034  0.3325
 Institutional / (Public Right-Of-Way) 0.309 0.0828 77.2    1  -4.384  0.0005
 Institutional / Residential           1.163 0.3110 77.2    1   0.566  0.9929
 Institutional / Vacant Lot            1.296 0.4360 82.5    1   0.771  0.9716
 Park / (Public Right-Of-Way)          0.575 0.1660 79.9    1  -1.913  0.4018
 Park / Residential                    2.160 0.6260 79.9    1   2.660  0.0951
 Park / Vacant Lot                     2.407 0.8560 85.7    1   2.469  0.1452
 (Public Right-Of-Way) / Residential   3.760 0.9490 74.6    1   5.246  <.0001
 (Public Right-Of-Way) / Vacant Lot    4.189 1.3600 83.0    1   4.399  0.0004
 Residential / Vacant Lot              1.114 0.3630 83.0    1   0.332  0.9994

Degrees-of-freedom method: kenward-roger 
P value adjustment: tukey method for comparing a family of 6 estimates 
Tests are performed on the log scale 
#summarizing pairwise differences across green space types
summary(Pairwise.bapa) 
$emmeans
 GreenSpace          response    SE   df lower.CL upper.CL
 Commercial              3.93 0.891 94.4     2.50     6.16
 Institutional           6.42 1.330 93.7     4.26     9.68
 Park                   11.92 2.800 94.7     7.48    19.00
 Public Right-Of-Way    20.74 3.880 92.3    14.31    30.07
 Residential             5.52 1.030 92.3     3.81     8.00
 Vacant Lot              4.95 1.380 95.0     2.85     8.60

Degrees-of-freedom method: kenward-roger 
Confidence level used: 0.95 
Intervals are back-transformed from the log scale 

$contrasts
 contrast                              ratio     SE   df null t.ratio p.value
 Commercial / Institutional            0.612 0.1810 78.3    1  -1.663  0.5598
 Commercial / Park                     0.330 0.1040 82.3    1  -3.508  0.0093
 Commercial / (Public Right-Of-Way)    0.189 0.0536 79.4    1  -5.875  <.0001
 Commercial / Residential              0.712 0.2020 79.4    1  -1.198  0.8363
 Commercial / Vacant Lot               0.793 0.2750 80.8    1  -0.667  0.9850
 Institutional / Park                  0.539 0.1640 83.8    1  -2.034  0.3325
 Institutional / (Public Right-Of-Way) 0.309 0.0828 77.2    1  -4.384  0.0005
 Institutional / Residential           1.163 0.3110 77.2    1   0.566  0.9929
 Institutional / Vacant Lot            1.296 0.4360 82.5    1   0.771  0.9716
 Park / (Public Right-Of-Way)          0.575 0.1660 79.9    1  -1.913  0.4018
 Park / Residential                    2.160 0.6260 79.9    1   2.660  0.0951
 Park / Vacant Lot                     2.407 0.8560 85.7    1   2.469  0.1452
 (Public Right-Of-Way) / Residential   3.760 0.9490 74.6    1   5.246  <.0001
 (Public Right-Of-Way) / Vacant Lot    4.189 1.3600 83.0    1   4.399  0.0004
 Residential / Vacant Lot              1.114 0.3630 83.0    1   0.332  0.9994

Degrees-of-freedom method: kenward-roger 
P value adjustment: tukey method for comparing a family of 6 estimates 
Tests are performed on the log scale 

##OPTION 2: Gamma with log link, but I believe since we have so many small values, this is not the best option? I also get a warning when running the model (warning means the Gamma GLMM didn’t converge cleanly)

#Gamma with log link
modelgst_bapa1 <- glmer(basal_area_plant_ha ~ GreenSpace + (1 | Plot), data = subsite_table, family = Gamma(link = "log"))
summary(modelgst_bapa1)
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: Gamma  ( log )
Formula: basal_area_plant_ha ~ GreenSpace + (1 | Plot)
   Data: subsite_table

      AIC       BIC    logLik -2*log(L)  df.resid 
    679.4     700.3    -331.7     663.4        93 

Scaled residuals: 
    Min      1Q  Median      3Q     Max 
-1.2565 -0.7048 -0.2022  0.5101  3.2797 

Random effects:
 Groups   Name        Variance Std.Dev.
 Plot     (Intercept) 0.1175   0.3428  
 Residual             0.5064   0.7116  
Number of obs: 101, groups:  Plot, 22

Fixed effects:
                              Estimate Std. Error t value Pr(>|z|)    
(Intercept)                     1.6253     0.2093   7.767 8.04e-15 ***
GreenSpaceInstitutional         0.5265     0.2589   2.033   0.0420 *  
GreenSpacePark                  1.0989     0.2677   4.106 4.03e-05 ***
GreenSpacePublic Right-Of-Way   1.6894     0.2544   6.640 3.14e-11 ***
GreenSpaceResidential           0.1757     0.2380   0.738   0.4605    
GreenSpaceVacant Lot            0.5077     0.2929   1.733   0.0831 .  
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Correlation of Fixed Effects:
            (Intr) GrnSpI GrnSpP GSPR-O GrnSpR
GrnSpcInstt -0.673                            
GreenSpcPrk -0.622  0.502                     
GrnSpPR-O-W -0.709  0.615  0.516              
GrnSpcRsdnt -0.707  0.581  0.549  0.608       
GrnSpcVcntL -0.543  0.436  0.431  0.443  0.479
print(modelgst_bapa1)
Generalized linear mixed model fit by maximum likelihood (Laplace
  Approximation) [glmerMod]
 Family: Gamma  ( log )
Formula: basal_area_plant_ha ~ GreenSpace + (1 | Plot)
   Data: subsite_table
      AIC       BIC    logLik -2*log(L)  df.resid 
 679.3522  700.2732 -331.6761  663.3522        93 
Random effects:
 Groups   Name        Std.Dev.
 Plot     (Intercept) 0.3428  
 Residual             0.7116  
Number of obs: 101, groups:  Plot, 22
Fixed Effects:
                  (Intercept)        GreenSpaceInstitutional  
                       1.6253                         0.5265  
               GreenSpacePark  GreenSpacePublic Right-Of-Way  
                       1.0989                         1.6894  
        GreenSpaceResidential           GreenSpaceVacant Lot  
                       0.1757                         0.5077  
#Residuals
resid_gamma1 <- residuals(modelgst_bapa1, type = "pearson")
qqnorm(resid_gamma1); qqline(resid_gamma1)

hist(resid_gamma1)

plot(resid_gamma1)

#check effect of green space type on species richness using model outputs
Anova(modelgst_bapa1)
Analysis of Deviance Table (Type II Wald chisquare tests)

Response: basal_area_plant_ha
            Chisq Df Pr(>Chisq)    
GreenSpace 70.146  5  9.556e-14 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#Green space statistically significant portion of the variation
#push out model summary as csv file for plotting
tbl.bapa1 <- tidy(modelgst_bapa1)
tbl.bapa1 <- tbl.bapa1 %>%
  mutate(p.value = ifelse(p.value < 0.0001, "<0.0001", round(p.value, 4)))
tbl.bapa1
# A tibble: 8 × 7
  effect   group    term                    estimate std.error statistic p.value
  <chr>    <chr>    <chr>                      <dbl>     <dbl>     <dbl> <chr>  
1 fixed    <NA>     (Intercept)                1.63      0.209     7.77  <0.0001
2 fixed    <NA>     GreenSpaceInstitutional    0.526     0.259     2.03  0.042  
3 fixed    <NA>     GreenSpacePark             1.10      0.268     4.11  <0.0001
4 fixed    <NA>     GreenSpacePublic Right…    1.69      0.254     6.64  <0.0001
5 fixed    <NA>     GreenSpaceResidential      0.176     0.238     0.738 0.4605 
6 fixed    <NA>     GreenSpaceVacant Lot       0.508     0.293     1.73  0.0831 
7 ran_pars Plot     sd__(Intercept)            0.343    NA        NA     <NA>   
8 ran_pars Residual sd__Observation            0.712    NA        NA     <NA>   
#tukey test to check pairwise comparisons of species richness of each green space type
Pairwise.bapa1 <- emmeans(modelgst_bapa1, pairwise ~ GreenSpace, type = "response")
# Summary of pairwise comparisons
summary(Pairwise.bapa1$contrasts)
 contrast                              ratio     SE  df null z.ratio p.value
 Commercial / Institutional            0.591 0.1530 Inf    1  -2.033  0.3232
 Commercial / Park                     0.333 0.0892 Inf    1  -4.106  0.0006
 Commercial / (Public Right-Of-Way)    0.185 0.0470 Inf    1  -6.640  <.0001
 Commercial / Residential              0.839 0.2000 Inf    1  -0.738  0.9772
 Commercial / Vacant Lot               0.602 0.1760 Inf    1  -1.733  0.5098
 Institutional / Park                  0.564 0.1480 Inf    1  -2.178  0.2482
 Institutional / (Public Right-Of-Way) 0.313 0.0704 Inf    1  -5.161  <.0001
 Institutional / Residential           1.420 0.3240 Inf    1   1.538  0.6396
 Institutional / Vacant Lot            1.019 0.3000 Inf    1   0.064  1.0000
 Park / (Public Right-Of-Way)          0.554 0.1420 Inf    1  -2.297  0.1951
 Park / Residential                    2.517 0.6080 Inf    1   3.821  0.0018
 Park / Vacant Lot                     1.806 0.5420 Inf    1   1.972  0.3585
 (Public Right-Of-Way) / Residential   4.544 0.9930 Inf    1   6.925  <.0001
 (Public Right-Of-Way) / Vacant Lot    3.260 0.9480 Inf    1   4.066  0.0007
 Residential / Vacant Lot              0.718 0.1970 Inf    1  -1.207  0.8337

P value adjustment: tukey method for comparing a family of 6 estimates 
Tests are performed on the log scale 
#summarizing pairwise differences across green space types
summary(Pairwise.bapa1) 
$emmeans
 GreenSpace          response   SE  df asymp.LCL asymp.UCL
 Commercial              5.08 1.06 Inf      3.37      7.66
 Institutional           8.60 1.67 Inf      5.87     12.59
 Park                   15.24 3.26 Inf     10.02     23.19
 Public Right-Of-Way    27.51 5.00 Inf     19.27     39.29
 Residential             6.06 1.05 Inf      4.31      8.50
 Vacant Lot              8.44 2.12 Inf      5.16     13.80

Confidence level used: 0.95 
Intervals are back-transformed from the log scale 

$contrasts
 contrast                              ratio     SE  df null z.ratio p.value
 Commercial / Institutional            0.591 0.1530 Inf    1  -2.033  0.3232
 Commercial / Park                     0.333 0.0892 Inf    1  -4.106  0.0006
 Commercial / (Public Right-Of-Way)    0.185 0.0470 Inf    1  -6.640  <.0001
 Commercial / Residential              0.839 0.2000 Inf    1  -0.738  0.9772
 Commercial / Vacant Lot               0.602 0.1760 Inf    1  -1.733  0.5098
 Institutional / Park                  0.564 0.1480 Inf    1  -2.178  0.2482
 Institutional / (Public Right-Of-Way) 0.313 0.0704 Inf    1  -5.161  <.0001
 Institutional / Residential           1.420 0.3240 Inf    1   1.538  0.6396
 Institutional / Vacant Lot            1.019 0.3000 Inf    1   0.064  1.0000
 Park / (Public Right-Of-Way)          0.554 0.1420 Inf    1  -2.297  0.1951
 Park / Residential                    2.517 0.6080 Inf    1   3.821  0.0018
 Park / Vacant Lot                     1.806 0.5420 Inf    1   1.972  0.3585
 (Public Right-Of-Way) / Residential   4.544 0.9930 Inf    1   6.925  <.0001
 (Public Right-Of-Way) / Vacant Lot    3.260 0.9480 Inf    1   4.066  0.0007
 Residential / Vacant Lot              0.718 0.1970 Inf    1  -1.207  0.8337

P value adjustment: tukey method for comparing a family of 6 estimates 
Tests are performed on the log scale 

#In conclusions, I am leaning towards lmer (although I did not use lmer for any other models). I think the residuals look best, but let me know your thoughts/suggestions?