biodecrypt.wrap: Wraps the biodecrypt.cross analysis to compare the...

View source: R/biodecrypt.wrap.R

biodecrypt.wrapR Documentation

Wraps the biodecrypt.cross analysis to compare the performance of biodecrypt among different parameters.

Description

The function biodecrypt.wrap wraps the biodecrypt.cross analysis by using all possible combinations of a series of distance ratio, alpha and buffer values to compare their resulting MIR, NIR and NUR.

Usage

biodecrypt.wrap(mat,id,alpha=c(1,5,10,15),alphamat=NULL,ratio=c(2,3,4,5),
buffer=c(0,40,80,120,160),fraction=0.95, partCount=10, checkdist=T, 
clipToCoast="terrestrial", proj="+proj=longlat +datum=WGS84", minimum=7, 
map=NULL,xlim=NULL,ylim=NULL,main=NULL,save=T,name="res_cross.txt",runs=10)

Arguments

mat

A matrix for longitude and latitude (in decimal degrees) for all records.

id

A vector indicating species membership of each record (in the same order of mat). Identified records are indicated with 1,2..n, unidentified records with 0.

alpha

A vector indicating the initial alpha values. It will be the same for all species

alphamat

A matrix indicating different alpha values for different species (optional).

ratio

The values of ratio.

buffer

The values of buffer.

fraction

The minimum fraction of occurrences that must be included in polygon.

partCount

The maximum number of disjunct polygons that are allowed..

checkdist

Logical, if TRUE cases attributed to a given species based on relative distance from hulls but closer to an identified record of another species are not attributed.

clipToCoast

Either "no" (no clipping), "terrestrial" (only terrestrial part of range is kept) or "aquatic" (only non-terrestrial part is clipped).

proj

the projection information for mat. In this version, the default is the only supported option.

minimum

The minimum number of specimens required to build alpha hulls. If the number of identified specimens is lower, convex hulls are calculated to improve procedure stability.

map

A map to be plotted during the procedure to show the separation progress.

xlim

Longitude boudaries for the map.

ylim

latitude boudaries for the map.

main

The name to be plotted on the graph

save

Logical, if TRUE a result table is saved after each biodecrypt.cross run

name

The name of the saved file

runs

The number of runs among which the cases are randomly assigned as non-attributed records

Details

The resulting table can be passed to biodecrypt.optimise to compute the best combination of alpha, buffer and ratio.

Value

table

The result table indicating for each cross validation test the MIR, NIR and NUR values together with the used ratio, buffer and alpha values.

Author(s)

Leonardo Dapporto

References

Platania L. et al. Assigning occurrence data to cryptic taxa improves climatic niche assessments: biodecrypt, a new tool tested on European butterflies. Glocal Ecology and Biogeography (2020).

Examples


# Create an example for a dataset
mat<-rbind(cbind(rnorm(n = 20, mean = 1, sd = 4),rnorm(n = 20, mean = 40, sd = 3)),
	cbind(rnorm(n = 20, mean = 7, sd = 5),rnorm(n = 20, mean = 45, sd = 2)))

id<-c(rep(1,20),rep(2,20))
id[sample(c(1:40))[1:10]]<-0

## Not run: wrap_data_fast<-biodecrypt.wrap(mat,id, alpha=c(1,4), ratio=2, 
		buffer=20, runs=2)
## End(Not run)
## Not run: parameters<-biodecrypt.optimise(wrap_data_fast$table,penalty=10)

#Make the example with default 10 runs and more values
## Not run: wrap_data<-biodecrypt.wrap(mat,id, alpha=c(1,4), ratio=c(2,4), 
		buffer=c(20,50))
## End(Not run)
## Not run: parameters<-biodecrypt.optimise(wrap_data$table)

#inspect the optimised parameters
## Not run: parameters

#Use different alpha for the two species
#alpha for first

## Not run: alpha1<-c(1,3)

#alpha for second
## Not run: alpha2<-c(1,5)

## Not run: alphamat<-cbind(alpha1,alpha2)

## Not run: wrap_data<-biodecrypt.wrap(mat,id, alphamat=alphamat, ratio=c(2,4),  
                           buffer=c(20,50))
## End(Not run)

## Not run: parameters<-biodecrypt.optimise(wrap_data$table, penalty=20)

#inspect the optimised parameters

## Not run: parameters


leondap/recluster documentation built on Nov. 11, 2024, 7:11 a.m.