popStructTest: Population Differentiation Tests

Description Usage Arguments Value Note Author(s) Examples

View source: R/popStructTest.R

Description

Conduct overall and/or pairwise tests of population differentiation.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
popStructTest(
  g,
  nrep = 1000,
  stats = "all",
  type = c("both", "overall", "pairwise"),
  keep.null = FALSE,
  quietly = FALSE,
  max.cores = 1,
  write.output = FALSE,
  ...
)

overallTest(
  g,
  nrep = 1000,
  stats = "all",
  keep.null = FALSE,
  quietly = FALSE,
  max.cores = 1,
  ...
)

pairwiseTest(
  g,
  nrep = 1000,
  stats = "all",
  keep.null = FALSE,
  quietly = FALSE,
  max.cores = 1,
  ...
)

Arguments

g

a gtypes object.

nrep

number specifying number of permutation replicates to use for permutation test.

stats

a character vector or list of functions specifying which anlayses to conduct. If characters, then valid possible choices are: "phist", "fst", "fst.prime", "fis", "gst", "gst.prime", "gst.dbl.prime", "d", or "chi2", or "all". If a list, then functions must be a valid population structure function (see popStructStat) taking a gtypes object and returning a named statistic estimate.

type

character determining type of test to conduct. Can be "overall", "pairwise", or "both". If "pairwise" or "both" are chosen and there are only two strata, then only an overall test will be conducted.

keep.null

logical. Keep the null distribution from the permutation test?

quietly

logical. Print progress and results?

max.cores

The maximum number of cores to use to distribute separate statistics over. The number of cores to use to distribute separate statistics over. If set to NULL, the value will be what is reported by detectCores - 1. If detectCores reports NA, max.cores will be set to 1.

write.output

logical. Write a .csv file with results?

...

other parameters to be passed to population differentiation functions.

Value

overall

a list containing:

strata.freq

a vector of the sample sizes for each stratum

result

a matrix with the statistic estimate and p-value for each statistic

null.dist

a matrix with the null distributions for each statistic

pairwise

a list containing:

result

a data.frame with the result of each pairwise comparison on each row

pair.mat

a list with a pairwise matrix for each statistic. Values in lower left are the statistic estimate, and upper right are p-values

null.dist

a matrix with the null distributions for each statistic

Note

On multi-core systems, runs of separate statistics are automatically distributed over as many cores as available (minus one). This can be controlled by the max.cores argument if less core usage is desired.

Author(s)

Eric Archer eric.archer@noaa.gov

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
data(msats.g)
msats.g <- stratify(msats.g, "fine")

# Just an overall Chi-squared test
ovl <- overallTest(msats.g, stats = "chi2", nrep = 100)
ovl

#' Just a pairwise test for Gst
pws <- pairwiseTest(msats.g, stats = "gst", nrep = 100)
pws

## Not run: 
#' Both overall and pairwise tests for Fst and F'st
full <- popStructTest(msats.g, stats = c("fst", "fst.prime"))
print(full$overall)
print(full$pairwise)

## End(Not run)

strataG documentation built on Feb. 28, 2020, 9:07 a.m.