OLE: Calculates phenological overlap

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/OLE.R

Description

Calculates phenological overlap (in different ways) of abundance datasets

Usage

1
2
3
4
5
OLE(data1, data2, distrest = "kernel", kerneldatapoints = NULL,
  OLest = NULL, consider = "both", datapoints = NULL,
  mindatapoints = 20, Interpolate = TRUE, kernel = NULL,
  bandwidth = NULL, forcedistrtype = NULL, fitdistrrange = NULL,
  plot = FALSE, ylimfunc = NULL)

Arguments

data1

data-frame; Abundance dataset. It must have two columns, one wih date-objects one with numeric values.

data2

data-frame; Abundance dataset. It must have two columns, one wih date-objects one with numeric values.

distrest

string or vector; Determines in which way the abundace datasets shall be converted into possibility densities. If only a string the same will be used for every possible application, if a vector the first object will be for the first data, and accordingly the second for the second data. Can either be: 'fitdistr', 'kernel', 'normalize' or 'uniform'.

kerneldatapoints

numeric, whole number or vector;If only a numeric the same will be used for every possible application, if a vector the first object will be for the first data, and accordingly the second for the second data. determines, how much datapoints shall be produced by the density() function. As can be seen in the help of density() this shall be a power of two.Does only apply if distrest is 'kernel'. Will be passed as numberofdatapoints argument to kernelest() function.

OLest

vector of strings; determines in which ways the Overlap shall be calculated. Can contain the following strings: 'Weitzman', 'Matusita', 'Pianka', 'Morisita', 'Dissimilarity', 'Duration', 'Hurlbert', 'WMD', 'ProductMoment', 'Lloyd','Horn' if consider is set to 'both' and 'Weitzman'and 'Asym.alpha' if consider is either 'data1' or 'data2'. Default will set all possible measures automatically.

consider

string; Can either be 'both', 'data1' or 'data2'. If both the phenological overlap will be calculated for both datasets, if 'data1' or 'data2' there will be asymmetrical overlaps calculated.

datapoints

numeric (whole numbers); determines how much datapoints shall be drawn from functions. only rough guideline, results may vary. Will b passed to EstimatorData() function as funcdatapoints arguments.

mindatapoints

numeric (whole numbers); Sets a minimum of datapoints from which the overlap is determined. (so it is not applying to the datapoints of th abundance data but for the probability density data). Will be passed to EstimatorData() function.

kernel

string or vector; If only a string the same will be used for every possible application, if a vector the first object will be for the first data, and accordingly the second for the second data. Can either be 'normal' for the truncated normal distribution or 'beta' for beta distribution.the kerel which shall be used. Can be "gaussian", "epanechnikov", "rectangular", "triangular" or "biweight". Does only apply if distrest is 'kernel'. Will be passed to kernelest() function.

bandwidth

numeric or vector;If only a numeric the same will be used for every possible application, if a vector the first object will be for the first data, and accordingly the second for the second data. Can either be 'normal' for the truncated normal distribution or 'beta' for beta distribution. the bandwidth for the kernel density estimation. If is null it will be determined by the unbiased cross validation using the h.ucv() function from the 'kedd' package. Does only apply if distrest is 'kernel'. Will be passed to kernelest() function.

forcedistrtype

string or vector; If only a string the same will be used for every possible application, if a vector the first object will be for the first data, and accordingly the second for the second data. Can either be 'normal' for the truncated normal distribution or 'beta' for beta distribution. This will force the function to only consider one of those distributions for the calculation. Does only apply if distrest is 'fitdistr'. Will be passed to estdist() function.

plot

logical; If TRUE the results will be illustrated in a plot.

ylimfunc

vector of numerics; sets the limits of the plot of the pdfs on the y-axis, will be passed as ylim argument to plot() or curve() function.

StartAndEnd

vector or list;If only a string the same will be used for every possible application, if a list the first object (vector) will be for the first data, and accordingly the second for the second data. In this vector shall be two date-objects, defining the range, in which the distributions shall be fitted. As default the first and last dates in the data data-frame will be selected. Does only apply if distrest is 'fitdistr'. Will be passed to estdist() function.

interpolate

logical; determines whether data should be interpolated, so that both datasets will share same datapoints later on or not. Will run additional Checks if TRUE. Will be passed to EstimatorData() function and if distres = 'normalize' also to the CheckData() function.

Details

This function will determine the Overlap-measures given by OLest for two abundance datasets, whch need to be a dataframe, that has two columns, one with dates and one with numeric values. This function will first estimate a probability density function, using the method given by distrest amd calculate the ovelrpa- measures on the basis of those. Those estimations can be influenced by some argument. For the kernel density esttimation those are: bandwidth which will be the bandwidth that is to use, the kernel will be the kernel that there is to use and kerneldatapoints will determine, how much data-points the density function shall produce. Dor the fitted distributions those arguments are: forcedistrtype which will force the estdist function to consider only one (or more) distributions. and the fitdistrrange which will be the borders of the fitted distributions. If consider = 'data1' or 'data2' only asymetric measures willbe considered. The interpolate argumetn is used for the normalize estimation method, this will interpolate the data linearly, so that both datassets, that are produced by the normalize function will have the same x vlaeus. If plot = TRue it will plot both PDFs and teh data in the background along with Weitzman's delat and Matusitas rho if they are considered. If the probability densities shall be estimated in different ways, then the distrest argument needs the length two. the datapoints argument will determine, how much datapoints there are to produce from the probability ddensity functions. And is therefore a measure of accuracy of the calculations.

Value

a data.frame, with one column named Overlapnames where the names of the used overlap-calculation-methods are stored in and one column named Overlap with the coresponding values.

Author(s)

Florian Berger <florian_berger@ymail.com>

See Also

scale

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
#Create Datasets
 a     <- c(1:10)
 dates1 <- as.Date(a, origin = '2017-01-01')
 count1 <- c(1,1,3,4,6,9,5,4,2,1)
 dat1   <- data.frame(dates1, count1)
 b     <- c(6:15)
 dates2 <- as.Date(b, origin = '2017-01-01')
 count2 <- c(1,2,4,5,6,9,3,4,1,1)
 dat2   <- data.frame(dates2, count2)
 
 OLE(dat1,dat2, distrest = c('fitdistr','kernel'), kernel ='gaussian', forcedistrtype = 'beta', datapoints = 1000, plot = TRUE)

biometry/phenologicalOverlap documentation built on May 21, 2019, 2:31 a.m.