[adegenet-commits] r400 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Jun 15 15:51:35 CEST 2009


Author: jombart
Date: 2009-06-15 15:51:35 +0200 (Mon, 15 Jun 2009)
New Revision: 400

Modified:
   pkg/R/seqTrack.R
Log:
distribution of dates now handles multiple segments


Modified: pkg/R/seqTrack.R
===================================================================
--- pkg/R/seqTrack.R	2009-06-12 12:48:18 UTC (rev 399)
+++ pkg/R/seqTrack.R	2009-06-15 13:51:35 UTC (rev 400)
@@ -294,9 +294,10 @@
 ## .dTimeSeq
 #############
 .dTimeSeq <- function(mu0, L, maxNbDays=100){
-    mu <- mu0/365 # mutation rate / site / day
+    mu <- mu0/365 # mutation rates / site / day
     t <- 0:maxNbDays # in days added / substracted
-    Pt <- (1-mu)^(t*L)
+    temp <- sapply((1-mu)^L, function(x) x^t  )
+    Pt <- apply(temp,1,prod)
     t <- c(-rev(t[-1]), t)
     Pt <- c(rev(Pt[-1]), Pt)
     return(list(t, Pt))



More information about the adegenet-commits mailing list