humboldt.espace.correction | R Documentation |
Espace correction of environmental abundance test
humboldt.espace.correction(Z.env1, Z.env2, Z.sp1, Z.sp2)
Z.env1 |
a grid of espace for environment 1 (output from humboldt.grid.espace) |
Z.env2 |
a grid of espace for environment 2 (output from humboldt.grid.espace) |
Z.sp1 |
a grid of espace for species/population 1 (output from humboldt.grid.espace) |
Z.sp2 |
a grid of espace for species/population 2 (output from humboldt.grid.espace) |
Determines if users should correct occurrence densities of each species by the prevalence of the environments in their range for equivalence, background, and overlap analyses (correct.env=T). Often datasets have high overlap among the differences between input environments and the differences between species distributions in environmental space. If ignored, equivalence statistics are prone to type I errors and you may observed statistical differences that are entirely due to differences in the availability of environments vs. actual differences in occupied environmental space. When highly correlated, it is strongly encouraged to use 'correct.env=T' to correct espace observations by abundance of environments.
Output: an environmental dataset with only 'important' variables for inclusion into a PCA (vs. all variables)
humboldt.g2e, humboldt.grid.espace, humboldt.equivalence.stat, humboldt.background.stat, humboldt.niche.similarity, humboldt.plot.niche,humboldt.doitall
which use or depend on outputs of this function
library(humboldt)
##load environmental variables for all sites of the study area 1 (env1). Column names should be x,y,X1,X2,...,Xn)
env1<-read.delim("env1.txt",h=T,sep="\t")
## load environmental variables for all sites of the study area 2 (env2). Column names should be x,y,X1,X2,...,Xn)
env2<-read.delim("env2.txt",h=T,sep="\t")
## remove NAs and make sure all variables are imported as numbers
env1<-humboldt.scrub.env(env1)
env2<-humboldt.scrub.env(env2)
##load occurrence sites for the species at study area 1 (env1). Column names should be 'sp', 'x','y'
occ.sp1<-na.exclude(read.delim("sp1.txt",h=T,sep="\t"))
##load occurrence sites for the species at study area 2 (env2). Column names should be 'sp', 'x','y'.
occ.sp2<-na.exclude(read.delim("sp2.txt",h=T,sep="\t"))
##convert geographic space to espace
zz<-humboldt.g2e(env1=env1, env2=env2, sp1=occ.sp1, sp2=occ.sp2, reduce.env = 2, reductype = "PCA", non.analogous.environments = "NO", env.trim= T, e.var=c(3:21), col.env = e.var, trim.buffer.sp1 = 200, trim.buffer.sp2 = 200, rarefy.dist = 50, rarefy.units="km", env.reso=0.41666669, kern.smooth = 1, R = 100, run.silent = F)
##store espace socres for sp1 and environments 1,2 and both environments combined output from humboldt.g2e
scores.env1<-zz$scores.env1[1:2]
scores.env2<-zz$scores.env2[1:2]
scores.env12<- rbind(zz$scores.env1[1:2],zz$scores.env2[1:2])
scores.sp1<-zz$scores.sp1[1:2]
scores.sp2<-zz$scores.sp2[1:2]
## run create a grid of Environmental Space Function
Z.sp1<- humboldt.grid.espace(scores.env12,scores.env1,scores.sp1,kern.smooth=1,R=100)
Z.sp2<- humboldt.grid.espace(scores.env12,scores.env2,scores.sp2,kern.smooth=1,R=100)
Z.env1<- humboldt.grid.espace(scores.env12,scores.env1,scores.env1,kern.smooth=1,R=100)
Z.env2<- humboldt.grid.espace(scores.env12,scores.env2,scores.env2,kern.smooth=1,R=100)
ee<- humboldt.espace.correction(Z.env1=Z.env1,Z.env2=Z.env2,Z.sp1=Z.sp1,Z.sp2=Z.sp2)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.