For testing which would be the best approach I’m going to use the last sampling (week 16)
Difference in treatment groups and metacommunities
The variances in the groups are not homogen. This could be a problem.
Here are the distributions with different transformations
The original is not too bad, but the natural logarithmic and Box-Cox transformation looks good. For the Box-Cox transformation see: https://ourcodingclub.github.io/tutorials/data-scaling/ I just learnt about this, if we want to be safe we can use log, but I will test both.
Model where metacommunity is the random effect
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(alpha_div) ~ Treatment + (1 | Metacom_ID)
## Data: XI_mixmodel_df_euk
##
## REML criterion at convergence: 9.4
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.8890 -0.7380 0.2057 0.4700 2.0467
##
## Random effects:
## Groups Name Variance Std.Dev.
## Metacom_ID (Intercept) 0.01483 0.1218
## Residual 0.06026 0.2455
## Number of obs: 30, groups: Metacom_ID, 6
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 5.23209 0.09465 55.276
## Treatmentfragmented -0.32556 0.13386 -2.432
##
## Correlation of Fixed Effects:
## (Intr)
## Trtmntfrgmn -0.707
Model where the created “random” variable is the random effect
## Linear mixed model fit by REML ['lmerMod']
## Formula: log(alpha_div) ~ Treatment + (1 | random)
## Data: XI_mixmodel_df_euk
##
## REML criterion at convergence: 9.8
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.9567 -0.5866 0.1425 0.5163 2.2267
##
## Random effects:
## Groups Name Variance Std.Dev.
## random (Intercept) 0.009289 0.09638
## Residual 0.064215 0.25341
## Number of obs: 30, groups: random, 3
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 5.23209 0.08589 60.915
## Treatmentfragmented -0.32556 0.09253 -3.518
##
## Correlation of Fixed Effects:
## (Intr)
## Trtmntfrgmn -0.539
These look very similar.
I think that the created random variable makes the model fit better, so I will use that in the future.
## Linear mixed model fit by REML ['lmerMod']
## Formula: bc_alpha_div ~ Treatment + (1 | random)
## Data: XI_mixmodel_df_euk
##
## REML criterion at convergence: -285.9
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -2.1360 -0.6778 0.2648 0.5912 1.6128
##
## Random effects:
## Groups Name Variance Std.Dev.
## random (Intercept) 1.872e-07 0.0004326
## Residual 1.683e-06 0.0012973
## Number of obs: 30, groups: random, 3
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 0.9658885 0.0004178 2311.639
## Treatmentfragmented -0.0015457 0.0004737 -3.263
##
## Correlation of Fixed Effects:
## (Intr)
## Trtmntfrgmn -0.567
I honestly can’t tell which model fits better. Both transformations look good, maybe the regular log transformation is a bit better.
Just to have a comparison I will plot out the model with the original data
## Linear mixed model fit by REML ['lmerMod']
## Formula: alpha_div ~ Treatment + (1 | random)
## Data: XI_mixmodel_df_euk
##
## REML criterion at convergence: 304.6
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.65602 -0.43214 0.02219 0.42060 2.88716
##
## Random effects:
## Groups Name Variance Std.Dev.
## random (Intercept) 395.8 19.89
## Residual 2383.0 48.82
## Number of obs: 30, groups: random, 3
##
## Fixed effects:
## Estimate Std. Error t value
## (Intercept) 198.33 17.05 11.631
## Treatmentfragmented -62.07 17.83 -3.482
##
## Correlation of Fixed Effects:
## (Intr)
## Trtmntfrgmn -0.523
The model was created with the gamma distribution and log link function.
## Generalized linear mixed model fit by maximum likelihood (Laplace
## Approximation) [glmerMod]
## Family: Gamma ( log )
## Formula: alpha_div ~ Treatment + (1 | random)
## Data: XI_mixmodel_df_euk
##
## AIC BIC logLik deviance df.resid
## 316.1 321.7 -154.1 308.1 26
##
## Scaled residuals:
## Min 1Q Median 3Q Max
## -1.69715 -0.66305 0.03493 0.47611 2.83363
##
## Random effects:
## Groups Name Variance Std.Dev.
## random (Intercept) 0.005813 0.07624
## Residual 0.060734 0.24644
## Number of obs: 30, groups: random, 3
##
## Fixed effects:
## Estimate Std. Error t value Pr(>|z|)
## (Intercept) 5.27681 0.09420 56.016 < 2e-16 ***
## Treatmentfragmented -0.36219 0.08772 -4.129 3.65e-05 ***
## ---
## Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
##
## Correlation of Fixed Effects:
## (Intr)
## Trtmntfrgmn -0.468
This also fits just as good as the others.