# SET WORKING DIRECTORY setwd("D:/BRD/") # IMPORT THE DATA d2<- read.table("Rodent.txt",header=TRUE) head(d2) # CONSIDER THE SUBSET rodent<-d2[,6:16] head(rodent) # Import the fucnctions library(vegan) library(BiodiversityR) library(RODBC) library(MuMIn) library(lme4) # Shanon index by R , diversity result is function in library(BiodiversityR). you can find it by library(vegan) and ls(2) library(BiodiversityR) ls(2) # form a shanon results of all speces comibined in a raw estate.rodent.shannon <- diversityresult(rodent, index='Shannon',method='each site', sortit=FALSE, digits=5) estate.rodent.shannon[1:5,] # cbind is fuction to combine a collomun , hence combine the shanon values to other factors and form a new data set s2<-cbind(estate.rodent.shannon, d2[,1:5]) s2 head(s2) m2<-lmer(Shannon~Area+(1|Grid), s2) summary(m2) anova(m1) > m2<-lmer(Shannon~Area+(1|Grid), s2) > summary(m2) Linear mixed model fit by REML ['lmerMod'] Formula: Shannon ~ Area + (1 | Grid) Data: s2 REML criterion at convergence: -7847.9 Scaled residuals: Min 1Q Median 3Q Max -0.485 -0.023 -0.023 0.000 20.147 Random effects: Groups Name Variance Std.Dev. Grid (Intercept) 0.000024 0.0049 Residual 0.001169 0.0342 Number of obs: 2015, groups: Grid, 14 Fixed effects: Estimate Std. Error t value (Intercept) -6.15e-19 2.33e-03 0.00 AreaCoreZone 3.19e-03 3.07e-03 1.04 Correlation of Fixed Effects: (Intr) AreaCoreZon -0.759 >