Environmental Reduce

P. Joser Atauchi

2018-10-29

Define “M” under different ways is matter to calibration models in ecological niche model, we used buffer zone as calibration zone, based on:

Environmental Reduce

These function help you to reduce environmental.

library(sdStaf)
#> Loading required package: dplyr
#> 
#> Attaching package: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
#> Loading required package: ggplot2
data(phytotoma)

Now, we need to load environmental dataset.

library(dismo)
#> Loading required package: raster
#> Loading required package: sp
#> 
#> Attaching package: 'raster'
#> The following object is masked from 'package:dplyr':
#> 
#>     select
predictor <- stack(list.files(path=paste(system.file(package="dismo"),'/ex', sep=''), pattern='grd', full.names=TRUE ))

# Read names 
names(predictor)
#> [1] "bio1"  "bio12" "bio16" "bio17" "bio5"  "bio6"  "bio7"  "bio8"  "biome"

plot(predictor$bio1)

Next function, reduce environmental data based on buffer zone and customer zone.

buf.M <- stim.M(phytotoma[,2:3], radio = 131)
#> Loading required namespace: rgeos


reduce_cut <- reduce.env(env = predictor, occ_data = phytotoma[,2:3], mask= buf.M)
#> Environmental data completed in 0 minutes 0.4 seconds.

plot(reduce_cut@cropa$bio1)

points(phytotoma[,2:3], pch=16,col='blue')

We need to show correlogram of predictor variables

 cor.show(reduce_cut)


# Define what variables we need to remove
 rd <- c('bio1','bio12','bio16','biome','bio8')

Remove Rd in reduce_cut, and we have these variables.

cor.show(reduce_cut, rm=TRUE, var.rm = rd)

Define new environmental dataset (no-correlation)

var_reduce <- dropLayer(reduce_cut@cropa, rd)

names(var_reduce)
#> [1] "bio17" "bio5"  "bio6"  "bio7"