def write_parametric(f, Bpar, runtime): outs = "%g %g %g " % (Bpar.estimate[0],Bpar.getCI(1,(.025,)),Bpar.getCI(1,(.975))) # m.par.e m.par.l m.par.h outs += "%g %g %g " % (Bpar.estimate[1],ptile(Bpar.mcestimates[:,1],2.5),ptile(Bpar.mcestimates[:,1],97.5)) # w.par.e w.par.l w.par.h outs += "%g %g %g " % (Bpar.deviance, ptile(Bpar.mcdeviance,95), psigcorrect.estimate_nu (Bpar)[0]) # d.par d.par.crit nu.par outs += "%g %g %g " % (Bpar.Rpd,ptile(Bpar.mcRpd,2.5),ptile(Bpar.mcRpd,97.5)) # rpd.par rpd.par.l rpd.par.h outs += "%g %g %g " % (Bpar.Rkd,ptile(Bpar.mcRkd,2.5),ptile(Bpar.mcRkd,97.5)) # rkd.par rkd.par.l rkd.par.h outs += ("%g "*options.nblocks) % tuple(Bpar.infl) outs += "%g " % runtime f.write(outs)
def write_bayes(f, mcmc, mcmc_conv, runtime): outs = "%g %g %g %g %g " % ( mcmc.estimate[0], # m.bay.m mcmc.mapestimate[0], # m.bay.map mcmc.posterior_median[0],# m.bay.median mcmc.getCI(1,(.025,)), # m.bay.l mcmc.getCI(1,(.975))) # m.bay.h outs += "%g %g %g %g %g " % ( mcmc.estimate[1], # w.bay.m mcmc.mapestimate[1], # w.bay.map mcmc.posterior_median[1], # w.bay.median ptile(mcmc.mcestimates[:,1],2.5), # w.bay.l ptile(mcmc.mcestimates[:,1],97.5)) # w.bay.h outs += "%g %g %g " % (mcmc.deviance,mcmc.bayesian_p('deviance'), psigcorrect.estimate_nu (mcmc)[0]) # d.bay d.bay.p outs += "%g %g " % (mcmc.Rpd,mcmc.bayesian_p('Rpd')) # d.rpd d.rpd.p outs += "%g %g " % (mcmc.Rkd,mcmc.bayesian_p('Rkd')) # d.rkd d.rkd.p outs += "%d %g %g %g " % (mcmc_conv,mcmc.Rhat(0),mcmc.Rhat(1),mcmc.Rhat(2)) outs += ("%g "*options.nblocks) % tuple(mcmc.infl) outs += "%g " % runtime f.write(outs)
def write_bayes(f, mcmc, mcmc_conv, runtime): outs = "%g %g %g %g %g " % ( mcmc.estimate[0], # m.bay.m mcmc.mapestimate[0], # m.bay.map mcmc.posterior_median[0], # m.bay.median mcmc.getCI(1, (.025, )), # m.bay.l mcmc.getCI(1, (.975))) # m.bay.h outs += "%g %g %g %g %g " % ( mcmc.estimate[1], # w.bay.m mcmc.mapestimate[1], # w.bay.map mcmc.posterior_median[1], # w.bay.median ptile(mcmc.mcestimates[:, 1], 2.5), # w.bay.l ptile(mcmc.mcestimates[:, 1], 97.5)) # w.bay.h outs += "%g %g %g " % (mcmc.deviance, mcmc.bayesian_p('deviance'), psigcorrect.estimate_nu(mcmc)[0]) # d.bay d.bay.p outs += "%g %g " % (mcmc.Rpd, mcmc.bayesian_p('Rpd')) # d.rpd d.rpd.p outs += "%g %g " % (mcmc.Rkd, mcmc.bayesian_p('Rkd')) # d.rkd d.rkd.p outs += "%d %g %g %g " % (mcmc_conv, mcmc.Rhat(0), mcmc.Rhat(1), mcmc.Rhat(2)) outs += ("%g " * options.nblocks) % tuple(mcmc.infl) outs += "%g " % runtime f.write(outs)
def write_parametric(f, Bpar, runtime): outs = "%g %g %g " % (Bpar.estimate[0], Bpar.getCI( 1, (.025, )), Bpar.getCI(1, (.975))) # m.par.e m.par.l m.par.h outs += "%g %g %g " % (Bpar.estimate[1], ptile( Bpar.mcestimates[:, 1], 2.5), ptile(Bpar.mcestimates[:, 1], 97.5) ) # w.par.e w.par.l w.par.h outs += "%g %g %g " % (Bpar.deviance, ptile( Bpar.mcdeviance, 95), psigcorrect.estimate_nu(Bpar)[0] ) # d.par d.par.crit nu.par outs += "%g %g %g " % (Bpar.Rpd, ptile(Bpar.mcRpd, 2.5), ptile(Bpar.mcRpd, 97.5) ) # rpd.par rpd.par.l rpd.par.h outs += "%g %g %g " % (Bpar.Rkd, ptile(Bpar.mcRkd, 2.5), ptile(Bpar.mcRkd, 97.5) ) # rkd.par rkd.par.l rkd.par.h outs += ("%g " * options.nblocks) % tuple(Bpar.infl) outs += "%g " % runtime f.write(outs)