Learn R Programming

inbreedR (version 0.3.1)

g2_microsats: Estimating g2 from microsatellite data

Description

Estimating g2 from microsatellite data

Usage

g2_microsats(genotypes, nperm = 0, nboot = 0, CI = 0.95, verbose = TRUE)

Arguments

genotypes
data.frame with individuals in rows and loci in columns, containing genotypes coded as 0 (homozygote), 1 (heterozygote) and NA (missing)
nperm
Number of permutations for testing the hypothesis that the empirical g2-value is higher than the g2 for random associations between individuals and genotypes.
nboot
Number of bootstraps for estimating a confidence interval
CI
Confidence interval (default to 0.95)
verbose
If FALSE, nothing will be printed to show the status of bootstraps and permutations.

Value

g2_microsats returns an object of class "inbreed". The functions `print` and `plot` are used to print a summary and to plot the distribution of bootstrapped g2 values and CI.An `inbreed` object from g2_microsats is a list containing the following components:
call
function call.
g2
g2 value
p_val
p value from permutation test
g2_permut
g2 values from permuted genotypes
g2_boot
g2 values from bootstrap samples
CI_boot
confidence interval from bootstraps
se_boot
standard error of g2 from bootstraps
nobs
number of observations
nloc
number of markers

Details

Calculates g2 from smaller datasets. The underlying formula is compationally expensive due to double summations over all paits of loci (see David et al. 2007). Use convert_raw to convert raw genotypes (with 2 columns per locus) into the required format.

References

David, P., Pujol, B., Viard, F., Castella, V. and Goudet, J. (2007), Reliable selfing rate estimates from imperfect population genetic data. Molecular Ecology, 16: 2474

Examples

Run this code
data(mouse_msats)
# tranform raw genotypes into 0/1 format
genotypes <- convert_raw(mouse_msats)
(g2_mouse <- g2_microsats(genotypes, nperm = 1000, nboot = 100, CI = 0.95))

Run the code above in your browser using DataLab