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

This function allows investigating the effect of sample size on estimates and precision of stable isotope mixing solutions. User can modify the sample size for one chosen source, for all sources or for the consumer. See details section for further informations.

1 2 3 4 |

`package` |
The package name to be used to estimate mixing proportions. Must be one of 'siar' or 'mixsiar'. |

`mix` |
The output returned by the |

`source` |
The output returned by the |

`discr` |
The output returned by the |

`type` |
Character indicating the type of analysis to run. Must be one of 'one source', 'all sources' or 'consumer'. |

`nsamples` |
A vector with the sample sizes to simulate. |

`modify` |
The source name to modify (case sensitive). This argument has to be specified when |

`nrep` |
An integer specifying the number of replicates for each sample sizes. Default is 100. |

`interval` |
An integer indicating the width of credible interval to use for precision estimation. Default is 90. |

`name` |
A character string giving the name of the simulation. If NULL the simulation will be named by the time of the simulation. This name will serve to create a directory in which results will be stored. |

`resid_err` |
Boolean indicating if residual error is included in the model. See |

`process_err` |
Boolean indicating if process error is included in the model. See |

`run` |
String or list specifying MCMC parameters. See |

`alpha.prior` |
Numeric. Dirichlet prior on p.global. See |

This function assesses the sensitivity of isotopes mixing models to variation in numbers of samples from source tissues. This tool can be used prior to full-blown studies in a similar manner than power analyses. It used the function `siarmcmcdirichletv4`

developped by Andrew Parnell et al. and available in the package `siar`

. Alternatively, it can be used with the function `run_model`

developped by Brian Stock et al. and available in the package `MixSIAR`

. User can choose to sample one particular source (argument `type`

sets to 'one source') or all the sources in the same type (argument `type`

sets to 'all sources'). User can also choose to modify consumer data (argument `type`

sets to 'consumer'). Sample sizes are modified assuming a normal distribution with a user defined mean and standard deviation. Samples of different sizes are created from this distribution, and mixing proportions are estimated for several replicates of each sample size with the function `siarmcmcdirichletv4`

or `run_model`

.

This function does not return any object in the R console. Results are stored in a directory (argument 'name') and contain four R objects.

`intervals` |
A four dimensions array with the upper and lower bounds of the credible interval for each sample size, replicate and source. First dimension represents lower and upper bounds; second dimension corresponds to the number of sources; third dimension is the number of replicates; and fourth dimension is the number of sample size. |

`widths` |
A three dimensions array with the width (precision) of credible intervals for each source, each replicate and each sample size. First dimension corresponds to the number of replicates; second dimension is the number of sources; and third dimension represents the number of sample size. |

`medians` |
A three dimensions array with the median (estimate) of credible intervals for each source, each replicate and each sample size. Dimensions are the same as for widths object. |

`datasets` |
A four dimensions array with all resampled datasets. |

A logfile is also written and contains all parameters of the simulation.

The use of samplesim with the package MixSIAR requires the installation of the software JAGS. See the `MixSIAR`

documentation for further details.

Nicolas Casajush, Nicolas Lecomte, Dorothee Ehric

Lecomte N., Ehrich D., Casajus N., Berteaux D., Giroux M.-A., Yoccoz N.G. How many is enough? An R package for evaluating the effect of sample size on estimates and precision of stable isotope mixing solutions. Submitted in Methods in Ecology and Evolution.

`plot_samplesim`

, `siarmcmcdirichletv4`

, `run_model`

1 | ```
# See the vignette for a complete example.
``` |

ahasverus/samplesim documentation built on May 20, 2019, 3:28 p.m.

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.