## Loading required package: readxl
## Loading required package: lubridate
## 
## Attaching package: 'lubridate'
## The following objects are masked from 'package:data.table':
## 
##     hour, isoweek, mday, minute, month, quarter, second, wday, week,
##     yday, year
## The following objects are masked from 'package:base':
## 
##     date, intersect, setdiff, union
## Loading required package: solartime
## - Winter data excluded.
## - The counts of all passing / wintering species (not resident nor breeding in the sampled unit) were set to zero. Abreed_and_non_breed contains the non-breeders as well.

Herbaceous and Dwarf-Shrub Vegetation

Factors are proximity to agriculture (plantations and orchards) and time. Total 4 campaigns. 2 regions: herbaceous batha (grassland) and dwarf-shrub batha (low shrubland). 5 sites per region (10 sites total) with 6 plots per site (60 plots total). Raw data Total abundance: 14138 Number of observations: 3561 Total richness: 122

Filtered data Total abundance: 6741 Number of observations: 2521 Total richness: 57

Model gma, abundance and richness

Richness done with rare species. Abundance and mean abundance done without rare species. Full models include cosine and sine of the time difference from June 21st (in radians).

richness

Explore data and plot mean-variance plot. There is a strong relationship, indicating that employing GLMs is the proper way to analyze, rather than OLS (assumption of homogeneity is violated).

## [1] "RICHNESS WITH RARE SPECIES"
## ℹ SHA-1 hash of file is "eef55df1963ba201f57cf44513f566298756fd4f"
richness year_ct habitat site agriculture td_sc cos_td_rad sin_td_rad h_from_sunrise cos_hsun sin_hsun monitors_name wind precipitation temperature clouds
Min. : 1.000 Min. :2.0 Basalt :120 Batot Taninim :24 Far :120 Min. :-2.17579 Min. :-0.2498 Min. :-0.9995 Length:240 Min. :-0.1175 Min. :-0.1771 Other : 53 0 : 0 0 : 13 0 : 0 0 : 6
1st Qu.: 6.000 1st Qu.:3.5 Limestone:120 Gamla :24 Near:120 1st Qu.:-0.76251 1st Qu.: 0.3757 1st Qu.:-0.9267 Class :difftime 1st Qu.: 0.7043 1st Qu.: 0.2034 Eyal Shochat: 7 1 : 0 3 : 0 1 : 0 1 : 1
Median : 8.000 Median :5.0 NA Hatzor :24 NA Median :-0.51689 Median : 0.4758 Median :-0.8792 Mode :numeric Median : 0.8880 Median : 0.4598 Adi Domer : 0 2 : 0 NA’s:227 2 : 6 2 : 4
Mean : 8.108 Mean :5.0 NA Karei Deshe :24 NA Mean : 0.09807 Mean : 0.5626 Mean :-0.6066 NA Mean : 0.8063 Mean : 0.4517 Asaf Mayrose: 0 3 : 1 NA 3 : 0 3 : 0
3rd Qu.:10.000 3rd Qu.:6.5 NA Natur :24 NA 3rd Qu.: 1.11539 3rd Qu.: 0.9048 3rd Qu.:-0.3233 NA 3rd Qu.: 0.9791 3rd Qu.: 0.7099 Eliraz Dvir : 0 NA’s:239 NA NA’s:234 NA’s:229
Max. :16.000 Max. :8.0 NA Ramat Hashofet:24 NA Max. : 2.28504 Max. : 0.9905 Max. : 0.1882 NA Max. : 1.0000 Max. : 0.9998 (Other) : 0 NA NA NA NA
NA NA NA (Other) :96 NA NA NA NA NA NA’s :60 NA’s :60 NA’s :180 NA NA NA NA

no observation for all 4 weather variables. many NAs for sampling time of day variables. exclude from model.

## Warning in cor(P.anal[, lapply(X = .SD, FUN = as.numeric), .SDcols =
## IVs[1:12]], : the standard deviation is zero
richness year_ct habitat site agriculture td_sc cos_td_rad sin_td_rad h_from_sunrise cos_hsun sin_hsun monitors_name
richness 1.0000000 0.2277410 0.1538342 0.0664861 0.4137611 -0.2439739 -0.1946559 -0.2720706 -0.1340734 0.1471056 -0.1232836 0.1321602
year_ct 0.2277410 1.0000000 0.0000000 0.0000000 0.0000000 -0.7463144 -0.6558516 -0.7587452 -0.0861080 0.0846278 -0.0719069 NA
habitat 0.1538342 0.0000000 1.0000000 -0.0348155 0.0000000 -0.0427597 -0.0632391 -0.0406794 0.1656632 -0.1716399 0.1548456 0.2595871
site 0.0664861 0.0000000 -0.0348155 1.0000000 0.0000000 -0.0384624 -0.0368278 -0.0572513 -0.0170782 -0.0178346 -0.0435386 0.4247701
agriculture 0.4137611 0.0000000 0.0000000 0.0000000 1.0000000 -0.0030733 -0.0053199 -0.0014405 -0.0292304 0.0494225 -0.0202046 0.0519174
td_sc -0.2439739 -0.7463144 -0.0427597 -0.0384624 -0.0030733 1.0000000 0.9542304 0.9752788 -0.1904036 0.1801172 -0.1861300 -0.5897244
cos_td_rad -0.1946559 -0.6558516 -0.0632391 -0.0368278 -0.0053199 0.9542304 1.0000000 0.8674071 -0.1918124 0.1793379 -0.1892847 -0.5202428
sin_td_rad -0.2720706 -0.7587452 -0.0406794 -0.0572513 -0.0014405 0.9752788 0.8674071 1.0000000 -0.1677980 0.1708620 -0.1544942 -0.7612499
h_from_sunrise -0.1340734 -0.0861080 0.1656632 -0.0170782 -0.0292304 -0.1904036 -0.1918124 -0.1677980 1.0000000 -0.9486862 0.9809251 -0.0373316
cos_hsun 0.1471056 0.0846278 -0.1716399 -0.0178346 0.0494225 0.1801172 0.1793379 0.1708620 -0.9486862 1.0000000 -0.8726227 0.0445516
sin_hsun -0.1232836 -0.0719069 0.1548456 -0.0435386 -0.0202046 -0.1861300 -0.1892847 -0.1544942 0.9809251 -0.8726227 1.0000000 -0.0380718
monitors_name 0.1321602 NA 0.2595871 0.4247701 0.0519174 -0.5897244 -0.5202428 -0.7612499 -0.0373316 0.0445516 -0.0380718 1.0000000

Fit Poisson glm, check for existence of overdispersion

## [1] "Estimating overdispersion parameter phi: (Res. Dev.)/(n-p) where n=number of observations; p=number of parameters in the model."
## [1] "od = 0.967198263346182"

Overdispersion parameter is <1 (underdispersion) and therefore Poisson is preferable to negative binomial.

Observations 180 (60 missing obs. deleted)
Dependent variable richness
Type Generalized linear model
Family poisson
Link log
χ²(7) 58.03
Pseudo-R² (Cragg-Uhler) 0.28
Pseudo-R² (McFadden) 0.06
AIC 890.92
BIC 916.46
Est. S.E. z val. p
(Intercept) 0.79 0.55 1.43 0.15
agricultureNear 0.19 0.20 0.96 0.34
year_ct -0.00 0.02 -0.10 0.92
cos_td_rad 0.43 0.21 1.99 0.05
sin_td_rad -0.92 0.40 -2.33 0.02
cos_hsun 0.24 0.24 0.99 0.32
sin_hsun 0.03 0.17 0.15 0.88
agricultureNear:year_ct 0.03 0.03 0.85 0.39
Standard errors: MLE

cosine and sine of hours from sunrise - remove them because of many NAs.

## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: poisson  ( log )
## Formula: richness ~ agriculture * year_ct + cos_td_rad + sin_td_rad +  
##     (1 | habitat)
##    Data: P.anal
## 
##      AIC      BIC   logLik deviance df.resid 
##   1166.4   1190.7   -576.2   1152.4      233 
## 
## Scaled residuals: 
##      Min       1Q   Median       3Q      Max 
## -2.26707 -0.70417 -0.03776  0.56600  2.74584 
## 
## Random effects:
##  Groups  Name        Variance Std.Dev.
##  habitat (Intercept) 0.002287 0.04782 
## Number of obs: 240, groups:  habitat, 2
## 
## Fixed effects:
##                         Estimate Std. Error z value Pr(>|z|)    
## (Intercept)              1.62519    0.16271   9.988  < 2e-16 ***
## agricultureNear          0.14763    0.11840   1.247  0.21244    
## year_ct                 -0.01015    0.01957  -0.519  0.60393    
## cos_td_rad               0.22649    0.13994   1.618  0.10556    
## sin_td_rad              -0.34819    0.11766  -2.959  0.00308 ** 
## agricultureNear:year_ct  0.03398    0.02110   1.611  0.10727    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) agrclN yer_ct cs_td_ sn_td_
## agricultrNr -0.411                            
## year_ct     -0.422  0.582                     
## cos_td_rad  -0.809 -0.002 -0.023              
## sin_td_rad   0.581  0.019  0.391 -0.758       
## agrcltrNr:_  0.380 -0.922 -0.639  0.005 -0.022

Mixed model with site as random variable did not converge. Mixed model with habitat as random variable converged. perform stepwise model selection of poisson mixed model.

## Single term deletions
## 
## Model:
## richness ~ agriculture * year_ct + cos_td_rad + sin_td_rad + 
##     (1 | habitat)
##                     npar    AIC
## <none>                   1166.4
## cos_td_rad             1 1167.0
## sin_td_rad             1 1173.2
## agriculture:year_ct    1 1167.0

drop cosine.

## Single term deletions
## 
## Model:
## richness ~ agriculture * year_ct + sin_td_rad + (1 | habitat)
##                     npar    AIC
## <none>                   1167.0
## sin_td_rad             1 1172.0
## agriculture:year_ct    1 1167.6

drop agriculture : year.

## Single term deletions
## 
## Model:
## richness ~ agriculture + year_ct + sin_td_rad + (1 | habitat)
##             npar    AIC
## <none>           1167.6
## agriculture    1 1215.8
## year_ct        1 1166.1
## sin_td_rad     1 1172.5

drop year.

## Single term deletions
## 
## Model:
## richness ~ agriculture + sin_td_rad + (1 | habitat)
##             npar    AIC
## <none>           1166.1
## agriculture    1 1214.2
## sin_td_rad     1 1185.7

agriculture and time of year remain. Final model:

## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: poisson  ( log )
## Formula: richness ~ agriculture + sin_td_rad + (1 | habitat)
##    Data: P.anal
## 
##      AIC      BIC   logLik deviance df.resid 
##   1166.1   1180.0   -579.0   1158.1      236 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -2.4158 -0.7297 -0.0456  0.5709  2.7045 
## 
## Random effects:
##  Groups  Name        Variance Std.Dev.
##  habitat (Intercept) 0.001993 0.04464 
## Number of obs: 240, groups:  habitat, 2
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      1.76597    0.05832  30.280  < 2e-16 ***
## agricultureNear  0.32310    0.04593   7.035 1.99e-12 ***
## sin_td_rad      -0.23971    0.05263  -4.554 5.25e-06 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) agrclN
## agricultrNr -0.456       
## sin_td_rad   0.589  0.002
## $habitat
##           (Intercept)
## Basalt    -0.03602694
## Limestone  0.03647298
## 
## with conditional variances for "habitat"
## $habitat

## Registered S3 methods overwritten by 'broom':
##   method            from  
##   tidy.glht         jtools
##   tidy.summary.glht jtools
Observations 240
Dependent variable richness
Type Mixed effects generalized linear model
Family poisson
Link log
AIC 1166.057
BIC 1179.980
Pseudo-R² (fixed effects) 0.244
Pseudo-R² (total) 0.257
Fixed Effects
exp(Est.) S.E. z val. p
(Intercept) 5.847 0.058 30.280 0.000
agricultureNear 1.381 0.046 7.035 0.000
sin_td_rad 0.787 0.053 -4.554 0.000
Random Effects
Group Parameter Std. Dev.
habitat (Intercept) 0.045
Grouping Variables
Group # groups ICC
habitat 2 0.002
## Confidence intervals for merMod models is an experimental feature. The
## intervals reflect only the variance of the fixed effects, not the random
## effects.

There is a statistically significant effect for proximity to agriculture.

Near plots have on average 2.5792208 more species than far plots, which is 38.1407177 percent higher.

No statistically significant effect for the other factors tested.

geometric mean of abundance

Explore data. Exclude time of day because of high number of NAs.

## [1] "GEOMETRIC MEAN ABUNDANCE WITHOUT RARE SPECIES"
gma year_ct habitat site agriculture td_sc cos_td_rad sin_td_rad
Min. :1.072 Min. :2.0 Basalt :120 Batot Taninim :24 Far :120 Min. :-2.17579 Min. :-0.2498 Min. :-0.9995
1st Qu.:2.000 1st Qu.:3.5 Limestone:120 Gamla :24 Near:120 1st Qu.:-0.76251 1st Qu.: 0.3757 1st Qu.:-0.9267
Median :2.465 Median :5.0 NA Hatzor :24 NA Median :-0.51689 Median : 0.4758 Median :-0.8792
Mean :2.683 Mean :5.0 NA Karei Deshe :24 NA Mean : 0.09807 Mean : 0.5626 Mean :-0.6066
3rd Qu.:3.014 3rd Qu.:6.5 NA Natur :24 NA 3rd Qu.: 1.11539 3rd Qu.: 0.9048 3rd Qu.:-0.3233
Max. :8.367 Max. :8.0 NA Ramat Hashofet:24 NA Max. : 2.28504 Max. : 0.9905 Max. : 0.1882
NA NA NA (Other) :96 NA NA NA NA

Fit glm, compare gamma, gaussian (poisson inappropriate because response is not discrete)

Gamma seems better than gaussian. Fit fixed and mixed models.

## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.00342479 (tol = 0.002, component 1)

Mixed model with site as random variable did not converge. Mixed model with habitat as random variable converged:

## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: Gamma  ( inverse )
## Formula: gma ~ agriculture * year_ct + cos_td_rad + sin_td_rad + (1 |  
##     habitat)
##    Data: P.anal
## 
##      AIC      BIC   logLik deviance df.resid 
##    596.1    623.8   -290.0    580.1      230 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.6410 -0.6505 -0.1671  0.4522  4.3563 
## 
## Random effects:
##  Groups   Name        Variance  Std.Dev.
##  habitat  (Intercept) 0.0008619 0.02936 
##  Residual             0.1203319 0.34689 
## Number of obs: 238, groups:  habitat, 2
## 
## Fixed effects:
##                          Estimate Std. Error t value Pr(>|z|)    
## (Intercept)              0.358281   0.069384   5.164 2.42e-07 ***
## agricultureNear         -0.012325   0.040567  -0.304    0.761    
## year_ct                  0.026391   0.006516   4.050 5.11e-05 ***
## cos_td_rad               0.002725   0.046505   0.059    0.953    
## sin_td_rad               0.186770   0.037079   5.037 4.73e-07 ***
## agricultureNear:year_ct  0.007124   0.007563   0.942    0.346    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) agrclN yer_ct cs_td_ sn_td_
## agricultrNr -0.289                            
## year_ct     -0.419  0.499                     
## cos_td_rad  -0.679  0.007  0.167              
## sin_td_rad   0.470 -0.032  0.298 -0.697       
## agrcltrNr:_  0.266 -0.929 -0.529 -0.007  0.032
## optimizer (Nelder_Mead) convergence code: 0 (OK)
## Model failed to converge with max|grad| = 0.00342479 (tol = 0.002, component 1)

perform stepwise model selection of Gamma model.

## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.00412004 (tol = 0.002, component 1)
## Single term deletions
## 
## Model:
## gma ~ agriculture * year_ct + cos_td_rad + sin_td_rad + (1 | 
##     habitat)
##                     npar    AIC
## <none>                   596.07
## cos_td_rad             1 594.07
## sin_td_rad             1 618.99
## agriculture:year_ct    1 594.95

drop cosine.

## Warning in checkConv(attr(opt, "derivs"), opt$par, ctrl = control$checkConv, :
## Model failed to converge with max|grad| = 0.00412004 (tol = 0.002, component 1)
## Single term deletions
## 
## Model:
## gma ~ agriculture * year_ct + sin_td_rad + (1 | habitat)
##                     npar    AIC
## <none>                   594.07
## sin_td_rad             1 638.35
## agriculture:year_ct    1 592.96

drop agriculture : year.

## Single term deletions
## 
## Model:
## gma ~ agriculture + year_ct + sin_td_rad + (1 | habitat)
##             npar    AIC
## <none>           592.96
## agriculture    1 593.32
## year_ct        1 619.93
## sin_td_rad     1 636.87

drop distance from agriculture

## Single term deletions
## 
## Model:
## gma ~ year_ct + sin_td_rad + (1 | habitat)
##            npar    AIC
## <none>          593.32
## year_ct       1 619.99
## sin_td_rad    1 636.90

year and sampling-time-of-year remain. This is the final model:

## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: Gamma  ( inverse )
## Formula: gma ~ year_ct + sin_td_rad + (1 | habitat)
##    Data: P.anal
## 
##      AIC      BIC   logLik deviance df.resid 
##    593.3    610.7   -291.7    583.3      233 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.5605 -0.6313 -0.2148  0.4428  4.4426 
## 
## Random effects:
##  Groups   Name        Variance  Std.Dev.
##  habitat  (Intercept) 0.0008809 0.02968 
##  Residual             0.1239210 0.35202 
## Number of obs: 238, groups:  habitat, 2
## 
## Fixed effects:
##             Estimate Std. Error t value Pr(>|z|)    
## (Intercept) 0.355511   0.046982   7.567 3.82e-14 ***
## year_ct     0.029617   0.005462   5.422 5.89e-08 ***
## sin_td_rad  0.187937   0.026769   7.021 2.21e-12 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##            (Intr) yer_ct
## year_ct    -0.295       
## sin_td_rad -0.021  0.718
## $habitat
##           (Intercept)
## Basalt    -0.04700188
## Limestone  0.03723469
## 
## with conditional variances for "habitat"
## $habitat

Observations 238
Dependent variable gma
Type Mixed effects generalized linear model
Family Gamma
Link inverse
AIC 593.318
BIC 610.680
Pseudo-R² (fixed effects) NA
Pseudo-R² (total) NA
Fixed Effects
Est. S.E. t val. p
(Intercept) 0.356 0.047 7.567 0.000
year_ct 0.030 0.005 5.422 0.000
sin_td_rad 0.188 0.027 7.021 0.000
Random Effects
Group Parameter Std. Dev.
habitat (Intercept) 0.030
Residual 0.352
Grouping Variables
Group # groups ICC
habitat 2 0.007
## Confidence intervals for merMod models is an experimental feature. The
## intervals reflect only the variance of the fixed effects, not the random
## effects.

## Confidence intervals for merMod models is an experimental feature. The
## intervals reflect only the variance of the fixed effects, not the random
## effects.

significant temporal decrease in gma. No effect found for distance from agriculture.

GMA is decreasing on average in 0.2065628 individuals per species per year.

abundance

Explore data

## [1] "ABUNDANCE WITHOUT RARE SPECIES"
abundance year_ct habitat site agriculture td_sc cos_td_rad sin_td_rad
Min. : 3.00 Min. :2.0 Basalt :120 Batot Taninim :24 Far :120 Min. :-2.17579 Min. :-0.2498 Min. :-0.9995
1st Qu.:15.00 1st Qu.:3.5 Limestone:120 Gamla :24 Near:120 1st Qu.:-0.76251 1st Qu.: 0.3757 1st Qu.:-0.9267
Median :23.00 Median :5.0 NA Hatzor :24 NA Median :-0.51689 Median : 0.4758 Median :-0.8792
Mean :26.25 Mean :5.0 NA Karei Deshe :24 NA Mean : 0.09807 Mean : 0.5626 Mean :-0.6066
3rd Qu.:35.00 3rd Qu.:6.5 NA Natur :24 NA 3rd Qu.: 1.11539 3rd Qu.: 0.9048 3rd Qu.:-0.3233
Max. :82.00 Max. :8.0 NA Ramat Hashofet:24 NA Max. : 2.28504 Max. : 0.9905 Max. : 0.1882
NA NA NA (Other) :96 NA NA NA NA

PHI>1, hence choose negative binomial. Fit fixed and mixed models. Choose mixed model if possible, otherwise choose a model with fixed-effects only.

Mixed model converged:

## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: Negative Binomial(5.6356)  ( log )
## Formula: abundance ~ agriculture * year_ct + cos_td_rad + sin_td_rad +  
##     (1 | habitat)
##    Data: P.anal
## 
##      AIC      BIC   logLik deviance df.resid 
##   1850.6   1878.5   -917.3   1834.6      232 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.8794 -0.7330 -0.1364  0.5294  4.6896 
## 
## Random effects:
##  Groups  Name        Variance Std.Dev.
##  habitat (Intercept) 0.005891 0.07675 
## Number of obs: 240, groups:  habitat, 2
## 
## Fixed effects:
##                         Estimate Std. Error z value Pr(>|z|)    
## (Intercept)              2.98398    0.20800  14.346  < 2e-16 ***
## agricultureNear          0.27315    0.15007   1.820   0.0687 .  
## year_ct                 -0.09937    0.02495  -3.983 6.80e-05 ***
## cos_td_rad               0.07756    0.17278   0.449   0.6535    
## sin_td_rad              -0.88290    0.14375  -6.142 8.16e-10 ***
## agricultureNear:year_ct  0.00714    0.02729   0.262   0.7936    
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) agrclN yer_ct cs_td_ sn_td_
## agricultrNr -0.377                            
## year_ct     -0.477  0.517                     
## cos_td_rad  -0.813  0.008  0.082              
## sin_td_rad   0.523 -0.001  0.383 -0.701       
## agrcltrNr:_  0.339 -0.915 -0.562 -0.002 -0.001

Perform stepwise model selection of mixed model.

## Single term deletions
## 
## Model:
## abundance ~ agriculture * year_ct + cos_td_rad + sin_td_rad + 
##     (1 | habitat)
##                     npar    AIC
## <none>                   1850.6
## cos_td_rad             1 1848.8
## sin_td_rad             1 1885.8
## agriculture:year_ct    1 1848.7

drop agriculture : year.

## Single term deletions
## 
## Model:
## abundance ~ agriculture + year_ct + cos_td_rad + sin_td_rad + 
##     (1 | habitat)
##             npar    AIC
## <none>           1848.7
## agriculture    1 1872.8
## year_ct        1 1867.8
## cos_td_rad     1 1846.9
## sin_td_rad     1 1883.8

drop cosine.

## Single term deletions
## 
## Model:
## abundance ~ agriculture + year_ct + sin_td_rad + (1 | habitat)
##             npar    AIC
## <none>           1846.9
## agriculture    1 1870.9
## year_ct        1 1866.8
## sin_td_rad     1 1911.6

agriculture, year and sampling time of year remain. The final model:

## Generalized linear mixed model fit by maximum likelihood (Laplace
##   Approximation) [glmerMod]
##  Family: Negative Binomial(5.627)  ( log )
## Formula: abundance ~ agriculture + year_ct + sin_td_rad + (1 | habitat)
##    Data: P.anal
## 
##      AIC      BIC   logLik deviance df.resid 
##   1846.9   1867.8   -917.4   1834.9      234 
## 
## Scaled residuals: 
##     Min      1Q  Median      3Q     Max 
## -1.8915 -0.7491 -0.1417  0.5098  4.5994 
## 
## Random effects:
##  Groups  Name        Variance Std.Dev.
##  habitat (Intercept) 0.005933 0.07703 
## Number of obs: 240, groups:  habitat, 2
## 
## Fixed effects:
##                 Estimate Std. Error z value Pr(>|z|)    
## (Intercept)      3.04140    0.09867  30.823  < 2e-16 ***
## agricultureNear  0.30863    0.06041   5.109 3.24e-07 ***
## year_ct         -0.09659    0.02051  -4.708 2.50e-06 ***
## sin_td_rad      -0.83754    0.10255  -8.167 3.16e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Correlation of Fixed Effects:
##             (Intr) agrclN yer_ct
## agricultrNr -0.313              
## year_ct     -0.563  0.003       
## sin_td_rad  -0.132  0.008  0.746
## $habitat
##           (Intercept)
## Basalt     0.06745415
## Limestone -0.06726207
## 
## with conditional variances for "habitat"
## $habitat

Interpretation of abundance model:

Observations 240
Dependent variable abundance
Type Mixed effects generalized linear model
Family Negative Binomial(5.627)
Link log
AIC 1846.887
BIC 1867.771
Pseudo-R² (fixed effects) 0.680
Pseudo-R² (total) 0.723
Fixed Effects
exp(Est.) S.E. z val. p
(Intercept) 20.935 0.099 30.823 0.000
agricultureNear 1.362 0.060 5.109 0.000
year_ct 0.908 0.021 -4.708 0.000
sin_td_rad 0.433 0.103 -8.167 0.000
Random Effects
Group Parameter Std. Dev.
habitat (Intercept) 0.077
Grouping Variables
Group # groups ICC
habitat 2 0.026
## Confidence intervals for merMod models is an experimental feature. The
## intervals reflect only the variance of the fixed effects, not the random
## effects.

## Confidence intervals for merMod models is an experimental feature. The
## intervals reflect only the variance of the fixed effects, not the random
## effects.

## Confidence intervals for merMod models is an experimental feature. The
## intervals reflect only the variance of the fixed effects, not the random
## effects.

Significant higher abundance near agriculture, and overall decrease in total abundance

Near plots have on average 7.7613477 more individuals than far plots, which is 36.1552262 percent higher.

On average, total abundance decreases 2.1025166 individuals per year.

community analysis using package MVabund

## Overlapping points were shifted along the y-axis to make them visible.
## 
##  PIPING TO 2nd MVFACTOR
## Only the variables Galerida.cristata, Streptopelia.decaocto, Curruca.melanocephala, Carduelis.carduelis, Pycnonotus.xanthopygos, Emberiza.calandra, Prinia.gracilis, Passer.domesticus, Alectoris.chukar, Chloris.chloris, Corvus.cornix, Parus.major were included in the plot 
## (the variables with highest total abundance).

start model specification:

##       nb       po 
## 462.6697 685.9955
## [1] "POISSON"

## [1] "NEGATIVE BINOMIAL"

negative binomial model is better than poisson according to residuals and AIC comparison.

##       nb       po      nb1      nb2 
## 462.6697 685.9955 430.8902 450.6422

The addition of the explanatory variable ‘site’ is improving the AIC of the model the most. stepwise selection of model:

## Single term deletions
## 
## Model:
## spp_no_rare ~ agriculture * year_ct + cos_td_rad + sin_td_rad + 
##     site
##                      Df   AIC
## <none>                  13358
## cos_td_rad           31 13373
## sin_td_rad           31 13453
## site                279 14343
## agriculture:year_ct  31 13327

drop agriculture:year

## Single term deletions
## 
## Model:
## spp_no_rare ~ agriculture + year_ct + cos_td_rad + sin_td_rad + 
##     site
##              Df   AIC
## <none>          13327
## agriculture  31 13526
## year_ct      31 13331
## cos_td_rad   31 13347
## sin_td_rad   31 13426
## site        279 14305

final model includes agriculture, year, sampling time of year and site.

## 
## Test statistics:
##                    wald value Pr(>wald)    
## (Intercept)            10.144     0.001 ***
## agricultureNear        17.030     0.001 ***
## year_ct                 8.740     0.001 ***
## cos_td_rad              8.960     0.002 ** 
## sin_td_rad             12.608     0.001 ***
## siteGamla              10.016     0.001 ***
## siteHatzor             10.675     0.001 ***
## siteKarei Deshe         8.592     0.001 ***
## siteNatur              10.064     0.001 ***
## siteRamat Hashofet      9.798     0.001 ***
## siteSde Eliezer        12.411     0.001 ***
## siteShaal              10.103     0.001 ***
## siteYavneel            10.584     0.001 ***
## siteYiron              11.603     0.001 ***
## --- 
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 
## 
## Test statistic:  40.34, p-value: 0.001 
## Arguments:
##  Test statistics calculated assuming response assumed to be uncorrelated 
##  P-value calculated using 999 resampling iterations via pit.trap resampling (to account for correlation in testing).
## Analysis of Deviance Table
## 
## Model: spp_no_rare ~ agriculture + year_ct + cos_td_rad + sin_td_rad + site
## 
## Multivariate test:
##             Res.Df Df.diff    Dev Pr(>Dev)   
## (Intercept)    239                           
## agriculture    238       1  150.1     0.01 **
## year_ct        237       1   84.4     0.01 **
## cos_td_rad     236       1  136.0     0.01 **
## sin_td_rad     235       1  165.3     0.01 **
## site           226       9 1535.6     0.01 **
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Univariate Tests:
##             Alectoris.chukar          Burhinus.oedicnemus         
##                          Dev Pr(>Dev)                 Dev Pr(>Dev)
## (Intercept)                                                       
## agriculture            0.467     1.00               0.708     1.00
## year_ct                1.128     1.00               0.143     1.00
## cos_td_rad             0.224     0.97               0.699     0.97
## sin_td_rad             3.683     0.71               0.704     1.00
## site                   50.77     0.01              22.157     0.10
##             Carduelis.carduelis          Cecropis.daurica          Cettia.cetti
##                             Dev Pr(>Dev)              Dev Pr(>Dev)          Dev
## (Intercept)                                                                    
## agriculture               0.802     1.00            1.137     0.97        2.871
## year_ct                   0.644     1.00             2.66     0.91        3.083
## cos_td_rad                0.436     0.97            1.586     0.95       14.062
## sin_td_rad                0.028     1.00            0.947     1.00        2.469
## site                     51.057     0.01            16.71     0.13       59.697
##                      Chloris.chloris          Cinnyris.osea         
##             Pr(>Dev)             Dev Pr(>Dev)           Dev Pr(>Dev)
## (Intercept)                                                         
## agriculture     0.84          35.448     0.01          4.29     0.56
## year_ct         0.77           0.182     1.00          0.29     1.00
## cos_td_rad      0.02           1.331     0.95         6.775     0.29
## sin_td_rad      0.86           3.212     0.84          6.23     0.25
## site            0.01          47.492     0.01        74.209     0.01
##             Cisticola.juncidis          Clamator.glandarius         
##                            Dev Pr(>Dev)                 Dev Pr(>Dev)
## (Intercept)                                                         
## agriculture              0.009     1.00               0.011     1.00
## year_ct                  6.504     0.16               0.854     1.00
## cos_td_rad               1.613     0.95               1.387     0.95
## sin_td_rad               0.229     1.00                0.94     1.00
## site                    32.302     0.01              29.807     0.02
##             Corvus.cornix          Curruca.communis          Curruca.curruca
##                       Dev Pr(>Dev)              Dev Pr(>Dev)             Dev
## (Intercept)                                                                 
## agriculture         3.995     0.62            0.005     1.00           0.539
## year_ct              0.21     1.00            6.235     0.18           8.487
## cos_td_rad           5.43     0.42           18.584     0.01          10.165
## sin_td_rad          0.673     1.00           22.056     0.01          20.143
## site               36.927     0.01           39.874     0.01          23.408
##                      Curruca.melanocephala          Dendrocopos.syriacus
##             Pr(>Dev)                   Dev Pr(>Dev)                  Dev
## (Intercept)                                                             
## agriculture     1.00                 2.748     0.87                0.311
## year_ct         0.07                 0.082     1.00                0.099
## cos_td_rad      0.05                19.653     0.01                0.732
## sin_td_rad      0.01                 8.936     0.11                0.001
## site            0.09               162.311     0.01               53.462
##                      Emberiza.calandra          Falco.naumanni         
##             Pr(>Dev)               Dev Pr(>Dev)            Dev Pr(>Dev)
## (Intercept)                                                            
## agriculture     1.00             1.887     0.92          0.306     1.00
## year_ct         1.00             7.956     0.07          2.252     0.93
## cos_td_rad      0.97             3.526     0.70          0.726     0.97
## sin_td_rad      1.00             8.345     0.11          0.184     1.00
## site            0.01            61.528     0.01         57.733     0.01
##             Falco.tinnunculus          Galerida.cristata         
##                           Dev Pr(>Dev)               Dev Pr(>Dev)
## (Intercept)                                                      
## agriculture             0.451     1.00            16.671     0.01
## year_ct                 1.158     1.00             2.965     0.81
## cos_td_rad              0.087     0.97             0.171     0.97
## sin_td_rad              5.597     0.39            16.318     0.01
## site                   32.451     0.01            98.456     0.01
##             Garrulus.glandarius          Hirundo.rustica         
##                             Dev Pr(>Dev)             Dev Pr(>Dev)
## (Intercept)                                                      
## agriculture               5.943     0.27           0.768     1.00
## year_ct                   1.034     1.00           0.423     1.00
## cos_td_rad                3.434     0.70           7.003     0.25
## sin_td_rad                1.344     0.98           0.234     1.00
## site                      60.46     0.01          18.257     0.13
##             Lanius.senator          Linaria.cannabina          Parus.major
##                        Dev Pr(>Dev)               Dev Pr(>Dev)         Dev
## (Intercept)                                                               
## agriculture          0.147     1.00             1.433     0.95       5.211
## year_ct             16.679     0.01             0.021     1.00       6.291
## cos_td_rad            6.29     0.34             3.979     0.63       4.484
## sin_td_rad           0.745     1.00             2.361     0.86       9.573
## site                23.892     0.06            27.576     0.02      68.967
##                      Passer.domesticus          Prinia.gracilis         
##             Pr(>Dev)               Dev Pr(>Dev)             Dev Pr(>Dev)
## (Intercept)                                                             
## agriculture     0.41             3.757     0.65           7.265     0.15
## year_ct         0.18             5.265     0.33           0.548     1.00
## cos_td_rad      0.59             0.814     0.96           0.797     0.97
## sin_td_rad      0.11             8.425     0.11            4.38     0.58
## site            0.01            66.086     0.01          68.361     0.01
##             Psittacula.krameri          Pycnonotus.xanthopygos         
##                            Dev Pr(>Dev)                    Dev Pr(>Dev)
## (Intercept)                                                            
## agriculture              2.416     0.90                 30.215     0.01
## year_ct                  1.202     1.00                  1.157     1.00
## cos_td_rad               1.721     0.94                  0.021     0.97
## sin_td_rad                2.75     0.85                  7.306     0.17
## site                    40.069     0.01                 56.799     0.01
##             Streptopelia.decaocto          Streptopelia.turtur         
##                               Dev Pr(>Dev)                 Dev Pr(>Dev)
## (Intercept)                                                            
## agriculture                10.294     0.04               1.876     0.92
## year_ct                     0.697     1.00               0.203     1.00
## cos_td_rad                   1.35     0.95               7.086     0.25
## sin_td_rad                  9.246     0.11               9.263     0.11
## site                       42.477     0.01               26.85     0.02
##             Turdus.merula          Vanellus.spinosus         
##                       Dev Pr(>Dev)               Dev Pr(>Dev)
## (Intercept)                                                  
## agriculture         7.219     0.15             0.932     1.00
## year_ct              5.73     0.26              0.21     1.00
## cos_td_rad          9.661     0.06             2.184     0.88
## sin_td_rad          6.885     0.20             2.078     0.87
## site               53.565     0.01            31.887     0.01
## Arguments:
##  Test statistics calculated assuming uncorrelated response (for faster computation) 
## P-value calculated using 99 iterations via PIT-trap resampling.

All factors (agriculture, year, time of year and site) have a statistically significant effect on community composition.

## Warning: Using `size` aesthetic for lines was deprecated in ggplot2 3.4.0.
## ℹ Please use `linewidth` instead.
## This warning is displayed once every 8 hours.
## Call `lifecycle::last_lifecycle_warnings()` to see where this warning was
## generated.
## [[1]]

## 
## [[2]]

## 
## [[3]]

## [[1]]

## 
## [[2]]

## 
## [[3]]

Significant effect of plantation agriculture proximity: synanthrope / invasive species near agriculture. Most species showing negative coefs, consistent with overall decrease in gma and total abundance.

Significant negative temporal effect on corn bunting and lesser whitethroat (but see species-specific plots below). Positive significant trend for woodchat shrike, but the magnitude is very small.

Worth noting that the following have consistent results across several units:

crested lark, negative, in Sfar and Batha. lesser whitethroat, negative, in Batha and Maquis. house sparrow, negative, in Sfar, Batha and Maquis. red-rumped swallow, positive, in sfar, batha and maquis. palestine sunbird, negative, in sfar, batha and maquis. goldfinch, negative, in maquis and batha.

Below plots for crested lark, lesser whitethroat, house sparrow and corn bunting

## [1] "Galerida cristata"
## [1] "manyglm coefficients"
##        (Intercept)    agricultureNear            year_ct         cos_td_rad 
##          0.1520779         -0.7592007         -0.0731277          0.7692822 
##         sin_td_rad          siteGamla         siteHatzor    siteKarei Deshe 
##         -1.8545331          0.9115167         -1.0991985          0.3222154 
##          siteNatur siteRamat Hashofet    siteSde Eliezer          siteShaal 
##          1.1731718         -0.6210582         -1.0092375          0.7693465 
##        siteYavneel          siteYiron 
##         -0.9695270         -1.4923494
## [1] "species-specific glm"
##        (Intercept)    agricultureNear            year_ct         cos_td_rad 
##         0.15208103        -0.75920009        -0.07312734         0.76927779 
##         sin_td_rad          siteGamla         siteHatzor    siteKarei Deshe 
##        -1.85452759         0.91151810        -1.09919768         0.32221281 
##          siteNatur siteRamat Hashofet    siteSde Eliezer          siteShaal 
##         1.17317199        -0.62105611        -1.00923659         0.76934814 
##        siteYavneel          siteYiron 
##        -0.96952666        -1.49234746

## [1] "Curruca curruca"
## [1] "manyglm coefficients"
##        (Intercept)    agricultureNear            year_ct         cos_td_rad 
##       -20.49734676         0.42482008        -0.02686165        -0.63045292 
##         sin_td_rad          siteGamla         siteHatzor    siteKarei Deshe 
##       -19.82445963        -7.88455397         0.48323713       -10.31007440 
##          siteNatur siteRamat Hashofet    siteSde Eliezer          siteShaal 
##         1.33424086        -0.42614332         2.19018775         2.26385067 
##        siteYavneel          siteYiron 
##         0.48153107         2.33172040
## [1] "species-specific glm"
##        (Intercept)    agricultureNear            year_ct         cos_td_rad 
##       -20.61839642         0.42474006        -0.02702414        -0.59991852 
##         sin_td_rad         siteHatzor          siteNatur siteRamat Hashofet 
##       -19.94699265         0.48019463         1.33292357        -0.42619501 
##    siteSde Eliezer          siteShaal        siteYavneel          siteYiron 
##         2.18798032         2.26154006         0.47795899         2.32960699

## [1] "Passer domesticus"
## [1] "manyglm coefficients"
##        (Intercept)    agricultureNear            year_ct         cos_td_rad 
##       -19.96014323         1.49241185        -0.49805791         7.54082785 
##         sin_td_rad          siteGamla         siteHatzor    siteKarei Deshe 
##        -5.04075189        15.35464525        12.31878831        13.37700418 
##          siteNatur siteRamat Hashofet    siteSde Eliezer          siteShaal 
##        14.42194958        -0.07832843        -0.76381509        12.72438970 
##        siteYavneel          siteYiron 
##        15.22977429        -0.55955882
## [1] "species-specific glm"
##     (Intercept) agricultureNear         year_ct      cos_td_rad      sin_td_rad 
##      -4.6055325       1.4924224      -0.4980637       7.5408654      -5.0407946 
##      siteHatzor siteKarei Deshe       siteNatur       siteShaal     siteYavneel 
##      -3.0358365      -1.9776337      -0.9326851      -2.6302507      -0.1248692

## [1] "Emberiza calandra"
## [1] "manyglm coefficients"
##        (Intercept)    agricultureNear            year_ct         cos_td_rad 
##        -0.64160316        -0.79613036        -0.05601435        -1.19122249 
##         sin_td_rad          siteGamla         siteHatzor    siteKarei Deshe 
##        -1.42714754         1.96787355       -13.54797201         0.28693655 
##          siteNatur siteRamat Hashofet    siteSde Eliezer          siteShaal 
##         1.51812736         1.57155269        -1.22080035         2.18924457 
##        siteYavneel          siteYiron 
##         1.53390365        -1.53045976
## [1] "species-specific glm"
##        (Intercept)    agricultureNear            year_ct         cos_td_rad 
##        -0.64165224        -0.79611605        -0.05601625        -1.19120333 
##         sin_td_rad          siteGamla    siteKarei Deshe          siteNatur 
##        -1.42719124         1.96789227         0.28694631         1.51814160 
## siteRamat Hashofet    siteSde Eliezer          siteShaal        siteYavneel 
##         1.57155713        -1.22078848         2.18926918         1.53392503 
##          siteYiron 
##        -1.53044741

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge

## Warning: glm.fit: algorithm did not converge
## Warning in glm.nb(formula = Linaria.cannabina ~ agriculture + year_ct + :
## alternation limit reached
## [1] "Linaria cannabina"
## [1] "manyglm coefficients"
##        (Intercept)    agricultureNear            year_ct         cos_td_rad 
##        -9.48950163         1.81980017        -0.45753970        -5.45679431 
##         sin_td_rad          siteGamla         siteHatzor    siteKarei Deshe 
##         2.51918366        14.67288170         0.84240156        14.23392030 
##          siteNatur siteRamat Hashofet    siteSde Eliezer          siteShaal 
##        13.87788395         0.09500468        12.94479100        14.84973861 
##        siteYavneel          siteYiron 
##         0.34784324        14.02102499
## [1] "species-specific glm"
##     (Intercept) agricultureNear         year_ct      cos_td_rad      sin_td_rad 
##       4.4833623       2.2262363      -0.5857269      -4.6620185       1.4637443 
## siteKarei Deshe       siteNatur siteSde Eliezer       siteShaal       siteYiron 
##      -0.0926939      -0.8071995      -1.8725924       0.3897458      -0.4102873

Lesser whitethroat does not seem like true trend in species specific plots.