Function predict.indicators takes an object of class indicators and determines the probability of the indicated site group given a community data set. If no new data set is provided, the function can calculate the probabilities corresponding to the original sites used to build the indicators object.

# S3 method for indicators
predict(object, newdata = NULL, cv = FALSE, ...)

Arguments

object

An object of class 'indicators'.

newdata

A community data table (with sites in rows and species in columns) for which predictions are needed. This table can contain either presence-absence or abundance data, but only presence-absence information is used for the prediction. If NULL, then the original data set used to derive the indicators object is used as data.

cv

A boolean flag to indicate that probabilities should be calculated using leave-one-out cross validation (i.e recalculating positive predictive value of indicators after excluding the target site).

...

In function predict, additional arguments not used (included for compatibility with predict).

Value

If confidence intervals are available in x, function predict.indicators returns a matrix where communities are in rows and there are three columns, correspoinding to the probability of the indicated site group along with the confidence interval. If confidence intervals are not available in x, or if cv = TRUE, then predict.indicators returns a single vector with the probability of the indicated site group for each community.

Details

Function indicators explores the indicator value of the simultaneous occurrence of sets of species (i.e. species combinations). The method is described in De Cáceres et al. (2012) and is a generalization of the Indicator Value method of Dufrêne & Legendre (1997). The current function predict.indicators is used to predict the indicated site group from the composition of a new set of observations. For communities where one or more of the indicator species combinations are found, the function returns the probability associated to the indicator that has the highest positive predictive value (if confidence intervals are available, the maximum value is calculated across the lower bounds of the confidence interval). For communities where none of the indicator species combinations is found, the function returns zeroes. If newdata = NULL, the function can be used to evaluate the predictive power of a set of indicators in a cross-validated fashion. For each site in the data set, recalculates the predictive value of indicators after excluding the information of the site, and then evaluates the probability of the site group.

References

De Cáceres, M., Legendre, P., Wiser, S.K. and Brotons, L. 2012. Using species combinations in indicator analyses. Methods in Ecology and Evolution 3(6): 973-982.

Dufrêne, M. and P. Legendre. 1997. Species assemblages and indicator species: The need for a flexible asymetrical approach. Ecological Monographs 67:345-366.

Author

Miquel De Cáceres Ainsa, EMF-CREAF

Examples

library(stats)

data(wetland) ## Loads species data

## Creates three clusters using kmeans
wetkm <- kmeans(wetland, centers=3) 


## Run indicator analysis with species combinations for the first group
sc <- indicators(X=wetland, cluster=wetkm$cluster, group=1, verbose=TRUE, At=0.5, Bt=0.2)
#> Target site group: 1
#> Number of candidate species: 33
#> Number of sites: 41 
#> Size of the site group: 10 
#> Starting species  1 ... accepted combinations: 0 
#> Starting species  2 ... accepted combinations: 16 
#> Starting species  3 ... accepted combinations: 16 
#> Starting species  4 ... accepted combinations: 87 
#> Starting species  5 ... accepted combinations: 87 
#> Starting species  6 ... accepted combinations: 133 
#> Starting species  7 ... accepted combinations: 133 
#> Starting species  8 ... accepted combinations: 153 
#> Starting species  9 ... accepted combinations: 155 
#> Starting species  10 ... accepted combinations: 155 
#> Starting species  11 ... accepted combinations: 155 
#> Starting species  12 ... accepted combinations: 155 
#> Starting species  13 ... accepted combinations: 155 
#> Starting species  14 ... accepted combinations: 155 
#> Starting species  15 ... accepted combinations: 155 
#> Starting species  16 ... accepted combinations: 160 
#> Starting species  17 ... accepted combinations: 161 
#> Starting species  18 ... accepted combinations: 170 
#> Starting species  19 ... accepted combinations: 170 
#> Starting species  20 ... accepted combinations: 172 
#> Starting species  21 ... accepted combinations: 172 
#> Starting species  22 ... accepted combinations: 173 
#> Starting species  23 ... accepted combinations: 173 
#> Starting species  24 ... accepted combinations: 173 
#> Starting species  25 ... accepted combinations: 173 
#> Starting species  26 ... accepted combinations: 173 
#> Starting species  27 ... accepted combinations: 173 
#> Starting species  28 ... accepted combinations: 173 
#> Starting species  29 ... accepted combinations: 173 
#> Starting species  30 ... accepted combinations: 173 
#> Starting species  31 ... accepted combinations: 173 
#> Starting species  32 ... accepted combinations: 173 
#> Starting species  33 ... accepted combinations: 173 
#> Number of valid combinations: 173
#> Number of remaining species: 13 
#> Calculating statistical significance (permutational test)...

## Use the indicators to make predictions of the probability of group #1
## Normally an independent data set should be used, because 'wetland' was used to derive
## indicators. The same would be obtained calling 'predict(sc)' without further arguments.
p <- predict(sc, wetland)

## Calculate cross-validated probabilities (recalculates 'A' statistics once for each site 
## after excluding it, and then calls predict.indicators for that site)
pcv <- predict(sc, cv = TRUE)

## Show original membership to group 1 along with (resubstitution) predicted probabilities  
## and cross-validated probabilities. Cross-validated probabilities can be lower for sites
## originally belonging to the target site group and higher for other sites.
data.frame(Group1 = as.numeric(wetkm$cluster==1), Prob = p, Prob_CV = pcv)
#>    Group1      Prob   Prob_CV
#> 5       0 0.0000000 0.0000000
#> 8       0 0.0000000 0.0000000
#> 13      0 0.5000000 0.5714286
#> 4       0 0.0000000 0.0000000
#> 17      0 0.5714286 0.6666667
#> 3       0 0.0000000 0.0000000
#> 9       0 0.0000000 0.0000000
#> 21      0 0.0000000 0.0000000
#> 16      0 0.0000000 0.0000000
#> 14      0 0.0000000 0.0000000
#> 2       0 0.0000000 0.0000000
#> 15      0 0.0000000 0.0000000
#> 1       0 0.0000000 0.0000000
#> 7       0 0.5000000 0.5714286
#> 10      0 0.0000000 0.0000000
#> 40      0 0.6428571 0.6923077
#> 23      0 0.6923077 0.7272727
#> 25      0 0.6923077 0.7200000
#> 22      0 0.6923077 0.7272727
#> 20      0 0.0000000 0.0000000
#> 6       0 0.8000000 1.0000000
#> 18      0 0.5000000 0.5454545
#> 12      0 0.5000000 0.6666667
#> 39      0 0.5714286 0.6153846
#> 19      0 0.6923077 1.0000000
#> 11      0 0.5000000 0.6666667
#> 30      1 1.0000000 1.0000000
#> 34      1 1.0000000 1.0000000
#> 28      1 0.6923077 0.6800000
#> 31      1 1.0000000 1.0000000
#> 26      0 0.8571429 1.0000000
#> 29      0 0.9565217 1.0000000
#> 33      0 0.6923077 0.7500000
#> 24      1 1.0000000 1.0000000
#> 36      1 1.0000000 1.0000000
#> 37      1 1.0000000 1.0000000
#> 41      1 1.0000000 1.0000000
#> 27      1 1.0000000 1.0000000
#> 32      1 1.0000000 1.0000000
#> 35      0 0.7142857 0.8333333
#> 38      0 0.7142857 0.8333333