Skip to content

Commit

Permalink
caught missing brackets on Gst
Browse files Browse the repository at this point in the history
  • Loading branch information
David Winter committed May 2, 2012
1 parent ce150dc commit b06b4d2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions R/Gst_Hedrick.R
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,13 @@ Gst_Hedrick <- function(x){
hets <- HsHt(g,n) #A private function form mmod
Ht_est <- hets["Ht_est"]
Hs_est <- hets["Hs_est"]
Gprime_st <- (n * (Ht_est - Hs_est)) / (n * Ht_est - Hs_est) * (1 - Hs_est)
Gprime_st <- n * (Ht_est - Hs_est) / ((n * Ht_est - Hs_est) * (1 - Hs_est))
return(c(Hs_est, Ht_est, Gprime_st))
}
loci <- t(sapply(seploc(x), Gst.per.locus))
global_Hs <- mean(loci[,1], na.rm=T)
global_Ht <- mean(loci[,2], na.rm=T)
global_GstH <- (n * (global_Ht - global_Hs)) / (n * global_Ht - global_Hs)*(1-global_Hs)
global_GstH <- n * (global_Ht - global_Hs) / ((n * global_Ht - global_Hs)*(1-global_Hs))
return(list("per.locus"=loci[,3], "global"=global_GstH))

}
Expand Down
4 changes: 2 additions & 2 deletions R/diff_stats.R
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ diff_stats <- function(x, phi_st=FALSE){
Hs_est <- hets["Hs_est"]
G_est <- (Ht_est-Hs_est)/Ht_est
D <- (Ht_est-Hs_est)/(1-Hs_est) * (n/(n-1))
Gprime_st <- (n * (Ht_est - Hs_est)) / (n * Ht_est - Hs_est) * (1 - Hs_est)
Gprime_st <- n * (Ht_est - Hs_est) / ((n * Ht_est - Hs_est) * (1 - Hs_est))
#And the results formated as list
result <- c("Hs" = Hs_est,
"Ht" = Ht_est,
Expand All @@ -67,7 +67,7 @@ diff_stats <- function(x, phi_st=FALSE){
global <- c(Hs = global_Hs,
Ht = global_Ht,
Gst_est = global_G_est,
"Gprime_st"= (n * (global_Ht - global_Hs)) / (n * global_Ht - global_Hs)*(1-global_Hs),
"Gprime_st"= n * (global_Ht - global_Hs) / ((n * global_Ht - global_Hs)*(1-global_Hs)),
"D_het" = (global_Ht - global_Hs)/(1 - global_Hs ) * (n/(n-1)),
"D_mean"= harmonic_mean(loci[,5]))

Expand Down
Binary file added mmod_0.3.tar.gz
Binary file not shown.

0 comments on commit b06b4d2

Please sign in to comment.