X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=R%2Fmcmc.popsize.R;h=22dafff75fc304eb4fdf2b8652ca2e5e0b208fc1;hb=756ad52b92dc1ac2922cf62ce882469ad4cacc2c;hp=35670a9c27303183c4ec9cd64bc5f382a958551a;hpb=c827059eeafc8cbe41c812b26979543ab287803e;p=ape.git diff --git a/R/mcmc.popsize.R b/R/mcmc.popsize.R index 35670a9..22dafff 100644 --- a/R/mcmc.popsize.R +++ b/R/mcmc.popsize.R @@ -1,11 +1,11 @@ -## mcmc.popsize.R (2004-12-02) +## mcmc.popsize.R (2010-11-16) ## Run reversible jump MCMC to sample demographic histories -## Copyright 2004 Rainer Opgen-Rhein and Korbinian Strimmer +## Copyright 2004-2010 Rainer Opgen-Rhein and Korbinian Strimmer ## Portions of this function are adapted from rjMCMC code by -## Karl Broman (see http://www.biostat.jhsph.edu/~kbroman/) +## Karl W Broman (see http://www.biostat.wisc.edu/~kbroman/) ## This file is part of the R-package `ape'. ## See the file ../COPYING for licensing issues. @@ -160,14 +160,17 @@ mcmc.popsize <- #BEGIN CALCULATION - for(i in (1:nstep + 1)) { - - #progress bar - if(i %% 100 == 0){ - z<-i/nstep - zt<-(i-100)/(nstep) - polygon(c(zt,zt,z,z), c(1,0,0,1), col="black") - + for(i in (1:nstep + 1)) + { + #progress bar + if(progress.bar==TRUE) + { + if(i %% 100 == 0) + { + z<-i/nstep + zt<-(i-100)/(nstep) + polygon(c(zt,zt,z,z), c(1,0,0,1), col="black") + } } # calculate jump probabilities without given lamda @@ -245,7 +248,8 @@ mcmc.popsize <- } if (i %% thinning == 0& i>burn.in) {count.i<-count.i+1} } - dev.off() + + if(progress.bar==TRUE) dev.off() list(pos=save.pos,h=save.h,loglik=save.loglik, steptype=save.steptype,accept=save.accept)