densform: Generate standard probability density functions for each...

Description Usage Arguments Examples

View source: R/cracle_build.R

Description

This function takes extracted climate data (from an object generated by the vegdistmod::extraction() function) for one taxon/species and generates probability density functions for variable using both a Gaussian (normal) approximation and a Gaussian Kernel Density estimator.

Usage

1
2
3
densform(ex, clim, name = "", bw = "nrd0", kern = "gaussian",
  manip = "condi", n = 1024, from = 0, to = 0, clip = 0, bg.n = 10,
  bg = NULL)

Arguments

ex

An object derived from the extraction() function.

clim

A raster object (see raster::raster() and raster::stack() documentation for reading raster files into R).

name

A character string describing (preferably) the group for which PDFs are being constructed (i.e., a species binomial). If none is supplied, a value of column "tax" is selected as a default.

bw

A bandwidth compatible with stats::density(). Options include "nrd", "nrd0", "ucv", "bcv", etc.. Default (and recommended) value is "nrd0".

kern

Type of Kernel to smooth with. Recommend 'gaussian', 'optcosine', or 'epanechnikov'. See: stats::density for options.

manip

Character string of 'reg' for intersectional likelihood, 'condi' for conditional likelihood statement.

n

Number of equally spaced points at which the probability density is to be estimated. Defaults to 1024. A lower number increases speed but decreases resolution in the function. A higher number increases resolution at the cost of speed. Recommended values: 512, 1024, 2048, ....

from

vector of starting points by variable. Default is the variable layer minimum.

to

vector of ending points by variable. Default is the variable layer maximum.

clip

A character string of value "range" or "95conf" or "99conf". Should the probability functions be clipped to either the empirical range or the 95 or 99 percent confidence interval?

bg.n

If manip = 'condi'. How many background points PER OCCURRENCE record should be sampled. Default is 1000.

bg

Optionally send a matrix of an extraction object to use as the background sample.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Not run: 
#distr <- read.table('test_mat.txt', head=T, sep ="\t");
data(distr);
data(climondbioclim);
extr.raw = extraction(data=distr, clim= climondbioclim, schema='raw');
extr.sub = subset(extr.raw, extr.raw$tax == extr.raw[5,'tax']);
dens.sub = densform(extr.sub, clim = climondbioclim, bw = 'nrd0', n = 128, bg.n=25);
densplot(dens.sub, names(climondbioclim[[1]]));

## End(Not run)

rsh249/vegdistmod documentation built on May 28, 2019, 3:31 a.m.