calc.betahat: This calculates beta-hat, the Fst value used in Lositan.

Description Usage Arguments Value Examples

View source: R/fsthet.R

Description

This calculates Weir & Cockerham (1993)'s beta-hat. Beaumont & Nichols (1996) used this formulation in FDIST2 (and is implemented in Lositan) See the vignette for details on the calculation of beta.

Usage

1

Arguments

df

A dataframe containing the genepop information, where the first column is the population ID.

i

Column number containing genotype information.

Value

ht

HB (or 1-F1). This is a single numerical value.

fst

The calculated betahat value ((F0-F1)/(1-F1))for this locus.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
   gpop<-data.frame(popinfo=c(rep("POP 1", 20),rep("POP 2", 20)),ind.names=c(1:20,1:20))
     for(i in 1:40){
      gpop[1:20,(i+2)]<-sample(c("0101","0102","0202"),20,replace=TRUE)
      gpop[21:40,(i+2)]<-sample(c("0101","0102","0202"),20,replace=TRUE)
     }
  bh<-calc.betahat(gpop, 3) #calculate betahat for the SNP
  
    gfile<-system.file("extdata", "example.genepop.txt",package = 'fsthet')
    gpop<-my.read.genepop(gfile)
    beta1<-calc.betahat(gpop,3) #calculate betahat for the first SNP
  

fsthet documentation built on Nov. 17, 2017, 4:23 a.m.