Learn R Programming

bipartite (version 2.16)

vazquez.example: Examples for some analyses

Description

Describes how to use bipartite to calculate the statistics presented in V<U+00E1>zquez et al. (2009). Some of these functions are available in bipartite or other packages, and this help page will show how to use them in line with the publication.

Arguments

Details

The functions used are:

confint:

Is the same as quantile

intasymm:

Can be extracted using specieslevel

intereven:

Is similar to interaction evenness in networklevel, but only for a specific option

% \item{mgen:}{Random web based on the number of links; it usually looses ranks (i.e. not all species will still be represented in this random web), and it is based only on the binary web (i.e. all quantitative information is lost); see \code{r2dtable}, \code{\link{vaznull}} and \code{\link{shuffle.web}} for quantitative alternatives.}
mlik:

A specific call to dmultinom and the calculation of the AIC; the number of parameters entering the AIC-calculation is not obvious; this depends on the constraints used by the null model. In the case of r2dtable, column and row totals are constrained, i.e. ncol+nrow parameters must be given. In the case of swap.web, connectance is also constrained, but how many parameters does that imply? One? In shuffle.web, we constrain the dimensionality and connectance, i.e. 3 (?) parameters. V<U+00E1>zquez et al. (2009) argue that they constrain only 2 parameters when producing the probability matrix given as pweb in the example below. We tend to disagree: the marginal probabilities of all columns and rows are given, hence k = (ncol(web) + nrow(web)). To our knowledge, there is no mathematical/statistical treatise of this problem.

netstats:

A wrapper calling the other functions, in that sense similar to networklevel, but also calling some output from specieslevel.

plotmat:

Now part of visweb, using the right options.

quant2bin:

A dedicated function to do a simple thing: (web>0)*1.

sortmatr:

newly defined function: sortweb

sortmatrext:

sort matrix by some given sequence; also part of sortweb

In the example below, we use the bipartite/standard R functions whenever possible.

References

V<U+00E1>zquez, P.D., Chacoff, N.,P. and Cagnolo, L. (2009) Evaluating multiple determinants of the structure of plant-animal mutualistic networks. Ecology 90, 2039--2046.

See Also

See also networklevel.

Examples

Run this code
# NOT RUN {
	data(Safariland)
	
	# confint:
	N100 <- sapply(swap.web(100, Safariland), networklevel, index="nestedness")
	quantile(unlist(N100), c(0.025, 0.975))
	# intasymm: extract values for the asymmetry of interactions and the 
	# dependency matrix for pollinators:
	specieslevel(Safariland)$"higher trophic level"$"interaction push/pull"
	specieslevel(Safariland)$"higher trophic level"$"dependence"
	# for plants:
	specieslevel(Safariland)$"lower trophic level"$"interaction push/pull"
	specieslevel(Safariland)$"lower trophic level"$"dependence"
	
	#intereven
	networklevel(Safariland, index="interaction evenness", intereven="sum")[2]
	# or, as we recommend (see help on networklevel):
	networklevel(Safariland, index="interaction evenness", intereven="prod")[2]
		
	# mlik:
	# calculates the log-likelihood of observing a network, given a probability  
	# matrix of the same size (pweb):
	dmultinom(Safariland>0, prob=pweb, log=TRUE)
	# AIC (the number of parameters is given by how many constraints are put onto the 
	# null model; here, we constrain 9 rows and 27 columns, i.e. sum(dim(binweb))):
	-2*dmultinom(Safariland>0, prob=pweb, log=TRUE) + 2*(sum(dim(binweb)))
	
	# netstats:
	networklevel(Safariland, 
	  index=c("connectance", "interaction evenness", "nestedness", "ISA"))
	mean(specieslevel(Safariland)$"higher trophic level"$"interaction push/pull")
	mean(specieslevel(Safariland)$"lower trophic level"$"interaction push/pull")
	
	#plotmat:
	visweb(t(unname(Safariland)), circles=TRUE, boxes=FALSE)
	
	#sortmatr/sortmatrext:
	sortweb(Safariland, sort.order="inc") #rares species first
	plotweb(sortweb(Safariland, sort.order="dec"), method="normal")
	plotweb(sortweb(web=Safariland, sort.order="seq", 
	  sequence=list(seq.higher=sample(colnames(Safariland)), 
	  seq.lower=sample(rownames(Safariland)))), 
	  method="normal")
	
# }

Run the code above in your browser using DataLab