Learn R Programming

adegenet (version 1.4-2)

gstat.randtest: Goudet's G-statistic Monte Carlo test for genind object

Description

The function gstat.randtest implements Goudet's G-statistic Monte Carlo test (g.stats.glob, package hierfstat) for genind object. The output is an object of the class randtest (package ade4) from a genind object. This procedure tests for genetic structuring of individuals using 3 different schemes (see details).

Usage

gstat.randtest(x,pop=NULL, method=c("global","within","between"),
sup.pop=NULL, sub.pop=NULL, nsim=499)

Arguments

x
an object of class genind.
pop
a factor giving the 'population' of each individual. If NULL, pop is seeked from x@pop. Note that the term population refers in fact to any grouping of individuals'.
method
a character (if a vector, only first argument is kept) giving the method to be applied: 'global', 'within' or 'between' (see details).
sup.pop
a factor indicating any grouping of individuals at a larger scale than 'pop'. Used in 'within' method.
sub.pop
a factor indicating any grouping of individuals at a finer scale than 'pop'. Used in 'between' method.
nsim
number of simulations to be used for the randtest.

Value

  • Returns an object of the class randtest (package ade4).

encoding

UTF-8

Details

This G-statistic Monte Carlo procedure tests for population structuring at different levels. This is determined by the argument 'method': - "global": tests for genetic structuring given 'pop'. - "within": tests for genetic structuring within 'pop' inside each 'sup.pop' group (i.e., keeping sup.pop effect constant). - "between": tests for genetic structuring between 'pop' keeping individuals in their 'sub.pop' groups (i.e., keeping sub.pop effect constant).

See Also

fstat, genind2hierfstat

Examples

Run this code
if(require(hierfstat)){
# here the example of g.stats.glob is taken using gstat.randtest
data(gtrunchier)
x <- df2genind(X=gtrunchier[,-c(1,2)],pop=gtrunchier$Patch)

# test in hierfstat
gtr.test<- g.stats.glob(gtrunchier[,-1])
gtr.test

# randtest version
x.gtest <- gstat.randtest(x,nsim=99)
x.gtest
plot(x.gtest)

# pop within sup.pop test
gstat.randtest(x,nsim=99,method="within",sup.pop=gtrunchier$Locality)

# pop test with sub.pop kept constant
gstat.randtest(x,nsim=99,pop=gtrunchier$Locality,method="between",sub.pop=gtrunchier$Patch)
}

Run the code above in your browser using DataLab