50% off | Unlimited Data & AI Learning
Get 50% off unlimited learning

fsthet (version 1.0.1)

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

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

calc.betahat(df, i)

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

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

Run the code above in your browser using DataLab