[adegenet-commits] r345 - pkg/R

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Wed Jun 3 01:02:43 CEST 2009


Author: jombart
Date: 2009-06-03 01:02:42 +0200 (Wed, 03 Jun 2009)
New Revision: 345

Modified:
   pkg/R/seqTrack.R
Log:
default threshold is now automatically set to basic threshold (i.e. with no permutations).
To do full weighted sampling, one has to set a very high threshold. Otherwise we're doing weighted ABC. 


Modified: pkg/R/seqTrack.R
===================================================================
--- pkg/R/seqTrack.R	2009-06-02 22:51:35 UTC (rev 344)
+++ pkg/R/seqTrack.R	2009-06-02 23:02:42 UTC (rev 345)
@@ -388,7 +388,7 @@
 ## 2) VECTORIZE mu0 and seq.length, recycle if needed with a warning
 ## 3) uncomment, adapt, and test code for missing data
 ##
-optimize.seqTrack <- function(nstep, seq.names, seq.dates, W, thres, optim=c("min","max"),
+optimize.seqTrack <- function(nstep, seq.names, seq.dates, W, thres=NULL, optim=c("min","max"),
                               prox.mat=NULL, mu0, seq.length, step.size=1e3,
                               rMissDate=.rUnifTimeSeq, ...){
 
@@ -440,6 +440,13 @@
     }
 
 
+    ## SET THRESHOLD IF NEEDED ##
+    if(is.null(thres)){
+        thres <- sum(seqtrack(seq.names=seq.names, seq.dates=seq.dates, W=W,
+                                    optim=optim, prox.mat=prox.mat, ...)$weight, na.rm=TRUE)
+    }
+
+
     ## AUXILIARY FUNCTIONS ##
 
     ## to compare results -> returns a list of length two: logical, and the value of the res



More information about the adegenet-commits mailing list