Description Usage Arguments Details Value Author(s) References See Also Examples

The procedure replicates the two strategies of Monte Carlo resampling available in the following commands: `Emc`

, `PSicalc`

, `WTdMC`

, and `WTcMC`

.

1 |

`dataset` |
Object of class RInSp with data of type “double” or “integer”. |

`pop.diet` |
Option specifying the type of calculation for the population diet: “sum” or “average”. See |

`replicates` |
Number of resampled data matrices. |

See Araujo et al (2011) for a discussion of the biological assumptions underlying this Monte Carlo resampling procedure.

For counts of individual prey items representing approximately independent prey-capture decisions (i.e., integer data type), it is possible to run a Monte Carlo resampling simulation to test the null hypothesis that any observed diet variation arose from individuals sampling stochastically from a shared distribution. In the simulations, each individual is assigned a number of prey items equal to the number of items it was observed eating, and then prey items are randomly assigned to the individual's diet via multinomial sampling from the observed population resource distribution.

For double data type, as mass of each food category in an individual's gut, the Monte Carlo resampling procedure first determines the number of prey used by each individual, *n_i*. The program then randomly reassigns each individual *n_i* prey items drawn from the population distribution of items. This is repeated a user-specified number of times. Hence, the resampled population yields a null model corresponding to a population composed of generalists that sample randomly from the population's diet, and have diet sizes equal to those of the observed data set.

The procedure can easily create a big three dimensional array. This object can create problems as it can consume an huge amount of memory. If needed use a package like “ff” and a for loop to create an array able to hold the results.

A matrix of “replicates + 1” datasets with the same number of individuals/resources of the input file. The first matrix is the original input data file.

Dr. Nicola ZACCARELLI

Araujo M.A., Layman C., and Bolnick D.I. 2011. The ecological causes of individual specialization. *Ecology Letters* **14**: 948-958.

`pop.diet`

, `Emc`

, `PSicalc`

, `WTdMC`

, `WTcMC.`

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | ```
# Monte Carlo resampling for NODF
# EXAMPLE NOT RUN
# with stickleback data from Bolnick and Paull 2009
# data(Stickleback)
# Select a single spatial sampling site (site A)
# SiteA = import.RInSp(Stickleback, row.names = 1,
# info.cols = c(2:13), subset.rows = c("Site", "A"))
# nreplicates = 999
# Null.data = MCp.RInSp(SiteA, replicates = nreplicates)
# Build a vector holding real and resampled results
# the NODF values and warning messages from import.RInSp
# are printed, too.
# null.d.NODF = c()
# for (i in 1:(nreplicates + 1)) {
# null.d.NODF = c(null.d.NODF, NODF(import.RInSp(Null.data[ , , i], print.messages=FALSE),
# print.results=FALSE)$NODF)
# }
# hist(null.d.NODF)
# summary(null.d.NODF)
# Observed value of NODF from data
# null.d.NODF[1]
# rm(list=ls(all=TRUE))
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.