Reading in data

library(readr)
chpt2_r_data <- read_csv("~/Downloads/chapter 2 /chpt2.r.data.csv", 
    col_types = cols(block = col_character(), 
        patch = col_character(), position = col_character(), 
        max.temp = col_number(), ros = col_number(), 
        rcd10 = col_number(), rcd20 = col_number(), 
        mortality1 = col_number(), mortality2 = col_number(), 
        mortality3 = col_number(), mortality10 = col_number(), 
        mortality20 = col_number(), mortality100 = col_number(), 
        mortality200 = col_number(), green.needles = col_number(), 
        tree.char = col_number(), tree.scorch = col_number(), 
        rcd1.avg = col_number(), rcd2.avg = col_number(), 
        rcd3.avg = col_number(), rcd4.avg = col_number(), 
        difn = col_number()))
## New names:
## • `` -> `...27`
## • `` -> `...28`
## • `` -> `...29`
## Warning: One or more parsing issues, call `problems()` on your data frame for details,
## e.g.:
##   dat <- vroom(...)
##   problems(dat)
chpt2_r_data <- chpt2_r_data[-(37:52), ]
chpt2_r_data <- chpt2_r_data[, !(names(chpt2_r_data) %in% c("...27", "...28", "...29"))]

Library

library(glmmTMB)
library(DHARMa)
## This is DHARMa 0.4.7. For overview type '?DHARMa'. For recent changes, type news(package = 'DHARMa')
library(performance)
library(emmeans)
## Welcome to emmeans.
## Caution: You lose important information if you filter this package's results.
## See '? untidy'
library(multcomp)
## Loading required package: mvtnorm
## Loading required package: survival
## Loading required package: TH.data
## Loading required package: MASS
## 
## Attaching package: 'TH.data'
## The following object is masked from 'package:MASS':
## 
##     geyser

Model 5: severity (tree scorch), first order fire effect

chpt2_r_data$tree.scorch_prop <- chpt2_r_data$tree.scorch / 100
chpt2_r_data$tree.scorch_beta <- pmin(
  pmax(chpt2_r_data$tree.scorch_prop, 0.001),
  0.999
)

model5 <- glmmTMB(
  tree.scorch_beta ~ season * location + ros + max.temp + (1 | patch) + (1 | block),
  data = chpt2_r_data,
  family = beta_family(link = "logit")
)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
summary(model5)
##  Family: beta  ( logit )
## Formula:          tree.scorch_beta ~ season * location + ros + max.temp + (1 |  
##     patch) + (1 | block)
## Data: chpt2_r_data
## 
##       AIC       BIC    logLik -2*log(L)  df.resid 
##      -1.1      16.4      11.5     -23.1        25 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  patch  (Intercept) 0.4064   0.6375  
##  block  (Intercept) 0.5410   0.7355  
## Number of obs: 36, groups:  patch, 12; block, 4
## 
## Dispersion parameter for beta family (): 5.51 
## 
## Conditional model:
##                                Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                   -1.204818   1.056560  -1.140    0.254  
## seasongrowing                  0.505530   1.123349   0.450    0.653  
## locationinside                 0.132397   0.446411   0.297    0.767  
## locationoutside               -0.462199   0.446083  -1.036    0.300  
## ros                           -2.672361   2.734752  -0.977    0.328  
## max.temp                       0.002531   0.001553   1.630    0.103  
## seasongrowing:locationinside   0.488643   0.843691   0.579    0.562  
## seasongrowing:locationoutside  1.585017   0.747550   2.120    0.034 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
emm <- emmeans(model5, ~ season * location, type = "response")
pairs(emm, adjust = "FDR")
##  contrast                          odds.ratio    SE  df null z.ratio p.value
##  dormant edge / growing edge            0.603 0.678 Inf    1  -0.450  0.7531
##  dormant edge / dormant inside          0.876 0.391 Inf    1  -0.297  0.7668
##  dormant edge / growing inside          0.324 0.358 Inf    1  -1.020  0.5557
##  dormant edge / dormant outside         1.588 0.708 Inf    1   1.036  0.5557
##  dormant edge / growing outside         0.196 0.217 Inf    1  -1.472  0.4592
##  growing edge / dormant inside          1.452 1.660 Inf    1   0.327  0.7668
##  growing edge / growing inside          0.537 0.403 Inf    1  -0.828  0.5557
##  growing edge / dormant outside         2.632 2.970 Inf    1   0.859  0.5557
##  growing edge / growing outside         0.325 0.200 Inf    1  -1.825  0.4592
##  dormant inside / growing inside        0.370 0.407 Inf    1  -0.904  0.5557
##  dormant inside / dormant outside       1.812 0.810 Inf    1   1.330  0.4592
##  dormant inside / growing outside       0.224 0.249 Inf    1  -1.347  0.4592
##  growing inside / dormant outside       4.898 5.380 Inf    1   1.446  0.4592
##  growing inside / growing outside       0.605 0.414 Inf    1  -0.734  0.5786
##  dormant outside / growing outside      0.124 0.136 Inf    1  -1.898  0.4592
## 
## P value adjustment: fdr method for 15 tests 
## Tests are performed on the log odds ratio scale
cld(emm, adjust = "FDR", Letters = letters)
##  season  location response    SE  df asymp.LCL asymp.UCL .group
##  dormant outside     0.414 0.141 Inf     0.132     0.766  a    
##  dormant edge        0.528 0.146 Inf     0.193     0.840  a    
##  dormant inside      0.561 0.146 Inf     0.211     0.860  a    
##  growing edge        0.650 0.213 Inf     0.135     0.957  a    
##  growing inside      0.776 0.164 Inf     0.223     0.977  a    
##  growing outside     0.851 0.118 Inf     0.331     0.985  a    
## 
## Confidence level used: 0.95 
## Conf-level adjustment: bonferroni method for 6 estimates 
## Intervals are back-transformed from the logit scale 
## P value adjustment: fdr method for 15 tests 
## Tests are performed on the log odds ratio scale 
## significance level used: alpha = 0.05 
## NOTE: If two or more means share the same grouping symbol,
##       then we cannot show them to be different.
##       But we also did not show them to be the same.
sim_res <- simulateResiduals(model5)
plot(sim_res)
## Warning in newton(lsp = lsp, X = G$X, y = G$y, Eb = G$Eb, UrS = G$UrS, L = G$L,
## : Fitting terminated with step failure - check results carefully

testDispersion(sim_res)

## 
##  DHARMa nonparametric dispersion test via sd of residuals fitted vs.
##  simulated
## 
## data:  simulationOutput
## dispersion = 1.2106, p-value = 0.376
## alternative hypothesis: two.sided
testZeroInflation(sim_res)

## 
##  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
testOutliers(sim_res)

## 
##  DHARMa outlier test based on exact binomial test with approximate
##  expectations
## 
## data:  sim_res
## outliers at both margin(s) = 0, observations = 36, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.007968127
## 95 percent confidence interval:
##  0.00000000 0.09739376
## sample estimates:
## frequency of outliers (expected: 0.00796812749003984 ) 
##                                                      0
check_model(model5)
## `check_outliers()` does not yet support models of class `glmmTMB`.

model 5, same as above but with no max temp

chpt2_r_data$tree.scorch_prop <- chpt2_r_data$tree.scorch / 100
chpt2_r_data$tree.scorch_beta <- pmin(
  pmax(chpt2_r_data$tree.scorch_prop, 0.001),
  0.999
)

model5.1 <- glmmTMB(
  tree.scorch_beta ~ season * location + max.temp + (1 | patch) + (1 | block),
  data = chpt2_r_data,
  family = beta_family(link = "logit")
)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
summary(model5.1)
##  Family: beta  ( logit )
## Formula:          
## tree.scorch_beta ~ season * location + max.temp + (1 | patch) +  
##     (1 | block)
## Data: chpt2_r_data
## 
##       AIC       BIC    logLik -2*log(L)  df.resid 
##      -2.2      13.7      11.1     -22.2        26 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  patch  (Intercept) 0.3646   0.6038  
##  block  (Intercept) 0.4340   0.6588  
## Number of obs: 36, groups:  patch, 12; block, 4
## 
## Dispersion parameter for beta family (): 5.11 
## 
## Conditional model:
##                                Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                   -1.041253   1.018344  -1.022   0.3065  
## seasongrowing                  0.500746   1.053434   0.475   0.6345  
## locationinside                 0.199183   0.450830   0.442   0.6586  
## locationoutside               -0.314924   0.433852  -0.726   0.4679  
## max.temp                       0.001936   0.001414   1.369   0.1708  
## seasongrowing:locationinside   0.537207   0.839295   0.640   0.5221  
## seasongrowing:locationoutside  1.516843   0.762577   1.989   0.0467 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
emm <- emmeans(model5.1, ~ season * location, type = "response")
pairs(emm, adjust = "FDR")
##  contrast                          odds.ratio    SE  df null z.ratio p.value
##  dormant edge / growing edge            0.606 0.638 Inf    1  -0.475  0.7057
##  dormant edge / dormant inside          0.819 0.369 Inf    1  -0.442  0.7057
##  dormant edge / growing inside          0.290 0.299 Inf    1  -1.200  0.5340
##  dormant edge / dormant outside         1.370 0.594 Inf    1   0.726  0.6293
##  dormant edge / growing outside         0.182 0.189 Inf    1  -1.644  0.4524
##  growing edge / dormant inside          1.352 1.460 Inf    1   0.280  0.7795
##  growing edge / growing inside          0.479 0.358 Inf    1  -0.986  0.5405
##  growing edge / dormant outside         2.261 2.360 Inf    1   0.782  0.6293
##  growing edge / growing outside         0.301 0.186 Inf    1  -1.943  0.3903
##  dormant inside / growing inside        0.354 0.364 Inf    1  -1.010  0.5405
##  dormant inside / dormant outside       1.672 0.746 Inf    1   1.152  0.5340
##  dormant inside / growing outside       0.222 0.233 Inf    1  -1.437  0.4524
##  growing inside / dormant outside       4.721 4.870 Inf    1   1.505  0.4524
##  growing inside / growing outside       0.628 0.437 Inf    1  -0.669  0.6293
##  dormant outside / growing outside      0.133 0.137 Inf    1  -1.958  0.3903
## 
## P value adjustment: fdr method for 15 tests 
## Tests are performed on the log odds ratio scale
cld(emm, adjust = "FDR", Letters = letters)
##  season  location response    SE  df asymp.LCL asymp.UCL .group
##  dormant outside     0.434 0.133 Inf     0.155     0.762  a    
##  dormant edge        0.512 0.138 Inf     0.197     0.818  a    
##  dormant inside      0.562 0.138 Inf     0.226     0.849  a    
##  growing edge        0.634 0.203 Inf     0.147     0.946  a    
##  growing inside      0.784 0.150 Inf     0.261     0.974  a    
##  growing outside     0.852 0.109 Inf     0.369     0.983  a    
## 
## Confidence level used: 0.95 
## Conf-level adjustment: bonferroni method for 6 estimates 
## Intervals are back-transformed from the logit scale 
## P value adjustment: fdr method for 15 tests 
## Tests are performed on the log odds ratio scale 
## significance level used: alpha = 0.05 
## NOTE: If two or more means share the same grouping symbol,
##       then we cannot show them to be different.
##       But we also did not show them to be the same.
sim_res <- simulateResiduals(model5.1)
plot(sim_res)

testDispersion(sim_res)

## 
##  DHARMa nonparametric dispersion test via sd of residuals fitted vs.
##  simulated
## 
## data:  simulationOutput
## dispersion = 1.0622, p-value = 0.704
## alternative hypothesis: two.sided
testZeroInflation(sim_res)

## 
##  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
testOutliers(sim_res)

## 
##  DHARMa outlier test based on exact binomial test with approximate
##  expectations
## 
## data:  sim_res
## outliers at both margin(s) = 0, observations = 36, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.007968127
## 95 percent confidence interval:
##  0.00000000 0.09739376
## sample estimates:
## frequency of outliers (expected: 0.00796812749003984 ) 
##                                                      0
check_model(model5.1)
## `check_outliers()` does not yet support models of class `glmmTMB`.

Model 6: impacts on severity (char height), first order fire effect

model6 <- glmmTMB(
  tree.char ~ season * location + ros + max.temp + (1 | patch ) + (1 | block),
  data = chpt2_r_data,
  family = gaussian
)
summary(model6)
##  Family: gaussian  ( identity )
## Formula:          
## tree.char ~ season * location + ros + max.temp + (1 | patch) +      (1 | block)
## Data: chpt2_r_data
## 
##       AIC       BIC    logLik -2*log(L)  df.resid 
##     104.1     121.5     -41.0      82.1        25 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance  Std.Dev. 
##  patch    (Intercept) 2.990e-01 5.468e-01
##  block    (Intercept) 2.662e-10 1.632e-05
##  Residual             3.830e-01 6.188e-01
## Number of obs: 36, groups:  patch, 12; block, 4
## 
## Dispersion estimate for gaussian family (sigma^2): 0.383 
## 
## Conditional model:
##                                Estimate Std. Error z value Pr(>|z|)  
## (Intercept)                    1.483263   0.637565   2.326   0.0200 *
## seasongrowing                 -1.244890   0.564735  -2.204   0.0275 *
## locationinside                -0.064884   0.327828  -0.198   0.8431  
## locationoutside               -0.511361   0.326098  -1.568   0.1169  
## ros                           -1.334118   1.894395  -0.704   0.4813  
## max.temp                       0.001395   0.001016   1.374   0.1696  
## seasongrowing:locationinside   0.426288   0.568412   0.750   0.4533  
## seasongrowing:locationoutside  1.081040   0.555466   1.946   0.0516 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
emm <- emmeans(model6, ~ season * location, type = "response")
pairs(emm, adjust = "FDR")
##  contrast                          estimate    SE df t.ratio p.value
##  dormant edge - growing edge         1.2449 0.565 25   2.204  0.3814
##  dormant edge - dormant inside       0.0649 0.328 25   0.198  0.8447
##  dormant edge - growing inside       0.8835 0.521 25   1.696  0.3814
##  dormant edge - dormant outside      0.5114 0.326 25   1.568  0.3814
##  dormant edge - growing outside      0.6752 0.527 25   1.281  0.3814
##  growing edge - dormant inside      -1.1800 0.594 25  -1.985  0.3814
##  growing edge - growing inside      -0.3614 0.511 25  -0.708  0.6072
##  growing edge - dormant outside     -0.7335 0.566 25  -1.297  0.3814
##  growing edge - growing outside     -0.5697 0.462 25  -1.234  0.3814
##  dormant inside - growing inside     0.8186 0.510 25   1.604  0.3814
##  dormant inside - dormant outside    0.4465 0.316 25   1.413  0.3814
##  dormant inside - growing outside    0.6103 0.534 25   1.142  0.3963
##  growing inside - dormant outside   -0.3721 0.506 25  -0.735  0.6072
##  growing inside - growing outside   -0.2083 0.453 25  -0.460  0.7495
##  dormant outside - growing outside   0.1638 0.517 25   0.317  0.8080
## 
## P value adjustment: fdr method for 15 tests
cld(emm, adjust = "FDR", Letters = letters)
##  season  location emmean    SE df lower.CL upper.CL .group
##  growing edge      0.971 0.469 25   -0.374     2.32  a    
##  growing inside    1.332 0.417 25    0.137     2.53  a    
##  growing outside   1.540 0.422 25    0.330     2.75  a    
##  dormant outside   1.704 0.295 25    0.860     2.55  a    
##  dormant inside    2.151 0.305 25    1.276     3.03  a    
##  dormant edge      2.215 0.302 25    1.350     3.08  a    
## 
## Confidence level used: 0.95 
## Conf-level adjustment: bonferroni method for 6 estimates 
## P value adjustment: fdr method for 15 tests 
## significance level used: alpha = 0.05 
## NOTE: If two or more means share the same grouping symbol,
##       then we cannot show them to be different.
##       But we also did not show them to be the same.
sim_res <- simulateResiduals(model6)
plot(sim_res)

testDispersion(sim_res)

## 
##  DHARMa nonparametric dispersion test via sd of residuals fitted vs.
##  simulated
## 
## data:  simulationOutput
## dispersion = 1.0588, p-value = 0.768
## alternative hypothesis: two.sided
testZeroInflation(sim_res)

## 
##  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
testOutliers(sim_res)

## 
##  DHARMa outlier test based on exact binomial test with approximate
##  expectations
## 
## data:  sim_res
## outliers at both margin(s) = 1, observations = 36, p-value = 0.2502
## alternative hypothesis: true probability of success is not equal to 0.007968127
## 95 percent confidence interval:
##  0.0007030252 0.1452892647
## sample estimates:
## frequency of outliers (expected: 0.00796812749003984 ) 
##                                             0.02777778
check_model(model6)
## `check_outliers()` does not yet support models of class `glmmTMB`.

Model 6, same as above but with no interaction

model6.1 <- glmmTMB(
  tree.char ~ season + location + ros + max.temp + (1 | patch ) + (1 | block),
  data = chpt2_r_data,
  family = gaussian
)
summary(model6.1)
##  Family: gaussian  ( identity )
## Formula:          
## tree.char ~ season + location + ros + max.temp + (1 | patch) +      (1 | block)
## Data: chpt2_r_data
## 
##       AIC       BIC    logLik -2*log(L)  df.resid 
##     103.6     117.9     -42.8      85.6        27 
## 
## Random effects:
## 
## Conditional model:
##  Groups   Name        Variance  Std.Dev. 
##  patch    (Intercept) 2.554e-01 0.5053561
##  block    (Intercept) 3.960e-10 0.0000199
##  Residual             4.547e-01 0.6743317
## Number of obs: 36, groups:  patch, 12; block, 4
## 
## Dispersion estimate for gaussian family (sigma^2): 0.455 
## 
## Conditional model:
##                  Estimate Std. Error z value Pr(>|z|)  
## (Intercept)      1.065515   0.606655   1.756   0.0790 .
## seasongrowing   -0.671269   0.415960  -1.614   0.1066  
## locationinside   0.030617   0.317010   0.097   0.9231  
## locationoutside -0.158768   0.294083  -0.540   0.5893  
## ros             -1.058873   2.008341  -0.527   0.5980  
## max.temp         0.001810   0.001041   1.739   0.0821 .
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
emm <- emmeans(model6.1, ~ location, type = "response")
pairs(emm, adjust = "FDR")
##  contrast         estimate    SE df t.ratio p.value
##  edge - inside     -0.0306 0.317 27  -0.097  0.9238
##  edge - outside     0.1588 0.294 27   0.540  0.8906
##  inside - outside   0.1894 0.287 27   0.660  0.8906
## 
## Results are averaged over the levels of: season 
## P value adjustment: fdr method for 3 tests
cld(emm, adjust = "FDR", Letters = letters)
##  location emmean    SE df lower.CL upper.CL .group
##  outside    1.55 0.257 27    0.893      2.2  a    
##  edge       1.71 0.271 27    1.016      2.4  a    
##  inside     1.74 0.258 27    1.078      2.4  a    
## 
## Results are averaged over the levels of: season 
## Confidence level used: 0.95 
## Conf-level adjustment: bonferroni method for 3 estimates 
## P value adjustment: fdr method for 3 tests 
## significance level used: alpha = 0.05 
## NOTE: If two or more means share the same grouping symbol,
##       then we cannot show them to be different.
##       But we also did not show them to be the same.
sim_res <- simulateResiduals(model6)
plot(sim_res)

testDispersion(sim_res)

## 
##  DHARMa nonparametric dispersion test via sd of residuals fitted vs.
##  simulated
## 
## data:  simulationOutput
## dispersion = 1.0588, p-value = 0.768
## alternative hypothesis: two.sided
testZeroInflation(sim_res)

## 
##  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
testOutliers(sim_res)

## 
##  DHARMa outlier test based on exact binomial test with approximate
##  expectations
## 
## data:  sim_res
## outliers at both margin(s) = 1, observations = 36, p-value = 0.2502
## alternative hypothesis: true probability of success is not equal to 0.007968127
## 95 percent confidence interval:
##  0.0007030252 0.1452892647
## sample estimates:
## frequency of outliers (expected: 0.00796812749003984 ) 
##                                             0.02777778
check_model(model6)
## `check_outliers()` does not yet support models of class `glmmTMB`.

Model 7: impacts on delayed planted seedling mortality: 2nd order fire effect

mortality_data <- subset(chpt2_r_data, !is.na(mortality3))
mortality_data$mortality3_beta <- pmin(pmax(mortality_data$mortality3, 0.001), 0.999)


model7 <- glmmTMB(
  mortality3_beta ~ location + season + difn + ros + max.temp,
  data = mortality_data,
  family = beta_family(link = "logit")
)


summary(model7)
##  Family: beta  ( logit )
## Formula:          mortality3_beta ~ location + season + difn + ros + max.temp
## Data: mortality_data
## 
##       AIC       BIC    logLik -2*log(L)  df.resid 
##    -117.0    -105.6      66.5    -133.0        23 
## 
## 
## Dispersion parameter for beta family (): 0.951 
## 
## Conditional model:
##                   Estimate Std. Error z value Pr(>|z|)  
## (Intercept)     -1.344e+00  1.453e+00  -0.925    0.355  
## locationinside  -1.059e+00  6.151e-01  -1.722    0.085 .
## locationoutside -8.637e-01  5.933e-01  -1.456    0.145  
## seasongrowing   -5.969e-01  5.100e-01  -1.170    0.242  
## difn             1.654e-02  1.701e-02   0.973    0.331  
## ros             -1.316e+00  3.363e+00  -0.391    0.696  
## max.temp         3.856e-05  1.592e-03   0.024    0.981  
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#emmeans(model6, pairwise ~ location | season)

sim_res <- simulateResiduals(model7)
plot(sim_res)

testDispersion(sim_res)

## 
##  DHARMa nonparametric dispersion test via sd of residuals fitted vs.
##  simulated
## 
## data:  simulationOutput
## dispersion = 0.65463, p-value = 0.152
## alternative hypothesis: two.sided
testZeroInflation(sim_res)

## 
##  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
testOutliers(sim_res)

## 
##  DHARMa outlier test based on exact binomial test with approximate
##  expectations
## 
## data:  sim_res
## outliers at both margin(s) = 0, observations = 31, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.007968127
## 95 percent confidence interval:
##  0.0000000 0.1121887
## sample estimates:
## frequency of outliers (expected: 0.00796812749003984 ) 
##                                                      0
check_model(model7)
## `check_outliers()` does not yet support models of class `glmmTMB`.

model 9: planted seedling growth post fire, 2nd order fire effect

model9 <- glmmTMB(
  rcd20 ~ season + location + max.temp +
    + (1 | patch ) + (1 | block),
  data = chpt2_r_data,
     family = tweedie(link = "log")
)
## Warning in (function (start, objective, gradient = NULL, hessian = NULL, :
## NA/NaN function evaluation
summary(model9)
##  Family: tweedie  ( log )
## Formula:          
## rcd20 ~ season + location + max.temp + +(1 | patch) + (1 | block)
## Data: chpt2_r_data
## 
##       AIC       BIC    logLik -2*log(L)  df.resid 
##     139.5     151.8     -60.8     121.5        20 
## 
## Random effects:
## 
## Conditional model:
##  Groups Name        Variance Std.Dev.
##  patch  (Intercept) 0.06155  0.2481  
##  block  (Intercept) 1.90584  1.3805  
## Number of obs: 29, groups:  patch, 12; block, 4
## 
## Dispersion parameter for tweedie family (): 0.538 
## 
## Conditional model:
##                   Estimate Std. Error z value Pr(>|z|)  
## (Intercept)     -0.6701421  0.9493271  -0.706   0.4802  
## seasongrowing    1.1460729  1.6439544   0.697   0.4857  
## locationinside   0.0421320  0.2028110   0.208   0.8354  
## locationoutside  0.0281369  0.2036509   0.138   0.8901  
## max.temp         0.0012851  0.0005559   2.312   0.0208 *
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
#emmeans(model9, pairwise ~ location | season)

sim_res <- simulateResiduals(model9)
plot(sim_res)

testDispersion(sim_res)

## 
##  DHARMa nonparametric dispersion test via sd of residuals fitted vs.
##  simulated
## 
## data:  simulationOutput
## dispersion = 0.11097, p-value = 0.744
## alternative hypothesis: two.sided
testZeroInflation(sim_res)

## 
##  DHARMa zero-inflation test via comparison to expected zeros with
##  simulation under H0 = fitted model
## 
## data:  simulationOutput
## ratioObsSim = 0.53079, p-value = 0.816
## alternative hypothesis: two.sided
testOutliers(sim_res)

## 
##  DHARMa outlier test based on exact binomial test with approximate
##  expectations
## 
## data:  sim_res
## outliers at both margin(s) = 0, observations = 29, p-value = 1
## alternative hypothesis: true probability of success is not equal to 0.007968127
## 95 percent confidence interval:
##  0.0000000 0.1194449
## sample estimates:
## frequency of outliers (expected: 0.00796812749003984 ) 
##                                                      0
check_model(model9)
## `check_outliers()` does not yet support models of class `glmmTMB`.