Package 'ordiBreadth'

Title: Ordinated Diet Breadth
Description: Calculates ordinated diet breadth with some plotting functions.
Authors: James Fordyce
Maintainer: James A. Fordyce <[email protected]>
License: GPL (>= 3)
Version: 1.0
Built: 2025-02-23 03:30:26 UTC
Source: https://github.com/cran/ordiBreadth

Help Index


Calculates ordinated diet breadth.

Description

Calculates ordinated diet breadth and provides plotting functions.

Details

Package: ordiBreadth
Type: Package
Version: 1.0
Date: 2015-08-07
License: GPL 3.0

Users provide a matrix of host associations, where rows are consumers (e.g., heribivores) and columns are resources (e.g., plants). The function ordi.breadth calculates the ordinated breadth for all consumers in the matrix and summary.hbreadth summarizes the output and dist.group.plot can be used for visualization.

Author(s)

James Fordyce

Maintainer: James Fordyce <[email protected]>

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology


dist.group.plot

Description

This function plots the ordination and shows the centroid for a focal herbivore

Usage

dist.group.plot(specialization, id, cex = 1, PCoA = c(1, 2), seg.col = "pink", seg.wd = 2,
seg.lty = 1, pt.col = "red", pt.pch = 19, pt.cex = 1.5, x.lim = NULL, y.lim = NULL, 
plant.plot = "all.names", rel.pch = 19, rel.cex = 1.5, rel.col = "red", nrel.pch = 19, 
nrel.cex = 1.5, nrel.col = "red", verbose = TRUE, scaled = TRUE)

Arguments

specialization

The object created by the function ordi.breadth.

id

A numeric indicating which species of herbivore to plot from list specialization.

cex

A numeric indicating the font size for diet item names.

PCoA

A vector length two indicated which two PCo axes to plot.

seg.col

The color of segments joining diet items to centroid.

seg.wd

A value indicating the line width of segments joining diet items to centroid.

seg.lty

A value indicating the line type of segments joining diet items to centroid.

pt.col

The color of centroid plotting character.

pt.pch

A value indicating the plotting character for centroid.

pt.cex

A value indicating the character expansion for centroid plotting character.

x.lim

A vector length two indicating the min and max of x axis.

y.lim

A vector length two indicating the min and max of y axis.

plant.plot

A value taking on "all.names", "relevent", or "points". 'all.names' plots the names of host plants, 'relevent' plots only the names of host plants used by focale herbivore (indicated by argument id), 'points' points all host plants as points.

rel.pch

A value indicating the plotting character for host plants used by herbivore.

rel.cex

A value indicating the character expansion for host plants used by herbivore.

rel.col

A value indicating the color for host plants used by herbivore.

nrel.pch

A value indicating the plotting character for host plants not used by herbivore.

nrel.cex

A value indicating the character expansion for host plants not used by herbivore.

nrel.col

A value indicating the color for host plants not used by herbivore.

verbose

A logical indicating whether information on taxonomic and ordinated host breadth is included in plot.

scaled

A logical indicating whether to return scaled ordinated host breadth.

Author(s)

James Fordyce

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology

Examples

testdata<-	
	c(		
			0,0,0,0,1,0,0,0,0,0,#1
			0,0,0,0,0,0,1,1,0,0,#2
			1,1,1,0,0,0,0,0,0,0,#3
			0,0,0,0,1,1,0,1,0,1,#4
			1,1,1,0,0,0,1,0,0,0,#4
			1,1,0,0,1,0,1,0,0,0,#4
			0,0,0,1,0,0,1,0,1,1,#4
			1,0,1,0,1,1,0,0,0,1, #5
			1,1,0,0,1,0,0,1,1,1,#6
			1,1,1,0,1,1,0,1,1,1) #8


dat<-array(dim=c(10,10),data=testdata)
dat<-t(dat)
colnames(dat)<-paste("",LETTERS[1:10],sep="")
rownames(dat)<-paste("bug",1:10,sep="")
x<-ordi.breadth(dat)

dist.group.plot(specialization=x,id=7,cex=1)
dist.group.plot(specialization=x,id=10,cex=1,pt.cex=0.75,plant.plot="points",nrel.pch=1,
nrel.col="black",nrel.cex=0.75)

focal.profPlot

Description

Plots the profile plot of distance from herbivore centroid to host plants calculated by excluding the focal herbivore. Useful for exploratory data analysis.

Usage

focal.profPlot(dat, focal.bug, dist.method = "jaccard", col = c("black", "red"))

Arguments

dat

A matrix of diet associations. Rows are herbivores and columns are diet items.

focal.bug

A value indicating which herbivore is the focal herbivore.

dist.method

Dissimilarity index passed on to vegdist in the vegan package.

col

A vector length 2 indicating colors for plotting. First color is for non-diet items, second color is for diet items.

Value

A profile plot

Author(s)

James Fordyce

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology

Examples

testdata<-	
	c(		
			0,0,0,0,1,0,0,0,0,0,#1
			0,0,0,0,0,0,1,1,0,0,#2
			1,1,1,0,0,0,0,0,0,0,#3
			0,0,0,0,1,1,0,1,0,1,#4
			1,1,1,0,0,0,1,0,0,0,#4
			1,1,0,0,1,0,1,0,0,0,#4
			0,0,0,1,0,0,1,0,1,1,#4
			1,0,1,0,1,1,0,0,0,1, #5
			1,1,0,0,1,0,0,1,1,1,#6
			1,1,1,0,1,1,0,1,1,1) #8


dat<-array(dim=c(10,10),data=testdata)
dat<-t(dat)
colnames(dat)<-paste("",LETTERS[1:10],sep="")
rownames(dat)<-paste("bug",1:10,sep="")

focal.profPlot(dat,4)

hyp.ordi.breadth

Description

Calculates the diet breadth of a hypothetical herbivore placed in ordination space.

Usage

hyp.ordi.breadth(dat, grouping, dist.method = "jaccard", distance = FALSE)

Arguments

dat

A matrix of diet associations. Rows are herbivores and columns are diet items.

grouping

a vector of ones and zeros or TRUE and FALSE indicting diet items of hypothetical herbivore

dist.method

Dissimilarity index passed on to vegdist in the vegan package

distance

a logical indicating whether to return distance of hypothetical herbivore centroid to plants used in PCoA space and the coordinates of the centroid in PCoA space

Value

tot.breadth

Ordinated host breadth of hypothetical herbivore

distances

Distance from centroid to diet items in PCoA space

centroid

Coordinates of the centroid of hypothetical herbivore

Author(s)

James Fordyce

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology

Examples

testdata<-	
	c(		
			0,0,0,0,1,0,0,0,0,0,#1
			0,0,0,0,0,0,1,1,0,0,#2
			1,1,1,0,0,0,0,0,0,0,#3
			0,0,0,0,1,1,0,1,0,1,#4
			1,1,1,0,0,0,1,0,0,0,#4
			1,1,0,0,1,0,1,0,0,0,#4
			0,0,0,1,0,0,1,0,1,1,#4
			1,0,1,0,1,1,0,0,0,1, #5
			1,1,0,0,1,0,0,1,1,1,#6
			1,1,1,0,1,1,0,1,1,1) #8


dat<-array(dim=c(10,10),data=testdata)
dat<-t(dat)
colnames(dat)<-paste("",LETTERS[1:10],sep="")
rownames(dat)<-paste("bug",1:10,sep="")

group<-c(TRUE,TRUE,TRUE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE,FALSE)
hyp.ordi.breadth(dat,group)
hyp.ordi.breadth(dat,group,distance=TRUE)

group<-c(1,1,1,1,1,1,1,1,1,1)
hyp.ordi.breadth(dat,group)#extreme generalist
hyp.ordi.breadth(dat,group,distance=TRUE)

null.breadth

Description

This function calculates the null expectation of host breadth if herbivores sample diet items randomly.

Usage

null.breadth(dat, dist.method = "jaccard", rep = 100, quantiles = c(0.025, 0.975), 
scaled = FALSE)

Arguments

dat

A matrix of diet associations. Rows are herbivores and columns are diet items.

dist.method

Dissimilarity index passed on to vegdist in the 'vegan' package.

rep

The number of permutations to generate a null distribution

quantiles

A vector length of two indicating the lower and upper quantiles to report for the null distribution.

scaled

A logical indicating whether to report the scaled ordinated host breadth.

Value

An array show the lower and upper quantiles of the null distribution for each taxonomic richness

Author(s)

James Fordyce

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology

Examples

testdata<-	
	c(		
			0,0,0,0,1,0,0,0,0,0,
			0,0,0,0,0,0,1,1,0,0,
			1,1,1,0,0,0,0,0,0,0,
			0,0,0,0,1,1,0,1,0,1,
			1,1,1,0,0,0,1,0,0,0,
			1,1,0,0,1,0,1,0,0,0,
			0,0,0,1,0,0,1,0,1,1,
			1,0,1,0,1,1,0,0,0,1, 
			1,1,0,0,1,0,0,1,1,1,
			1,1,1,0,1,1,0,1,1,1) 


dat<-array(dim=c(10,10),data=testdata)
dat<-t(dat)
colnames(dat)<-paste("",LETTERS[1:10],sep="")
rownames(dat)<-paste("bug",1:10,sep="")

null.breadth(dat)

null.breadth.focal

Description

This function calculates the null expectation of ordinated host breadth for each herbivore individually. The ordination for each herbivore is based on PCoA where the focal herbivore is not included.

Usage

null.breadth.focal(dat, dis.method = "jaccard", reps = 100)

Arguments

dat

A matrix of diet associations. Rows are herbivores and columns are diet items.

dis.method

Dissimilarity index passed on to vegdist in the vegan package.

reps

The number of permutations to generate a null distribution.

Details

In situations where the focal herbivore is the only species using a particular diet item, that diet item is not included in the ordination. This is the modified plant richness.

Value

A list containing the following:

species

Name of herbivore species (row name of dat

)

observed.breadth

Ordinated diet breadth

scale.factor

Ordinated diet breadth of most extreme generalist herbivore based on ordination

observed.breadth.scaled

Scaled ordinated diet breadth

totalplantrichness

Taxonomic diet richness of focal species

modplantrichness

Modified taxonomic diet richness of focal species (see details)

null

A vector of null ordinated diet values

Author(s)

James Fordyce

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology

Examples

testdata<-	
	c(		
			0,0,0,0,1,0,0,0,0,0,#1
			0,0,0,0,0,0,1,1,0,0,#2
			1,1,1,0,0,0,0,0,0,0,#3
			0,0,0,0,1,1,0,1,0,1,#4
			1,1,1,0,0,0,1,0,0,0,#4
			1,1,0,0,1,0,1,0,0,0,#4
			0,0,0,1,0,0,1,0,1,1,#4
			1,0,1,0,1,1,0,0,0,1, #5
			1,1,0,0,1,0,0,1,1,1,#6
			1,1,1,0,1,1,0,1,1,1) #8


dat<-array(dim=c(10,10),data=testdata)
dat<-t(dat)
colnames(dat)<-paste("",LETTERS[1:10],sep="")
rownames(dat)<-paste("bug",1:10,sep="")

null.breadth.focal(dat)

null.breadth.focal.summary

Description

Summarizes results contained in object created by null.breadth.focal

Usage

null.breadth.focal.summary(null.breadth.focal.out, quantiles = c(0.025, 0.975), 
round = 5, scaled = FALSE)

Arguments

null.breadth.focal.out

Object created by null.breadth.focal

quantiles

A vector length of two indicating the lower and upper quantiles to report for the null distribution.

round

A value indicating the number of digits to round results

scaled

Logical indicating whether to return scaled ordinated host breadth.

Value

Returns a dataframe of summarized results.

Author(s)

James Fordyce

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology

Examples

testdata<-	
	c(		
			0,0,0,0,1,0,0,0,0,0,#1
			0,0,0,0,0,0,1,1,0,0,#2
			1,1,1,0,0,0,0,0,0,0,#3
			0,0,0,0,1,1,0,1,0,1,#4
			1,1,1,0,0,0,1,0,0,0,#4
			1,1,0,0,1,0,1,0,0,0,#4
			0,0,0,1,0,0,1,0,1,1,#4
			1,0,1,0,1,1,0,0,0,1, #5
			1,1,0,0,1,0,0,1,1,1,#6
			1,1,1,0,1,1,0,1,1,1) #8


dat<-array(dim=c(10,10),data=testdata)
dat<-t(dat)
colnames(dat)<-paste("",LETTERS[1:10],sep="")
rownames(dat)<-paste("bug",1:10,sep="")

x<-null.breadth.focal(dat)
null.breadth.focal.summary(x)

ordi.breadth

Description

This function calculates ordinated diet breadth

Usage

ordi.breadth(dat, dist.method = "jaccard")

Arguments

dat

A matrix of diet associations. Rows are herbivores and columns are diet items.

dist.method

Dissimilarity index passed on to vegdist in the vegan package.

Value

A list containing the following

species

A vector of the herbivore species names (row names of dat)

eig

The eigen values for each of the PCo axes

tot.breadth

A vector of the raw ordinated host breadth for each species

scaled.breadth

A vector of the scaled ordinated host breadth for each species

distances

A list of vectors giving the distance of each diet item from the centroid of each herbivore

group.vectors

A matrix of logicals indicating diet items (columns) for each herbivore (rows)

centroids.group

A matrix giving the centroid on PCo (columns) for each herbivore (rows)

plants.ord

A matrix of the coordinates for each plant in PCoA space

dist.method

Dissimilarity index used for PCoA

Author(s)

James Fordyce

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology

See Also

summaryhbreadth

Examples

testdata<-	
	c(		
			0,0,0,0,1,0,0,0,0,0,#1
			0,0,0,0,0,0,1,1,0,0,#2
			1,1,1,0,0,0,0,0,0,0,#3
			0,0,0,0,1,1,0,1,0,1,#4
			1,1,1,0,0,0,1,0,0,0,#4
			1,1,0,0,1,0,1,0,0,0,#4
			0,0,0,1,0,0,1,0,1,1,#4
			1,0,1,0,1,1,0,0,0,1, #5
			1,1,0,0,1,0,0,1,1,1,#6
			1,1,1,0,1,1,0,1,1,1) #8


dat<-array(dim=c(10,10),data=testdata)
dat<-t(dat)
colnames(dat)<-paste("",LETTERS[1:10],sep="")
rownames(dat)<-paste("bug",1:10,sep="")


ordi.breadth(dat)

ordi.focal.drop

Description

This function computes the ordinated host breadth based on ordination where each herbivore is excluded from the ordination.

Usage

ordi.focal.drop(dat, dist.method = "jaccard")

Arguments

dat

A matrix of diet associations. Rows are herbivores and columns are diet items.

dist.method

Dissimilarity index passed on to vegdist in the vegan package.

Value

A list containing the following:

species

Name of herbivore species (row name of dat

ODB

Ordinated diet breadth

ODB.scaled

Scaled ordinated diet breadth

focal.distances

Distance to each diet item from herbivore centroid based on ordination excluding focal herbivore

focal.breadth

Ordinated diet breadth of herbivore based on ordination where focal herbivore is excluded

focal.scale.factor

The ordinated diet breadth of an extreme generalist in the ordinated space when focal herbivore is excluded from the ordination

focal.scale.breadth

Scaled ordinated diet breadth of herbivore based on ordination where focal herbivore is excluded

Author(s)

James Fordyce

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology

Examples

testdata<-	
	c(		
			0,0,0,0,1,0,0,0,0,0,
			0,0,0,0,0,0,1,1,0,0,
			1,1,1,0,0,0,0,0,0,0,
			0,0,0,0,1,1,0,1,0,1,
			1,1,1,0,0,0,1,0,0,0,
			1,1,0,0,1,0,1,0,0,0,
			0,0,0,1,0,0,1,0,1,1,
			1,0,1,0,1,1,0,0,0,1, 
			1,1,0,0,1,0,0,1,1,1,
			1,1,1,0,1,1,0,1,1,1) 


dat<-array(dim=c(10,10),data=testdata)
dat<-t(dat)
colnames(dat)<-paste("",LETTERS[1:10],sep="")
rownames(dat)<-paste("bug",1:10,sep="")


ordi.focal.drop(dat)

profPlot

Description

Plots the profile plot of distance from herbivore centroid to host plants. Useful for exploratory data analysis.

Usage

profPlot(specialization, id, col = c("black", "red"))

Arguments

specialization

The object created by the function ordi.breadth.

id

A numeric identifying which species of herbivore to plot from list specialization.

col

A vector length 2 indicating colors for plotting. First color is for non-diet items, second color is for diet items.

Value

A profile plot

Author(s)

James Fordyce

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology

Examples

testdata<-	
	c(		
			0,0,0,0,1,0,0,0,0,0,#1
			0,0,0,0,0,0,1,1,0,0,#2
			1,1,1,0,0,0,0,0,0,0,#3
			0,0,0,0,1,1,0,1,0,1,#4
			1,1,1,0,0,0,1,0,0,0,#4
			1,1,0,0,1,0,1,0,0,0,#4
			0,0,0,1,0,0,1,0,1,1,#4
			1,0,1,0,1,1,0,0,0,1, #5
			1,1,0,0,1,0,0,1,1,1,#6
			1,1,1,0,1,1,0,1,1,1) #8


dat<-array(dim=c(10,10),data=testdata)
dat<-t(dat)
colnames(dat)<-paste("",LETTERS[1:10],sep="")
rownames(dat)<-paste("bug",1:10,sep="")

x<-ordi.breadth(dat)
profPlot(x,5)#profile plot for species 5

summaryhbreadth

Description

This function summarizes the ordinated host breadth from the object created by ordi.breadth.

Usage

summaryhbreadth(specialization, round = 5, do.order = FALSE, by = "Richness")

Arguments

specialization

The object created by the function ordi.breadth.

round

The number of digits to round results

do.order

Logical indicating whether to sort results

by

Indicate which column to sort results by. Can be "Herbivore","Richness","Breadth", or "ScaledBreadth"

Value

A dataframe showing result summary

Author(s)

James Fordyce

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology

See Also

ordi.breadth

Examples

testdata<-	
	c(		
			0,0,0,0,1,0,0,0,0,0,#1
			0,0,0,0,0,0,1,1,0,0,#2
			1,1,1,0,0,0,0,0,0,0,#3
			0,0,0,0,1,1,0,1,0,1,#4
			1,1,1,0,0,0,1,0,0,0,#4
			1,1,0,0,1,0,1,0,0,0,#4
			0,0,0,1,0,0,1,0,1,1,#4
			1,0,1,0,1,1,0,0,0,1, #5
			1,1,0,0,1,0,0,1,1,1,#6
			1,1,1,0,1,1,0,1,1,1) #8


dat<-array(dim=c(10,10),data=testdata)
dat<-t(dat)
colnames(dat)<-paste("",LETTERS[1:10],sep="")
rownames(dat)<-paste("bug",1:10,sep="")

x<-ordi.breadth(dat)
summaryhbreadth(x)

summaryordi

Description

Summarizes object provided by ordi.focal.drop

Usage

summaryordi(ordi.out, round = 5)

Arguments

ordi.out

Object provided by ordi.focal.drop.

round

The number of digits to round results.

Value

A dataframe showing result summary

Author(s)

James Fordyce

References

Fordyce, J.A., C.C. Nice, C.A. Hamm, & M.L. Forister. Quantifying diet breadth through ordination of host association. Ecology

Examples

testdata<-	
	c(		
			0,0,0,0,1,0,0,0,0,0,
			0,0,0,0,0,0,1,1,0,0,
			1,1,1,0,0,0,0,0,0,0,
			0,0,0,0,1,1,0,1,0,1,
			1,1,1,0,0,0,1,0,0,0,
			1,1,0,0,1,0,1,0,0,0,
			0,0,0,1,0,0,1,0,1,1,
			1,0,1,0,1,1,0,0,0,1, 
			1,1,0,0,1,0,0,1,1,1,
			1,1,1,0,1,1,0,1,1,1) 


dat<-array(dim=c(10,10),data=testdata)
dat<-t(dat)
colnames(dat)<-paste("",LETTERS[1:10],sep="")
rownames(dat)<-paste("bug",1:10,sep="")

x<-ordi.focal.drop(dat)
summaryordi(x)