Learn R Programming

diveRsity (version 1.9.89)

basicStats: Claculate basic descriptive population parameters from a genepop genotype file

Description

A new and improved version of divBasic, with a more comprehensive set of control arguments, as well as better memory and CPU efficiency. Additional options for testing homozygosity/heterozygosity excess are also provided.

Usage

basicStats(infile = NULL, outfile = NULL, fis_ci = FALSE, ar_ci = FALSE, fis_boots = NULL, ar_boots = NULL, mc_reps = 9999, rarefaction = TRUE, ar_alpha = 0.05, fis_alpha = 0.05)

Arguments

infile
Specifying the name of the `genepop'(Rousset, 2008) file from which the statistics are to be calculated. This file can be in either the 3 digit of 2 digit format, and must contain only one whitespace separator (e.g. “space” or “tab”) between each column including the individual names column. The number of columns must be equal to the number of loci + 1 (the individual names column). If this file is not in the working directory the file path must be given. The name must be a character string (i.e. enclosed in “” or `').
outfile
A character string specifying the name to be given to the output tab delimited file. Default value of NULL means that no file is written.
fis_ci
A logical argument specifying whether confidence limits should be calculated for the inbreeding coefficient.
ar_ci
A logical argument specifying whether confidence limits should be calculated for resampleed allelic richness. Only valid when rarefaction = FALSE.
fis_boots
An integer specifying the number of bootstrap replicate used to calculate confidence limits for the inbreeding coefficient if fis_ci = TRUE
ar_boots
An integer specifying the number of bootstrap replicate used to calculate confidence limits for allelic richness if ar_ci = TRUE and rarefaction = FALSE
mc_reps
An integer specifying the number of Monte Carlo replicates used when carrying out psudo-exact HWE tests
rarefaction
A logical indicating whether allelic richness should be calculated using rarefaction. If FALSE user should specify the number of ar_boots to use when estimating allelic richness using the resample method
ar_alpha
A numeric argument specifying the alpha used to calculate the confidence interval for resample based allelic richness. Valid if rarefaction = FALSE, ar_boots > 2 and ar_ci = TRUE. Confidence limits are defined as alpha/2 and 1-(alpha/2).
fis_alpha
A numeric argument specifying the alpha used to calculate the confidence interval for resample based allelic richness. Valid if fis_boots > 2 and fis_ci = TRUE. Confidence limits are defined as alpha/2 and 1-(alpha/2).

Value

A list of results

Details

HWE tests are carried out using methods originally implemented in the package HWxtest. Test of HWE proportions are either carried out using either exact testing (when the number of genotype tables is less than 10 million), or through Monte Carlo simulations, where the number of random trials can be specified using the argument mc_reps. HWE tests will also be automatically carried out to assess homozygosity/hetrozygosity excess (i.e. one tailed tests). The test results returned is automatically determined by the proporties of the original data. See ?HWx.test for more details.

References

Rousset, F., ``genepop'007: a complete re-implementation of the genepop software for Windows and Linux.,'' Molecular ecology resources, vol. 8, no. 1, pp. 103-6, (2008).

Bill Engels (2014). HWxtest: Exact Tests for Hardy-Weinberg Proportions. R package version 1.0.5. http://CRAN.R-project.org/package=HWxtest

Examples

Run this code
## Not run: 
# # To run an example use the following format
# library("diveRsity")
# data(Test_data)
# test_results <- basicStats(infile = Test_data, outfile = "test_run", 
#                            fis_ci = TRUE, ar_ci = TRUE, fis_boots = 999, 
#                            ar_boots = 999, mc_reps = 9999, 
#                            rarefaction = FALSE, ar_alpha = 0.05, 
#                            fis_alpha = 0.05)
# ## End(Not run)

Run the code above in your browser using DataLab