예제 #1
0
 def testCar1Defaults(self):
     cppSample = carmcmc.run_mcmc_car1(self.nSample, self.nBurnin,
                                       self.xdata, self.ydata, self.dydata)
     cppSample = carmcmc.run_mcmc_car1(self.nSample, self.nBurnin,
                                       self.xdata, self.ydata, self.dydata,
                                       self.nThin)
     guess = cppSample.getSamples()[0]
     cppSample = carmcmc.run_mcmc_car1(self.nSample, self.nBurnin,
                                       self.xdata, self.ydata, self.dydata,
                                       self.nThin, guess)
예제 #2
0
def doit(args):
    pModel   = int(args[0])
    x, y, dy = args[1]

    nSample    = 10000
    nBurnin    = 1000
    nThin      = 1
    nWalkers   = 10

    # Should not have to do this...
    xv         = carmcmc.vecD()
    xv.extend(x)
    yv         = carmcmc.vecD()
    yv.extend(y)
    dyv        = carmcmc.vecD()
    dyv.extend(dy)

    if pModel == 1:
        sampler = carmcmc.run_mcmc_car1(nSample, nBurnin, xv, yv, dyv, nWalkers, nThin)
        samplep = carmcmc.CarSample1(x, y, dy, sampler)
    else:
        sampler = carmcmc.run_mcmc_carma(nSample, nBurnin, xv, yv, dyv, pModel, 0, nWalkers, False, nThin)
        samplep = carmcmc.CarmaSample(x, y, dy, sampler)
        
    dic = samplep.DIC()
    print "DIC", pModel, dic
    return samplep
예제 #3
0
    def testCar1(self):
        cppSample = carmcmc.run_mcmc_car1(self.nSample, self.nBurnin, self.xdata, self.ydata, self.dydata, self.nThin)
        psampler = carmcmc.Car1Sample(self.x, self.y, self.dy, cppSample)
        self.assertEqual(psampler.p, 1)

        psamples = np.array(cppSample.getSamples())
        ploglikes = np.array(cppSample.GetLogLikes())
        sample0 = carmcmc.vecD()
        sample0.extend(psamples[0])
        logprior0 = cppSample.getLogPrior(sample0)
        loglike0 = cppSample.getLogDensity(sample0)
        self.assertAlmostEqual(ploglikes[0], loglike0)
예제 #4
0
    def testCar1(self):
        cppSample = carmcmc.run_mcmc_car1(self.nSample, self.nBurnin,
                                          self.xdata, self.ydata, self.dydata,
                                          self.nThin)
        psampler = carmcmc.Car1Sample(self.x, self.y, self.dy, cppSample)
        self.assertEqual(psampler.p, 1)

        psamples = np.array(cppSample.getSamples())
        ploglikes = np.array(cppSample.GetLogLikes())
        sample0 = carmcmc.vecD()
        sample0.extend(psamples[0])
        logprior0 = cppSample.getLogPrior(sample0)
        loglike0 = cppSample.getLogDensity(sample0)
        self.assertAlmostEqual(ploglikes[0], loglike0)
예제 #5
0
 def testCar1Defaults(self):
     cppSample = carmcmc.run_mcmc_car1(self.nSample, self.nBurnin, self.xdata, self.ydata, self.dydata)
     cppSample = carmcmc.run_mcmc_car1(self.nSample, self.nBurnin, self.xdata, self.ydata, self.dydata, self.nThin)
     guess     = cppSample.getSamples()[0]
     cppSample = carmcmc.run_mcmc_car1(self.nSample, self.nBurnin, self.xdata, self.ydata, self.dydata, self.nThin, guess)