CAS: Cumulative abundance surface (CAS)

View source: R/CAS.R

CASR Documentation

Cumulative abundance surface (CAS)


Functions to calculate cumulative abundance surfaces (CASs), to build matrices from them, and to summarize several CASs.


CAS(x, transform=NULL, verbose=FALSE)
CASmargin(CAS, margin=1, verbose=FALSE)
CAS2matrix(CAS, type="cumulative",classWeights=NULL)
CAScenters(CAS, y=NULL)
CASquantile(CAS, q = 0.5, y = NULL)



An object of class 'doublestratifiedvegdata' (see function stratifyvegdata).


A function or the name of a function to be applied to each cumulative abundance value.


A logical flag to indicate extra output.


An object of class 'CAS'.


Indicates whether marginalization should be done in primary (margin = 1) or secondary (margin = 2) size classes.


The type of information that the resulting matrix should contain (either "cummulative" or "total").


A numerical matrix containing the weight for each combination of size classes. If NULL, then all classes are assumed to have the same weight.


A vector used as a factor to calculate average or quantile surfaces per each level. Alternatively, an object of class vegclust for which CAS centroids or medoids are desired.


Probability value for which the quantile is desired. By default the median is given.


Function CAS replaces the abundance value of each combination of size classes by the sum of abundances in this and larger size classes. This creates a cumulative abundance surface (similar to a bivariant cummulative distribution function). Function CASmargin takes an object of class 'CAS' and returns an object of class 'CAP' that corresponds marginal profile in either the primary or the secondary size classes. Function CAS2matrix takes an object of class 'CAS' and returns a data matrix, where values differ depending on parameter type: (1) type="cummulative" simply reshapes the 'CAS' object (a list) into a matrix with as many rows as plot records and where columns are organized in blocks (there are as many blocks as species and each block has as many columns as combinations of size classes); (2) type="total" returns a plot-by-species matrix where each value is the total abundance of the species in the plot (i.e. the CAS value at the ground level). When provided, classWeights are used to weight size classes of the cumulative abundance surfaces (for (1) only). Function CAScenters calculates the average abundance surface for a set of plot records. If y is a factor, it is used to speficy groups of samples for which average profiles are to be calculated. If y is an object of class 'vegclust' then the function returns the CAS centroids or medoids corresponding to the clustering result. Function CASquantile calculates a quantile surface for a set of CASs. The usage of y is the same as for CAScenters.


Function CAS returns an object of class 'CAS', similar to objects of class 'doublestratifiedvegdata' but where abundance values of upper size classes have beed added to those of lower size classes. Function CAS2matrix returns a matrix with species as rows (columns depend on the value of type). Functions CAScenters and CASquantile return an object of class 'CAS'.


Miquel De Cáceres, CREAF.


De Cáceres, M., Legendre, P. & He, F. (2013) Dissimilarity measurements and the size structure of ecological communities. Methods in Ecology and Evolution 4: 1167-1177.

De Cáceres, M., Coll, L., Martín-Alcón, S., González-Olabarria, J.R. (submitted) A general method for the classification of forest stands using structure and composition.

See Also

stratifyvegdata, plot.CAS, vegdiststruct


## Load tree data

## Define stratum thresholds (4 strata)
heights = seq(0,4, by=0.5)
diameters = seq(0,2, by=0.5)

## Stratify tree data using heights and diameters as structural variables
X = stratifyvegdata(treedata, sizes1=heights, sizes2=diameters, plotColumn="plotID",
                    speciesColumn="species", size1Column="height", size2Column="diam",

## Build cummulative abundance surface
Y = CAS(X)


##  Extracts the first and second marginal (i.e. CAP on heights or diameters respectively)
Y.M1 = CASmargin(Y, margin = 1)

Y.M2 = CASmargin(Y, margin = 2)

##  For comparison we calculate the same profiles using the stratifyvegdata and CAP functions
Y1 = CAP(stratifyvegdata(treedata, sizes1=heights, plotColumn="plotID",
                    speciesColumn="species", size1Column="height",
Y2 = CAP(stratifyvegdata(treedata, sizes1=diameters, plotColumn="plotID",
                    speciesColumn="species", size1Column="diam",

##  Compare Y.M1[[2]] with Y1[[2]] and Y.M2[[2]] with Y2[[2]]

vegclust documentation built on Aug. 25, 2022, 9:08 a.m.