| gl.fst.pop | R Documentation |
Calculates the pairwise fixation index Fst between every pair of populations in a genlight object, with optional bootstrap confidence intervals and p-values obtained by resampling loci.
gl.fst.pop(x, nboots = 1, percent = 95, nclusters = 1, verbose = NULL)
x |
Name of the genlight containing the SNP genotypes [required]. |
nboots |
Number of bootstrap replicates over loci used to generate confidence intervals and p-values. A whole number; 1 returns the point estimates alone [default 1]. |
percent |
Percentile to calculate the confidence interval around, greater than 0 and less than 100 [default 95]. |
nclusters |
Ignored. It set the number of cores used by StAMPP, which is no longer called; kept so that existing calls still work [default 1]. |
verbose |
Verbosity: 0, silent or fatal errors; 1, begin and end; 2, progress log; 3, progress and results summary; 5, full report [default NULL, adopting the global verbosity set by gl.set.verbosity(), or 2 if no global is set]. |
The statistic is Weir and Cockerham's (1984) theta, estimated from allele
frequencies, observed heterozygosities and per-locus sample sizes
computed separately for each population. The estimator is the one of
stamppFst and gives identical values; it is
computed by dartR from blocks of loci, so file-backed objects (see
gl.gen2fbm) are not converted to memory, and it is much
faster. Theta is a variance-components estimator that corrects for
unequal sample sizes, so it is not the same quantity as the Nei (1987)
Gst-family statistics reported by gl.report.fstat under the
same word "Fst"; the two can differ substantially on unevenly sampled
data. Loci missing from one member of a pair contribute nothing to that
pair.
Bootstrap. When nboots is greater than 1 the function
resamples loci with replacement, nLoc at a time, and recomputes
theta on each replicate with the same estimator that produced the point
estimate. The locus is the unit of resampling because it is the unit the
variance components are summed over. The replicates are drawn in the
calling session, so set.seed() immediately before the call makes
the confidence limits and the p-values reproducible. There is no
seed parameter. The point estimates do not depend on the bootstrap
and are the same whatever nboots is set to.
Confidence limits. The limits are the order statistics of the
sorted replicates at positions ceiling(a * nboots) and
floor((1 - a) * nboots), where a = ((100 - percent)/100)/2.
At the default percent = 95 the lower position is 1 for every
nboots up to 40, so with 40 or fewer replicates the reported lower
limit is the smallest replicate rather than the 2.5th percentile and the
interval is the observed range. The function warns at
verbose >= 1 whenever the requested percentile cannot be reached.
P-values. The p-value for a pair is the one-tailed bootstrap
fraction mean(replicates <= 0): the proportion of replicate thetas
at or below zero. Its resolution is 1/nboots, and it can be
exactly 0 or exactly 1. A p of 1 means every replicate was at or below
zero, which is what undifferentiated populations produce; it is a failure
to reject, not evidence of no differentiation. No correction for multiple
testing is applied across the nPop*(nPop-1)/2 pairs tested, which
is 435 pairs for a 30-population object. Apply one yourself if the
pairwise tests are to be read as a family.
Non-finite pairs. A pair returns NaN when the estimator cannot
be formed, most often because a population holds a single individual or
because no locus is polymorphic in the pair. Such pairs are named at
verbose >= 1.
A base matrix of class c("matrix", "array") when
nboots is 1: nPop x nPop, with the pairwise theta values in the
lower triangle and NA on the diagonal and in the upper triangle. It is
not an object of class dist. Rows and columns are named by
population in order of first appearance in the data, not in factor-level
order. Use as.matrix(as.dist(fsts)) for a symmetric square matrix.
When nboots is greater than 1, a list of three elements:
Fsts - the same lower-triangular nPop x nPop matrix.
Pvalues - an nPop x nPop matrix of p-values, lower triangle
populated.
Bootstraps - a data frame with one row per pair of
populations and columns "Population1", "Population2", the nboots
replicate thetas sorted in increasing order, "Lower bound CI limit",
"Upper bound CI limit", "p-value" and "Fst".
Author(s): Bernd Gruber. Custodian: Bernd Gruber – Post to https://groups.google.com/d/forum/dartr
Weir, B.S. and Cockerham, C.C. (1984). Estimating F-statistics for the analysis of population structure. Evolution 38, 1358-1370.
gl.report.fstat, which reports the Nei (1987)
Gst-family statistics Fst, Fstp, Dest and Gst_H rather than the Weir and
Cockerham theta returned here.
Other distance:
gl.dist.ind(),
gl.dist.pop(),
gl.propShared(),
utils.dist.ind.snp()
if (isTRUE(getOption("dartR_fbm"))) platypus.gl <- gl.gen2fbm(platypus.gl)
test <- gl.filter.callrate(platypus.gl,threshold = 1)
test <- gl.filter.monomorphs(test)
out <- gl.fst.pop(test, nboots=1)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.