nullmodel: Generates null models for network analysis

View source: R/nullmodel.r

nullmodelR Documentation

Generates null models for network analysis

Description

A wrapper function for convenient generation of null models for quantitative and binary networks

Usage

nullmodel(web, N=1000, method="r2d", ...)

Arguments

web

Web is a matrix representing the interactions observed between higher trophic level species (columns) and lower trophic level species (rows). Usually this will be number of pollinators on each species of plants or number of parasitoids on each species of prey.

N

number of null models to be generated; defaults to 1000 (more might be better, less probably not).

method

Null model type. Can be given as an integer or name: 1/"r2dtable", 2/"swap.web", 3/"vaznull", 4/"shuffle.web", 5/"mgen"; allows for partial match of names; methods 1 to 4 works for quantitative webs, 4 and 5 for binary.

...

arguments to be passed to the function generating the specific null models, see there for options.

Details

ADVICE: Look at the same-named function in vegan, as well as the long list of potential null models described in commsim in that package. It offers a richer and more standardised implementation of null models than this (earlier) function. In particular the method shuffle.web is potentially confusing, as it calls bipartite's shuffle.web for quantitative networks, but vegan's quasiswab algorithm for binary. Since vegan also now offers the argument greedyqswap for quantitative networks, please have a look at vegan's nullmodel function.

This is only a wrapper function to facilitate and standardise the generation of null models.

These null models assume that interaction weights are integers that represent frequencies that are “individually” counted, not decimal numbers. Multiplication by 1000 (say) and rounding does NOT necessarily make your value frequencies satisfy this assumption. Null models for “continuously quantitative” webs still have to be developed!

A warning is returned when all entries in a quantitative network are 0 or 1 (which suggests a binary network).

Value

Returns a list of N null model-generated networks. Species names are (obviously) dropped.

Note

When a quantitative network contains only 1s (as may happen when sampling intensity is low), the quantitative null model will be extremely similar (often identical) to the observed network. This is no error. It is reflecting the fact that this network contains little (no) information beyond the abundances.

Author(s)

Carsten F. Dormann carsten.dormann@biom.uni-freiburg.de

See Also

For the functions generating the null model network: shuffle.web, swap.web, vaznull, mgen, vegan::simulate and r2dtable

Examples

## Not run: 
	data(Safariland)
	nullmodel(Safariland, N=2, method=1)
	nullmodel(Safariland>0, N=2, method=4)
	# analysis example:
	obs <- unlist(networklevel(Safariland, index="weighted nestedness"))
	nulls <- nullmodel(Safariland, N=100, method=1)
	null <- unlist(sapply(nulls, networklevel, index="weighted nestedness")) #takes a while ...
	
	plot(density(null), xlim=c(min(obs, min(null)), max(obs, max(null))), 
		main="comparison of observed with null model Patefield")
	abline(v=obs, col="red", lwd=2)    
	
	praw <- sum(null>obs) / length(null)
	ifelse(praw > 0.5, 1-praw, praw)    # P-value
	
	# comparison of null model 4 and 5 for binary:
	nulls4 <- nullmodel(Safariland>0, N=100, method=4)
	nulls5 <- nullmodel(Safariland>0, N=100, method=5)
	null4 <- unlist(sapply(nulls4, networklevel, index="weighted nestedness"))
	null5 <- unlist(sapply(nulls5, networklevel, index="weighted nestedness"))
	
	
	plot(density(null4), xlim=range(c(null4, null5)), lwd=2, 
		main="comparison of null models")
	lines(density(null5), col="red", lwd=2)
	legend("topright", c("shuffle", "mgen"), col=c("black", "red"), lwd=c(2,2), 
		bty="n", cex=1.5)
	abline(v=networklevel(Safariland>0, index="weighted nestedness"))
	
## End(Not run)

bipartite documentation built on May 29, 2024, 2:23 a.m.