Learn R Programming

strataG (version 2.4.905)

popStructTest: Population Differentiation Tests

Description

Conduct overall and/or pairwise tests of population differentiation.

Usage

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

Examples

Run this code
# NOT RUN {
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)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab