calc_fis: Calculate FIS for individual populations.

calc_fisR Documentation

Calculate FIS for individual populations.

Description

Calculates FIS for each individual level in each provided sample facet according to Weir and Cockerham (1984).

Usage

calc_fis(
  x,
  facets = NULL,
  boot = FALSE,
  boot_par = FALSE,
  boot_alt = "two-sided",
  keep_components = FALSE
)

Arguments

x

snpRdata. Input SNP data.

facets

character. Categorical metadata variables by which to break up analysis. See Facets_in_snpR for more details.

boot

numeric or FALSE, default FALSE. The number of bootstraps to do. See details.

boot_par

numeric or FALSE, default FALSE. If a number, bootstraps will be processed in parallel using the supplied number of cores.

boot_alt

character, default "two-sided". The type of t-test to conduct on the bootstrapped FIS values. Options:

  • two-sided: A two-sided t-test, with the alternative hypothesis that FIS is not equal to 0.

  • greater: A one-sided t-test, with the alternative hypothesis that FIS is greater than 0.

  • less: A one-sided t-test, with the alternative hypothesis that FIS is less than 0.

keep_components

logical, default FALSE. If TRUE, the variance components "b" and "c" will be held and accessible from the $single element (named "var_comp_b" and "var_comp_c", respectively) using the usual get.snpR.stats method. This may be useful if working with very large datasets that need to be run with separate objects for each chromosome, etc. for memory purposes. Weighted averages can be generated identically to those from snpR by taking one minus the weighted mean (via the weighted.mean) of "c" divided by the sum of the weighted mean of "b" + "c" using the number of SNPs called in a comparison (returned in the "nk" column from get.snpR.stats) as weights within each population comparison. Note that this is different than taking the weighted mean of 1 - c/(b + c)!

Details

Note that FIS is calculated by considering only data from individual sample levels! This means that individual and sub-population variances are only considered within each sub-population. If snp facets are provided, weighted means will be provided for each snp facet level, although raw FIS values are calculated on a per-snp basis and thus ignore these levels.

If the base facet (facets = NULL or facets = ".base") is requested, FIS will compare individual to total variance across all samples instead (equivalent to overall FIT).

Bootstrapping across loci can be done to assess FIS significance. This is done by re-drawing loci randomly with replacement for each facet level, calculating the resulting FIS values, and doing one sample t-test with the null hypothesis that FIS = 0 to calculate p-values.

Author(s)

William Hemstrom

References

Weir and Cockerham (1984). Evolution

Examples

x <- calc_fis(stickSNPs, c("pop", "pop.chr"))
get.snpR.stats(x, c("pop", "pop.chr"), "fis")


hemstrow/snpR documentation built on March 20, 2024, 7:03 a.m.