In [1]:
% matplotlib inline
from scipy.stats import invgamma
from scipy.stats import norm
from multiprocessing import Pool
from datetime import datetime
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt

In [6]:
def integral(estimate, ts):
    elements = np.ones(len(ts) - 1)
    for i in range(len(ts) - 1):
        elements[i] = (ts[i+1] - ts[i])*(estimate[i+1] + estimate[i])/2
    return sum(elements)

def sum1(beta):
    return np.sum(p[:, 0] - beta * p[:, 3])

def sum2(alpha):
    return np.sum(p[:, 3] * (p[:, 0] - alpha))

def sum3(alpha, beta):
    l = (p[:, 0] - alpha - beta*p[:, 3])
    return np.sum(l * l )

def loglike(alpha, beta, sigma):
    return N*np.log(1/(np.sqrt(2*np.pi*sigma))) - sum3(alpha, beta) / (2*sigma)

def function1(u):
    alphas = np.ones(sample_iter)
    betas = np.ones(sample_iter)
    sigmas = np.ones(sample_iter)
    estimates = np.ones(n+1)
    
    if u < m:
        r = np.random.RandomState(u)

        for i in range(n+1):
            t = ts[i]
            
            if i == 0:
                alphas[0] = 3000
                betas[0] = 185
                sigmas[0] = 90000

            else:
                alphas[0] = np.mean(alpha_sample)
                betas[0] = np.mean(beta_sample)
                sigmas[0] = np.mean(sigma_sample)

            for j in range(sample_iter -1):

                location_alpha = (sigma_alpha*t*sum1(betas[j]) + sigmas[j]*mu_alpha) / (sigma_alpha * N*t + sigmas[j])
                scale_alpha = np.sqrt((sigma_alpha * sigmas[j]) / (sigma_alpha * N*t + sigmas[j]))
                alphas[j+1] = r.normal(loc = location_alpha, scale = scale_alpha)

                location_beta = (sigma_beta * t * sum2(alphas[j+1]) + sigmas[j] * mu_beta) / (sigma_beta *t* ssx + sigmas[j])
                scale_beta = np.sqrt((sigmas[j] * sigma_beta) / (sigma_beta *t* ssx + sigmas[j]))
                betas[j+1] = r.normal(loc = location_beta, scale = scale_beta)

                shape = N*t/2 + a
                invrate = 2*b / (b*t*sum3(alphas[j+1], betas[j+1]) + 2)
                sigmas[j+1] = invgamma.rvs(a = shape, scale = 1/ invrate, random_state = r)

            alpha_sample = alphas[burn_in:]
            beta_sample = betas[burn_in:len(betas)]
            sigma_sample = sigmas[burn_in:len(sigmas)]

            box = np.ones(len(alpha_sample))
            for k, l in enumerate(alpha_sample):
                box[k] = loglike(l, beta_sample[k], sigma_sample[k])
                
            estimates[i] = np.average(box)
    
    #print(estimates)
    return estimates
    
def sum4(beta):
    return np.sum(p[:, 0] - beta * p[:, 4])

def sum5(alpha):
    return np.sum(p[:, 4] * (p[:, 0] - alpha))

def sum6(alpha, beta):
    l = (p[:, 0] - alpha - beta*p[:, 4])
    return np.sum(l * l )  

def loglike2(alpha, beta, sigma):
    return N*np.log(1/(np.sqrt(2*np.pi*sigma))) - sum6(alpha, beta) / (2*sigma)
    
def function2(w):
    gammas = np.ones(sample_iter)
    deltas = np.ones(sample_iter)
    taus = np.ones(sample_iter)
    estimates = np.ones(n+1)
    
    if w < m:
        r = np.random.RandomState(w)

        for i in range(n+1):
            t = ts[i]
            
            if i == 0:
                gammas[0] = 3000
                deltas[0] = 185
                taus[0] = 90000

            else:
                gammas[0] = np.mean(gamma_sample)
                deltas[0] = np.mean(delta_sample)
                taus[0] = np.mean(tau_sample)

            for j in range(sample_iter - 1):

                location_alpha = (sigma_alpha*t*sum4(deltas[j]) + taus[j]*mu_alpha) / (sigma_alpha * N*t + taus[j])
                scale_alpha = np.sqrt((sigma_alpha * taus[j]) / (sigma_alpha * N*t + taus[j]))
                gammas[j+1] = r.normal(loc = location_alpha, scale = scale_alpha)

                location_beta = (sigma_beta * t * sum5(gammas[j+1]) + taus[j] * mu_beta) / (sigma_beta *t* ssz + taus[j])
                scale_beta = np.sqrt((taus[j] * sigma_beta) / (sigma_beta *t* ssz + taus[j]))
                deltas[j+1] = r.normal(loc = location_beta, scale = scale_beta)

                shape = N*t/2 + a
                invrate = 2*b / (b*t*sum6(gammas[j+1], deltas[j+1]) + 2)
                taus[j+1] = invgamma.rvs(a = shape, scale = 1/ invrate, random_state = r)

            gamma_sample = gammas[burn_in:]
            delta_sample = deltas[burn_in:len(deltas)]
            tau_sample = taus[burn_in:len(taus)]

            box2 = np.ones(len(gamma_sample))
            for k, l in enumerate(gamma_sample):
                box2[k] = loglike2(l, delta_sample[k], tau_sample[k])

            estimates[i] = np.average(box2)
        
    return estimates

In [25]:
pine = pd.read_table("pine.txt", delim_whitespace = True)
p = pine.values
pine['ave_x'] = pine['x'] - np.average(p[:, 1])
pine['ave_z'] = pine['z'] - np.average(p[:, 2])
p = pine.values

mu_alpha = 3000
sigma_alpha = 10**6
mu_beta = 185
sigma_beta = 10**4
a = 3
b = 1/(2*300**2)

N = np.shape(p)[0]
ssx = np.sum(p[:, 3] * p[:, 3])
ssz = np.sum(p[:, 4] * p[:, 4])

n = 10
c = 2
ts = [(i/n)**c for i in range(n+1)]

####ここをいじってね。
sample_iter = 10000
burn_in = 3000
m = 100
####

computing BF

model1 marginal likelihood by power posterior


In [26]:
result1 = Pool().map(function1, range(m))

In [27]:
result1


Out[27]:
[array([-712.90867573, -372.61009972, -328.18147337, -316.25172717,
        -311.28192504, -308.59079483, -307.14042616, -306.14401568,
        -305.53065908, -305.06570075, -304.77933389]),
 array([-731.57933428, -372.64323895, -327.89788689, -316.30742987,
        -311.1736021 , -308.56156683, -307.10796589, -306.18928041,
        -305.5628934 , -305.06322227, -304.74301861]),
 array([-739.05710425, -372.79006872, -328.24501091, -316.36428212,
        -311.17930349, -308.63922202, -307.13520879, -306.16589182,
        -305.54236442, -305.10682422, -304.74921227]),
 array([-717.07005732, -371.74760255, -327.59756307, -316.32364024,
        -311.30811801, -308.53843636, -307.14473181, -306.19427728,
        -305.48172093, -305.08700476, -304.73737777]),
 array([-723.31573513, -371.98300228, -328.16254796, -316.40290505,
        -311.16635796, -308.74129163, -307.16256751, -306.16725593,
        -305.50405166, -305.0618352 , -304.72004214]),
 array([-724.55995481, -371.19487477, -328.01438732, -316.23934632,
        -311.32593109, -308.61568985, -307.04183086, -306.19739089,
        -305.58267496, -305.09336088, -304.73624991]),
 array([-738.27392457, -371.76182348, -327.52130314, -316.2144179 ,
        -311.24036631, -308.63081104, -307.13695178, -306.20080147,
        -305.49011206, -305.06302592, -304.74347995]),
 array([-729.44065085, -370.56270942, -327.82649618, -316.13735732,
        -311.34113659, -308.63053429, -307.19481785, -306.24208339,
        -305.5491102 , -305.0588276 , -304.74728652]),
 array([-737.56130718, -371.23387478, -327.9608117 , -316.20557226,
        -311.25698137, -308.66926794, -307.09910152, -306.15384063,
        -305.54892728, -305.05784148, -304.76184093]),
 array([-735.53413791, -371.23429581, -327.53649304, -316.25509507,
        -311.18241651, -308.69679917, -307.09959845, -306.20502928,
        -305.51907734, -305.09569585, -304.74649704]),
 array([-722.96930117, -372.84993607, -328.23902016, -316.20493795,
        -311.06300275, -308.58308947, -307.17638792, -306.199933  ,
        -305.55115731, -305.07765563, -304.74456168]),
 array([-719.50003166, -371.76872349, -328.01360822, -316.37010173,
        -311.22641091, -308.74074907, -307.15357444, -306.16493341,
        -305.53748779, -305.08516213, -304.74463544]),
 array([-736.71149962, -372.24458868, -328.55471751, -316.34618806,
        -311.37389345, -308.69701819, -307.07789217, -306.10562645,
        -305.52931466, -305.06267019, -304.75246386]),
 array([-736.8365816 , -372.23602108, -328.38781921, -316.42178674,
        -311.36404486, -308.6873757 , -307.12681847, -306.18285829,
        -305.50006764, -305.07175441, -304.75465132]),
 array([-725.59825178, -371.38745518, -328.33414883, -316.40966072,
        -311.20228191, -308.68613966, -307.07498091, -306.16043615,
        -305.55343726, -305.07915886, -304.74086339]),
 array([-743.03862181, -373.00496754, -328.35084026, -316.19477326,
        -311.17045735, -308.59989169, -307.1833858 , -306.16437489,
        -305.52257223, -305.07596143, -304.74957684]),
 array([-739.69851817, -372.6984885 , -328.02339954, -316.34231661,
        -311.21656185, -308.6356836 , -307.06502091, -306.15637386,
        -305.51551308, -305.05546735, -304.75922571]),
 array([-742.99142811, -372.72939023, -327.95384857, -316.19848784,
        -311.26640855, -308.63836243, -307.17565096, -306.17826258,
        -305.53469518, -305.05359019, -304.74430192]),
 array([-725.36535012, -371.92464151, -328.17402729, -316.1958309 ,
        -311.32204324, -308.59615325, -307.16281376, -306.18680776,
        -305.5517262 , -305.08857395, -304.7358004 ]),
 array([-726.81663079, -372.46948881, -328.20530082, -316.27493172,
        -311.19613189, -308.69138262, -307.04336028, -306.1272117 ,
        -305.50770267, -305.05800869, -304.74692838]),
 array([-730.59369785, -370.61372307, -328.00638314, -316.2598287 ,
        -311.19395203, -308.67120257, -307.10453943, -306.18062187,
        -305.54412824, -305.07398359, -304.76442363]),
 array([-729.39271118, -372.09183584, -328.48009647, -316.28412622,
        -311.32942704, -308.6004444 , -307.10387949, -306.13759271,
        -305.5259296 , -305.07413762, -304.74649053]),
 array([-733.02889582, -370.38100958, -327.74157016, -316.20642875,
        -311.14591208, -308.64592301, -307.15346697, -306.19696817,
        -305.52203208, -305.04693905, -304.75811943]),
 array([-732.09323966, -373.14118561, -327.86075618, -316.22109731,
        -311.30675459, -308.60592861, -307.11113825, -306.16308668,
        -305.54767015, -305.07890604, -304.72456546]),
 array([-737.50999628, -372.52457149, -328.18037413, -316.20735332,
        -311.21611152, -308.75822173, -307.06181161, -306.14145407,
        -305.5288261 , -305.0624406 , -304.76402868]),
 array([-723.94420615, -371.08891793, -327.91630403, -316.29218649,
        -311.25983165, -308.79584458, -307.15314751, -306.15322824,
        -305.51538459, -305.07111397, -304.73237751]),
 array([-732.64121496, -370.91078377, -328.17485088, -316.41222752,
        -311.47513895, -308.66283206, -307.09375803, -306.14866279,
        -305.49681148, -305.05143976, -304.72951801]),
 array([-734.13790405, -371.77936638, -328.21652111, -316.19540006,
        -311.36712425, -308.69348228, -307.13030227, -306.13960307,
        -305.50151491, -305.05848291, -304.72586959]),
 array([-732.31809044, -371.20442545, -327.93457697, -316.28997398,
        -311.14712278, -308.69321259, -307.01628567, -306.16587937,
        -305.54717274, -305.09837901, -304.74113123]),
 array([-736.81831989, -371.8171485 , -328.32832442, -316.36691053,
        -311.16568528, -308.54247056, -307.1083341 , -306.20101393,
        -305.48122581, -305.1055459 , -304.73204689]),
 array([-726.13007661, -372.65398592, -328.28705148, -316.12500001,
        -311.43777811, -308.58126089, -307.13804364, -306.18622581,
        -305.52632043, -305.07439724, -304.74145933]),
 array([-735.04851659, -372.59800492, -327.85737568, -316.44826156,
        -311.27364614, -308.69002262, -307.15254966, -306.15938346,
        -305.50747655, -305.06232529, -304.74234524]),
 array([-744.12162882, -371.86824265, -328.47718793, -316.41029772,
        -311.30682317, -308.68722804, -307.09537979, -306.19104027,
        -305.57840556, -305.06534165, -304.72782799]),
 array([-726.93248218, -371.98702619, -327.97966734, -316.31455204,
        -311.25395593, -308.74436215, -307.10318831, -306.15364476,
        -305.53863677, -305.07002846, -304.74284678]),
 array([-731.08081889, -371.65965998, -327.54358677, -316.24751244,
        -311.22639549, -308.72213052, -307.19964357, -306.16238645,
        -305.51250808, -305.05958715, -304.76385243]),
 array([-738.03712124, -371.83179677, -327.95272212, -316.27522783,
        -311.40110486, -308.6660247 , -307.19377846, -306.12161712,
        -305.52788774, -305.05200161, -304.72142551]),
 array([-723.74940715, -372.80390675, -327.9663945 , -316.30712573,
        -311.37717352, -308.61694287, -307.14002873, -306.1998082 ,
        -305.521462  , -305.03393338, -304.74146135]),
 array([-730.08236323, -372.3027467 , -328.37754317, -316.26334516,
        -311.16562595, -308.69158162, -307.07206779, -306.18209712,
        -305.56189758, -305.0637418 , -304.74417274]),
 array([-741.49577164, -371.78503327, -327.64791409, -316.4641839 ,
        -311.36494101, -308.61042538, -307.20006943, -306.20690668,
        -305.53072134, -305.06809301, -304.76566378]),
 array([-735.99630645, -372.40144546, -328.09587653, -316.19927161,
        -311.41303277, -308.60250416, -307.19545082, -306.16711651,
        -305.45262416, -305.06207267, -304.73016131]),
 array([-731.61110046, -372.95060105, -328.60567706, -316.25223556,
        -311.25197424, -308.6865867 , -307.09976258, -306.21032555,
        -305.51220195, -305.07709156, -304.74718451]),
 array([-730.57371758, -373.59653023, -327.87483347, -316.29920218,
        -311.28032737, -308.74774964, -307.1837604 , -306.1761184 ,
        -305.56773085, -305.05271859, -304.77561764]),
 array([-729.52567965, -371.39348327, -328.10335132, -316.20363858,
        -311.39444316, -308.65081021, -307.18047024, -306.12391898,
        -305.52601578, -305.03233855, -304.76110908]),
 array([-733.98265168, -371.71270487, -328.20617877, -316.28595413,
        -311.21094016, -308.60052015, -307.08989559, -306.15342484,
        -305.54203059, -305.12400937, -304.74276168]),
 array([-734.5366385 , -372.66449019, -327.41761444, -316.29273661,
        -311.28823936, -308.60609857, -307.14186479, -306.17285346,
        -305.52360166, -305.0966462 , -304.75053106]),
 array([-724.19546545, -371.01629212, -327.48945471, -316.31499282,
        -311.28954411, -308.60031087, -307.17157159, -306.11496319,
        -305.52353229, -305.06613128, -304.75344537]),
 array([-734.37957046, -373.58818603, -328.21400432, -316.13680624,
        -311.20743585, -308.66211394, -307.14701085, -306.16521355,
        -305.5616471 , -305.073774  , -304.73537205]),
 array([-738.21826964, -370.00361582, -327.88837479, -316.31330446,
        -311.39774628, -308.74137618, -307.14672688, -306.23265342,
        -305.56034505, -305.07358285, -304.73697348]),
 array([-732.072183  , -372.29321737, -328.47468556, -316.28071728,
        -311.29706922, -308.75363484, -307.18302407, -306.17467238,
        -305.56216308, -305.06443097, -304.72514601]),
 array([-734.66613496, -372.81895769, -328.28028753, -316.20581014,
        -311.42458851, -308.73062345, -307.12806253, -306.10166399,
        -305.52236539, -305.05505658, -304.7621605 ]),
 array([-734.27585726, -371.72693453, -327.68944526, -316.16564175,
        -311.23612353, -308.70214235, -307.05752299, -306.19155597,
        -305.55879533, -305.06557779, -304.77837572]),
 array([-730.52145781, -372.50504554, -327.82940741, -316.32535604,
        -311.35108562, -308.64872713, -307.12411924, -306.1566087 ,
        -305.50542045, -305.0854677 , -304.73367473]),
 array([-730.42721803, -372.75641041, -328.07309493, -316.46912491,
        -311.33281598, -308.7577788 , -307.0701462 , -306.12668487,
        -305.53396497, -305.07095552, -304.75220859]),
 array([-734.58590492, -371.34782932, -328.36485646, -316.32492532,
        -311.35827888, -308.5721824 , -307.10868386, -306.19847224,
        -305.52040252, -305.06851257, -304.74204137]),
 array([-740.73215936, -371.94953548, -328.46991059, -316.28765577,
        -311.26682452, -308.70697559, -307.16547918, -306.13226409,
        -305.53330375, -305.04838842, -304.74177388]),
 array([-717.78401022, -371.60397176, -327.80671811, -316.36030571,
        -311.42844325, -308.68975956, -307.12803483, -306.14177848,
        -305.55912936, -305.06488623, -304.73804043]),
 array([-724.46192996, -371.60431298, -328.12875692, -316.45293472,
        -311.26933767, -308.58803624, -307.12800935, -306.16198809,
        -305.55048395, -305.08725566, -304.71423731]),
 array([-727.06049647, -371.73083693, -327.68969464, -316.40042924,
        -311.17137248, -308.79527142, -307.0776704 , -306.22564901,
        -305.52102377, -305.06460573, -304.73068828]),
 array([-718.06895066, -372.78246355, -328.09171803, -316.20046056,
        -311.35176133, -308.69237445, -307.14549843, -306.18503205,
        -305.51804522, -305.0834728 , -304.74384082]),
 array([-754.3905392 , -372.1419457 , -328.09586551, -316.31634916,
        -311.0665078 , -308.64048604, -307.12815626, -306.1612969 ,
        -305.51244604, -305.06414067, -304.74927167]),
 array([-738.47535173, -373.1973316 , -328.53833372, -315.95756074,
        -311.26000581, -308.55786193, -307.15084431, -306.16737493,
        -305.52768453, -305.07096061, -304.75760005]),
 array([-731.54411874, -371.98180973, -327.66139547, -316.14875014,
        -311.30794456, -308.62020567, -307.10110553, -306.14397243,
        -305.50279176, -305.07796506, -304.71995629]),
 array([-734.14663981, -372.829017  , -328.08571906, -316.29858742,
        -311.28200825, -308.71736128, -307.12931072, -306.21133052,
        -305.52422842, -305.08071466, -304.75527573]),
 array([-745.94772218, -372.11481747, -328.26904463, -316.39722847,
        -311.2169166 , -308.65634006, -307.05790566, -306.15295374,
        -305.51992065, -305.04913808, -304.72815441]),
 array([-737.8016803 , -372.14483931, -328.19950482, -316.27744326,
        -311.2866254 , -308.6163937 , -307.16306523, -306.13727863,
        -305.56466044, -305.07284894, -304.76059493]),
 array([-738.23532031, -371.74518476, -328.59135378, -316.39300768,
        -311.36851969, -308.63136782, -307.14932948, -306.16311514,
        -305.52480076, -305.06489404, -304.73677405]),
 array([-727.83327405, -371.55491649, -328.17311233, -316.11279286,
        -311.13717273, -308.61288978, -307.13499851, -306.17988392,
        -305.51429937, -305.087498  , -304.733102  ]),
 array([-718.34743618, -370.79588064, -328.24781968, -316.09642334,
        -311.1684584 , -308.66474929, -307.24603051, -306.19209683,
        -305.50129525, -305.06385061, -304.76221622]),
 array([-737.61921244, -371.40158608, -328.50364904, -316.24129202,
        -311.26590123, -308.61518223, -307.1789775 , -306.16056477,
        -305.52024085, -305.06018484, -304.732709  ]),
 array([-740.54185027, -370.21363689, -327.98958978, -316.19813613,
        -311.28317153, -308.58466592, -307.10381518, -306.19566337,
        -305.51744551, -305.08897274, -304.74314891]),
 array([-740.71531907, -371.93972946, -328.12589848, -316.29454085,
        -311.2010088 , -308.76191136, -307.11849969, -306.11907431,
        -305.50843267, -305.1115628 , -304.7635815 ]),
 array([-724.41782453, -371.95261222, -328.30904168, -316.32123262,
        -311.1909529 , -308.60599508, -307.12141072, -306.17328392,
        -305.52761017, -305.05433475, -304.77859317]),
 array([-725.77781909, -372.61217661, -328.05727229, -316.32139419,
        -311.20475337, -308.67640395, -307.10397389, -306.15741155,
        -305.53287374, -305.0790856 , -304.7516849 ]),
 array([-734.41697583, -371.96446683, -327.87847243, -316.40707712,
        -311.38437377, -308.61030185, -307.07809322, -306.19620199,
        -305.52823613, -305.07733278, -304.74958638]),
 array([-730.39475863, -371.33905334, -327.77097736, -316.27583082,
        -311.259872  , -308.62723592, -307.16746095, -306.17850536,
        -305.5104863 , -305.06803096, -304.75584412]),
 array([-731.82695445, -371.86208301, -328.09706881, -316.03053779,
        -311.23918073, -308.62059439, -307.0724996 , -306.18174226,
        -305.48597492, -305.07526865, -304.7661438 ]),
 array([-720.90525283, -372.32795363, -328.33376562, -316.26282407,
        -311.42163151, -308.54339979, -307.16568617, -306.19647735,
        -305.49501431, -305.07167767, -304.74824425]),
 array([-728.26186554, -372.07873589, -328.10709967, -316.09030244,
        -311.24042433, -308.64451003, -307.11194531, -306.15695149,
        -305.5381897 , -305.09217189, -304.73207309]),
 array([-728.4396864 , -373.37491943, -328.31509155, -316.28998459,
        -311.27955073, -308.66261541, -307.12536765, -306.16432735,
        -305.49374299, -305.06909003, -304.76615408]),
 array([-735.60340123, -373.15185038, -328.04605654, -316.03594626,
        -311.28918358, -308.63961189, -307.09563653, -306.15719387,
        -305.51437866, -305.05366297, -304.74863103]),
 array([-739.55861324, -372.53771465, -328.35395669, -316.26246158,
        -311.27817185, -308.73778755, -307.09664785, -306.16793645,
        -305.53508763, -305.03682649, -304.77376857]),
 array([-744.25460903, -371.40868745, -327.9246676 , -316.41884032,
        -311.21717789, -308.61648914, -307.12411948, -306.13129044,
        -305.53429001, -305.1079857 , -304.74535648]),
 array([-733.98631953, -372.57150613, -327.89469466, -316.45628432,
        -311.24201616, -308.60328045, -307.13820246, -306.13338089,
        -305.52140978, -305.06930024, -304.77509781]),
 array([-737.96424737, -371.39074288, -328.30832768, -316.29525311,
        -311.33710641, -308.61462855, -307.12914633, -306.164378  ,
        -305.52170471, -305.04760852, -304.73443652]),
 array([-737.52012077, -372.22167902, -327.75485446, -316.28523892,
        -311.22129728, -308.69999163, -307.13346068, -306.15974457,
        -305.52174496, -305.06232178, -304.75584947]),
 array([-726.83317554, -371.52649869, -328.01968002, -316.21804822,
        -311.39627613, -308.70025411, -307.12958762, -306.19066797,
        -305.52517287, -305.09515214, -304.73770571]),
 array([-738.47490563, -371.79688397, -327.51600136, -316.37994813,
        -311.19851712, -308.62815895, -307.11521552, -306.16888951,
        -305.49618797, -305.08755359, -304.74205793]),
 array([-726.05031222, -371.80585712, -327.76026763, -316.38046535,
        -311.14847536, -308.55764707, -307.08545033, -306.16574414,
        -305.53024953, -305.07806916, -304.75332547]),
 array([-731.5851967 , -371.51357816, -327.69135239, -316.12081562,
        -311.31578189, -308.67846143, -307.15708886, -306.20487095,
        -305.53122082, -305.06204406, -304.71161689]),
 array([-734.62919847, -371.75397739, -327.88527801, -316.47784989,
        -311.34801888, -308.59001102, -307.22816808, -306.20747733,
        -305.56367117, -305.08172152, -304.75235744]),
 array([-720.26196742, -372.25975291, -328.1870912 , -316.2397889 ,
        -311.26696733, -308.7049691 , -307.13284951, -306.1525805 ,
        -305.48576657, -305.08635354, -304.74300546]),
 array([-726.23155623, -371.80535851, -327.56301279, -316.3158692 ,
        -311.25467632, -308.75512672, -307.16974243, -306.20576591,
        -305.48996576, -305.08161714, -304.75625968]),
 array([-722.19813716, -371.34624814, -327.76339672, -316.24645318,
        -311.24053545, -308.71800447, -307.14800574, -306.19500799,
        -305.52493959, -305.05195778, -304.7476529 ]),
 array([-744.67405348, -371.53910828, -328.08286752, -316.014211  ,
        -311.36476078, -308.67073746, -307.22609653, -306.19665851,
        -305.54190505, -305.04228916, -304.73417003]),
 array([-733.73167638, -370.91280125, -327.74654316, -316.21310816,
        -311.34925631, -308.70880109, -307.06240676, -306.1573576 ,
        -305.52198965, -305.05632281, -304.71828535]),
 array([-739.54456487, -371.60076771, -327.99118268, -315.99845003,
        -311.21165644, -308.69387435, -307.08760999, -306.15040237,
        -305.51383587, -305.07774177, -304.75056195]),
 array([-728.68739612, -371.082433  , -328.06002313, -316.30391781,
        -311.31997674, -308.66971086, -307.11614176, -306.16786631,
        -305.50675359, -305.08321015, -304.75489864]),
 array([-743.64160166, -371.54105289, -328.00138785, -316.08685854,
        -311.33707931, -308.63674884, -307.04642848, -306.17365439,
        -305.53298859, -305.07397924, -304.76302192]),
 array([-733.58963115, -372.11684879, -327.8187558 , -316.2542045 ,
        -311.1667812 , -308.55458875, -307.16610034, -306.19158641,
        -305.49445059, -305.08071797, -304.75278978]),
 array([-731.85866708, -371.52158949, -327.86799429, -316.35581043,
        -311.40821133, -308.66021899, -307.12896076, -306.08421016,
        -305.52308846, -305.04546297, -304.72489952])]

In [11]:
expect1 = np.ones(100)
for i in range(100):
    expect1[i] = integral(result1[i], ts)

In [12]:
expect1


Out[12]:
array([-311.12526488, -311.263866  , -311.50583205, -311.30598936,
       -311.12828261, -311.52443833, -311.33110477, -311.48110953,
       -311.52057671, -311.36185032, -311.5852267 , -311.30480766,
       -311.43216299, -311.49289725, -311.42179548, -311.30554117,
       -311.69247305, -311.45468347, -311.77385862, -311.65929186,
       -311.30080835, -311.45039732, -311.33606779, -311.65959431,
       -311.49742632, -311.46307493, -311.22717102, -311.36711009,
       -311.43859465, -311.67586959, -311.23310943, -311.49909681,
       -311.39446301, -311.32667628, -311.33235538, -311.61180505,
       -311.28548388, -311.55613145, -311.32447681, -311.4891895 ,
       -311.41708389, -311.39832756, -311.37934103, -311.53184868,
       -311.45894056, -311.36534502, -311.44023541, -311.47778371,
       -311.28542542, -311.52274431, -311.43738232, -311.49403111,
       -311.38858093, -311.38803388, -311.45967723, -311.47427651,
       -311.41755364, -311.37510475, -311.25778161, -311.4176033 ,
       -311.58638605, -311.46479272, -311.44333491, -311.53860389,
       -311.49998663, -311.49473788, -311.54031165, -311.42505903,
       -311.49482797, -311.54411997, -311.447271  , -311.43893553,
       -311.50166489, -311.33467083, -311.45407619, -311.47102593,
       -311.32906048, -311.61814967, -311.65460389, -311.42818826,
       -311.51624133, -311.67618148, -311.41765281, -311.48417029,
       -311.53385385, -311.30886848, -311.55873339, -311.45227041,
       -311.28557709, -311.35253375, -311.28658944, -311.38530474,
       -311.24668809, -311.46526777, -311.40033541, -311.48393096,
       -311.39259487, -311.40718309, -311.57325192, -311.51649956])

model2 marginal likelihood by power posterior


In [13]:
result2 = Pool().map(function2, range(m))

In [14]:
result2


Out[14]:
[array([-674.69827923, -363.58731507, -319.23566903, -307.38039769,
        -302.56250226, -300.08441022, -298.72689154, -297.57703059,
        -297.06319305, -296.51749186, -296.17703802]),
 array([-687.16164872, -361.80931395, -320.02927451, -308.19658969,
        -302.96242482, -300.26203278, -298.67188541, -297.78462988,
        -296.97936519, -296.49591046, -296.22713534]),
 array([-733.29887937, -361.95142827, -319.17635897, -308.04096642,
        -302.90473819, -300.40217785, -298.74018469, -297.71932227,
        -297.04302104, -296.5357745 , -296.24692049]),
 array([-694.08435972, -363.57697916, -320.1518423 , -307.80486715,
        -302.77646885, -300.3856335 , -298.51659472, -297.62170028,
        -296.97860027, -296.59612894, -296.22967932]),
 array([-653.38290857, -364.98184872, -320.596728  , -307.47506493,
        -302.92916499, -300.01489302, -298.69346617, -297.52163981,
        -297.03849854, -296.58263717, -296.27306047]),
 array([-742.52101025, -365.32447072, -319.5633122 , -307.67811788,
        -303.25817992, -299.94625082, -298.672463  , -297.67328668,
        -296.93636282, -296.57180746, -296.20013033]),
 array([-702.61565243, -362.07123146, -320.23273281, -307.81286823,
        -303.03076395, -300.28437038, -298.58371755, -297.64918626,
        -296.96488864, -296.46003083, -296.25570779]),
 array([-749.51401303, -362.60906315, -318.9274166 , -307.97715607,
        -302.46352031, -300.00300935, -298.5932668 , -297.62773413,
        -297.01545261, -296.55134729, -296.27911835]),
 array([-725.95248257, -367.60443597, -318.94012903, -308.30844425,
        -302.63852088, -300.16730867, -298.60526423, -297.66184487,
        -297.04343941, -296.58644936, -296.22156911]),
 array([-695.15277477, -364.48625923, -320.55864908, -307.82849606,
        -302.98416939, -300.23362362, -298.60350191, -297.74034296,
        -296.99591162, -296.56333288, -296.17558701]),
 array([-746.8550016 , -364.71726905, -321.12878516, -307.16726769,
        -302.93350075, -300.31398853, -298.65448791, -297.60831867,
        -296.86318327, -296.55006563, -296.24864891]),
 array([-699.4574325 , -365.90552523, -319.07290726, -307.84518251,
        -302.72123186, -300.01529995, -298.70964594, -297.63255678,
        -297.01958372, -296.47078138, -296.22660561]),
 array([-711.91165554, -365.27694558, -319.24597849, -308.01612687,
        -302.70086237, -300.44713615, -298.64376723, -297.68542744,
        -297.04868808, -296.59308906, -296.23273233]),
 array([-744.92881408, -361.72065105, -319.83826535, -307.71388689,
        -302.71564489, -300.30849048, -298.65340157, -297.60388657,
        -297.01334987, -296.52243377, -296.20445543]),
 array([-721.35014328, -365.14183029, -320.28466569, -307.62749827,
        -302.47179547, -300.02741867, -298.54387593, -297.7189551 ,
        -296.93236853, -296.65337562, -296.16482541]),
 array([-702.48162441, -363.93116449, -319.36856054, -307.43427424,
        -302.54272226, -300.50575291, -298.57258215, -297.69233893,
        -297.04712349, -296.61425485, -296.18764377]),
 array([-766.62206068, -365.30272213, -319.5400597 , -307.87141161,
        -303.16782607, -300.2088549 , -298.68870635, -297.4964427 ,
        -297.07274412, -296.53631895, -296.24393576]),
 array([-718.54739295, -366.46884261, -318.85243025, -307.73796139,
        -302.78739527, -300.24006042, -298.73805754, -297.71378753,
        -297.04743251, -296.56014057, -296.22299053]),
 array([-773.74227797, -365.07047434, -320.31124471, -308.65062668,
        -302.87683798, -300.19702207, -298.58384043, -297.77084281,
        -296.92563798, -296.47312599, -296.23151091]),
 array([-769.57652369, -365.15305047, -319.6382068 , -307.20949813,
        -302.78106645, -300.44664841, -298.47427164, -297.67180193,
        -297.04189319, -296.55612142, -296.24834754]),
 array([-698.03820026, -362.42346134, -320.27229668, -307.84401786,
        -302.94455858, -300.197776  , -298.54278703, -297.68813797,
        -297.03393929, -296.51456934, -296.2362968 ]),
 array([-740.42987864, -363.65108568, -318.50802934, -308.07431716,
        -302.5611601 , -300.28820133, -298.54179807, -297.58521151,
        -296.98728559, -296.55268919, -296.17517092]),
 array([-710.87718956, -363.28186874, -319.36765825, -308.14807609,
        -302.99922119, -300.36963465, -298.56871086, -297.43136103,
        -296.90716054, -296.53729904, -296.19870698]),
 array([-755.20653396, -363.41690613, -320.50503495, -308.42054843,
        -302.81356502, -300.32882604, -298.66740374, -297.56349258,
        -297.02676031, -296.54819768, -296.28595   ]),
 array([-736.63263779, -363.39333163, -319.23926725, -307.94494213,
        -302.8720491 , -300.2500806 , -298.50968734, -297.64561096,
        -297.00635827, -296.58043828, -296.2269759 ]),
 array([-729.94270139, -366.21696475, -319.30720015, -307.65103447,
        -303.19080098, -300.22013095, -298.3966359 , -297.54715759,
        -297.00481456, -296.50887311, -296.26182119]),
 array([-701.30516641, -361.95497885, -318.35244226, -308.42826386,
        -302.64820105, -299.80562132, -298.61241159, -297.60943686,
        -296.99767751, -296.60189051, -296.27878286]),
 array([-707.985925  , -364.39910591, -319.86104608, -307.7069147 ,
        -303.20631855, -299.82137135, -298.53800346, -297.59089427,
        -297.13124822, -296.55331612, -296.1518377 ]),
 array([-730.39087779, -362.2962086 , -319.89741448, -308.30844325,
        -302.97803555, -300.16962882, -298.62576751, -297.62870522,
        -296.9232731 , -296.51611187, -296.15007678]),
 array([-751.48393616, -364.01868034, -319.93512519, -308.87792625,
        -302.90409663, -300.50160687, -298.6022202 , -297.67905484,
        -297.03105357, -296.52680011, -296.17792847]),
 array([-697.73930814, -363.99648251, -319.07315323, -307.34077135,
        -302.47942977, -300.23746582, -298.66838176, -297.68638376,
        -296.96109275, -296.55440997, -296.24786331]),
 array([-716.76412831, -366.99013617, -320.55893206, -308.24967486,
        -302.90470775, -300.24555283, -298.62587616, -297.64226243,
        -296.95895084, -296.51982961, -296.20625394]),
 array([-718.06696127, -361.88559495, -319.83225973, -307.95200235,
        -302.98019272, -300.25088808, -298.54061171, -297.68530054,
        -297.12462249, -296.52120341, -296.26620798]),
 array([-702.83700527, -364.43321774, -319.87318464, -307.29023076,
        -303.02920305, -300.16964027, -298.47669675, -297.7623199 ,
        -296.9571853 , -296.61435655, -296.30048825]),
 array([-727.04209513, -359.97766201, -319.15972664, -308.08576715,
        -302.71583124, -300.09867241, -298.50272043, -297.6719617 ,
        -297.05740439, -296.43902964, -296.24869572]),
 array([-740.1300371 , -365.98559131, -321.11510474, -307.56011674,
        -303.05201527, -300.16411933, -298.64364178, -297.56777953,
        -297.06721679, -296.53929514, -296.16973219]),
 array([-712.69798068, -362.38921529, -319.28881569, -307.8555078 ,
        -302.82638811, -300.01765134, -298.58357724, -297.60374486,
        -296.94829312, -296.58262218, -296.19660762]),
 array([-733.498734  , -367.4199939 , -319.45704943, -307.96408849,
        -302.89461126, -299.96845371, -298.67472706, -297.47827725,
        -297.02781319, -296.67988317, -296.14033302]),
 array([-726.838118  , -359.26695926, -319.19909575, -308.20699791,
        -302.72486148, -300.06197408, -298.50764193, -297.77803569,
        -296.95598148, -296.52158061, -296.22584823]),
 array([-716.2252836 , -363.5955906 , -319.18106904, -309.20549045,
        -302.99779938, -300.22113724, -298.74121932, -297.70894896,
        -297.02802547, -296.6432408 , -296.24475845]),
 array([-711.84898013, -364.67065745, -320.75998843, -307.6348786 ,
        -303.0230202 , -300.11497602, -298.48637858, -297.597321  ,
        -297.04200229, -296.61242115, -296.24214093]),
 array([-708.06224438, -367.43058269, -319.7166695 , -307.5615388 ,
        -303.12261093, -300.11664164, -298.58460925, -297.61963457,
        -297.03312192, -296.51347386, -296.21136424]),
 array([-704.58600878, -365.12720829, -321.1950844 , -307.39128712,
        -302.99932565, -300.10378449, -298.49207656, -297.72118153,
        -296.96295964, -296.6074329 , -296.18012413]),
 array([-739.46095757, -363.1377245 , -319.72781569, -308.07879319,
        -303.36492631, -300.11037849, -298.64458811, -297.62434286,
        -296.88590831, -296.60983942, -296.21119508]),
 array([-723.81902438, -359.80264406, -321.38982172, -307.7177134 ,
        -303.11751835, -300.04119873, -298.69183454, -297.66168202,
        -296.96488146, -296.59621783, -296.27072706]),
 array([-717.46122724, -362.47030175, -320.44172871, -307.49664679,
        -302.64316331, -300.24332934, -298.48330527, -297.68758547,
        -296.94303291, -296.60827132, -296.18340035]),
 array([-720.64463986, -363.65415378, -319.67309815, -308.39660283,
        -302.67581826, -300.277705  , -298.45089598, -297.66393032,
        -297.10242567, -296.53798966, -296.24721533]),
 array([-731.1984433 , -364.38489464, -318.37249592, -307.87550006,
        -302.65048587, -300.43634274, -298.70578419, -297.71939925,
        -296.95697743, -296.63295728, -296.20410021]),
 array([-717.5784198 , -360.10874746, -319.89182207, -307.83349493,
        -302.7612044 , -299.96543098, -298.62674129, -297.64064421,
        -297.01159643, -296.49944314, -296.25108413]),
 array([-745.63299697, -364.91206299, -319.09393665, -307.68552089,
        -302.87268354, -299.98178323, -298.6839597 , -297.57961142,
        -297.02331559, -296.59512873, -296.26568476]),
 array([-731.3169335 , -362.35709815, -319.68472309, -307.66730129,
        -302.99741726, -300.30197297, -298.43771825, -297.69512649,
        -296.99084094, -296.50512107, -296.2669518 ]),
 array([-730.20222465, -365.10100175, -320.01791886, -308.40184123,
        -302.71912391, -300.34222615, -298.32515914, -297.67359469,
        -296.9529672 , -296.51953452, -296.15661174]),
 array([-713.61354584, -364.31848489, -319.61879329, -307.9546091 ,
        -302.60613815, -300.12391504, -298.5767046 , -297.60734442,
        -297.1058451 , -296.53711496, -296.24617366]),
 array([-730.27349828, -361.11538662, -318.30635093, -307.66505102,
        -302.76344979, -300.1723501 , -298.68954149, -297.77987554,
        -297.11729077, -296.63624738, -296.16545462]),
 array([-722.63654355, -362.82064169, -319.33997849, -307.90188513,
        -302.89917164, -300.29727565, -298.75172451, -297.70426192,
        -297.08212558, -296.61644808, -296.19936059]),
 array([-732.34060593, -365.3519952 , -319.61980748, -308.1823961 ,
        -302.53639813, -299.95660029, -298.76983947, -297.55660938,
        -297.04185491, -296.49782587, -296.20505503]),
 array([-718.1091023 , -365.7721241 , -319.45748569, -307.77477346,
        -302.90119798, -300.18034633, -298.4622674 , -297.56967845,
        -297.05598278, -296.55559851, -296.23245138]),
 array([-714.67118347, -360.88189454, -321.26412033, -308.18087735,
        -302.73337565, -300.27407985, -298.57294731, -297.69701452,
        -297.00664001, -296.44978708, -296.20875655]),
 array([-714.16096378, -362.42056478, -318.27489482, -307.25138218,
        -303.29032089, -300.09890474, -298.55098721, -297.61400549,
        -296.86057944, -296.53679496, -296.19813603]),
 array([-721.06623974, -361.54094483, -319.28447836, -307.37440332,
        -303.35334426, -300.11669736, -298.82477306, -297.8157749 ,
        -297.09318409, -296.57860824, -296.19203575]),
 array([-740.55781411, -362.73247385, -321.44158245, -307.77120076,
        -302.94513751, -300.52267895, -298.64805254, -297.58436174,
        -296.87702149, -296.61490096, -296.18520731]),
 array([-737.69501394, -363.6223096 , -319.20678573, -308.31731859,
        -302.46792092, -300.06715569, -298.60562009, -297.60545174,
        -296.9561133 , -296.49852418, -296.22518831]),
 array([-730.04059888, -362.97721406, -319.08624176, -308.15646931,
        -302.92987583, -300.17732172, -298.71450709, -297.5489582 ,
        -296.97741651, -296.52507366, -296.22216003]),
 array([-735.92365046, -363.92273748, -319.88718836, -307.91734054,
        -302.92580887, -300.22160316, -298.56092608, -297.69337334,
        -296.97253003, -296.60750237, -296.2410696 ]),
 array([-724.64701826, -364.82775163, -319.90923928, -307.84554555,
        -303.02864561, -300.03414839, -298.62068016, -297.64012979,
        -297.07980198, -296.5681731 , -296.30842913]),
 array([-722.79731698, -365.23312239, -320.75675003, -307.52672686,
        -302.85801313, -300.229157  , -298.68569104, -297.57474892,
        -296.97118987, -296.55908339, -296.18096794]),
 array([-735.31917682, -361.55084141, -321.26685321, -307.41297042,
        -303.24651861, -300.23841541, -298.67745655, -297.73956199,
        -297.01391838, -296.52313282, -296.30725514]),
 array([-738.86647829, -360.4560941 , -319.75627023, -307.61621749,
        -302.86659112, -300.32373981, -298.61074849, -297.61079827,
        -297.13384451, -296.43245061, -296.21735321]),
 array([-733.34511473, -361.22301215, -319.50511894, -308.59552439,
        -302.98550254, -300.35126561, -298.68981642, -297.5864532 ,
        -297.04698843, -296.60518128, -296.20052024]),
 array([-724.8631569 , -363.17372257, -320.16721006, -308.40164453,
        -303.08699034, -300.24648405, -298.52333909, -297.76101516,
        -297.10041736, -296.5529831 , -296.22232617]),
 array([-709.4097339 , -365.70356121, -320.8619261 , -307.57752227,
        -303.13074871, -300.36758137, -298.54172527, -297.62503183,
        -296.99208342, -296.53717091, -296.1751217 ]),
 array([-721.2137738 , -363.75989829, -319.77894821, -307.86743169,
        -302.66829512, -300.38828564, -298.61457145, -297.65262643,
        -297.03451818, -296.58078353, -296.248276  ]),
 array([-732.98301457, -364.32626934, -319.94725417, -307.32649632,
        -303.0131681 , -300.1649148 , -298.74606349, -297.6773822 ,
        -297.0268711 , -296.50593917, -296.24245943]),
 array([-708.40005239, -361.11904115, -319.73755691, -308.35507291,
        -302.84130837, -300.41710183, -298.64782515, -297.57689873,
        -296.94677431, -296.49941951, -296.2318585 ]),
 array([-711.37133673, -365.70316917, -320.61923567, -308.57447604,
        -302.84803168, -300.13932739, -298.6843156 , -297.70306654,
        -296.90554221, -296.49273228, -296.20245718]),
 array([-716.69257639, -365.40947936, -319.67285176, -307.9187861 ,
        -302.91456439, -300.37466516, -298.73767181, -297.72461809,
        -297.00962699, -296.53260961, -296.24897101]),
 array([-719.69279995, -360.34473742, -320.72612092, -308.25199275,
        -302.23730685, -299.96585911, -298.72361521, -297.6263538 ,
        -296.94541056, -296.56208128, -296.2544829 ]),
 array([-741.86788168, -367.38386214, -320.05627165, -308.17711713,
        -302.73422528, -300.44896882, -298.51164299, -297.67599465,
        -297.02747901, -296.45227845, -296.18550345]),
 array([-775.9443251 , -361.11015568, -320.74147113, -307.9386885 ,
        -302.97007317, -299.9583409 , -298.6590981 , -297.5365709 ,
        -296.96437105, -296.54246862, -296.25493766]),
 array([-726.80900019, -360.38662942, -320.68741359, -308.69602606,
        -302.58520514, -300.24146786, -298.47604053, -297.67187162,
        -297.07705914, -296.49927835, -296.20588386]),
 array([-719.43966089, -366.47545751, -319.97182241, -308.41263745,
        -302.91565779, -300.05568297, -298.7496446 , -297.52715047,
        -297.09159683, -296.57385324, -296.24919058]),
 array([-758.64704934, -364.69628655, -320.52316606, -308.32773584,
        -303.00459972, -300.06117726, -298.57092464, -297.7895926 ,
        -297.0015136 , -296.47987583, -296.20118113]),
 array([-737.32166809, -360.595826  , -318.80218144, -307.86162356,
        -303.15534318, -300.07344671, -298.58345149, -297.69014538,
        -296.99036185, -296.56570008, -296.21180143]),
 array([-733.29932025, -361.18834585, -320.66182859, -307.6695102 ,
        -303.39450219, -300.03320617, -298.75231666, -297.61667719,
        -297.00565009, -296.50659177, -296.14597257]),
 array([-741.74419254, -364.37242193, -318.75001246, -308.07557217,
        -302.88140483, -300.320311  , -298.51544719, -297.75977775,
        -297.0527319 , -296.53888416, -296.23806898]),
 array([-698.49910046, -364.95146409, -320.32853816, -307.74861014,
        -302.76876002, -300.33190451, -298.40987703, -297.58667384,
        -297.0215032 , -296.47921569, -296.12290374]),
 array([-737.10404108, -364.3513185 , -320.18557877, -307.46317309,
        -302.83524143, -300.24350633, -298.77900606, -297.68176855,
        -297.02868234, -296.54129031, -296.20311683]),
 array([-715.56935036, -364.22565718, -320.13210749, -307.7898344 ,
        -303.02594675, -300.26954627, -298.66655387, -297.59646541,
        -297.07075549, -296.63234172, -296.23330995]),
 array([-702.19826705, -363.69133762, -319.38150459, -307.88230066,
        -302.79360246, -299.99607417, -298.68754101, -297.57206557,
        -297.01548246, -296.6080078 , -296.22030877]),
 array([-713.28064788, -362.64319925, -319.57181803, -308.58272204,
        -302.49513193, -300.16610126, -298.50839314, -297.73644709,
        -296.89653598, -296.51479779, -296.21634104]),
 array([-723.90061388, -360.74049846, -318.41685379, -307.39605328,
        -303.14287548, -300.21215384, -298.47535346, -297.56011562,
        -296.99907124, -296.55587135, -296.21640594]),
 array([-734.55361363, -359.63999706, -319.93239143, -307.68774651,
        -302.70047652, -299.99115568, -298.91949613, -297.45057523,
        -296.98876214, -296.52884325, -296.21987993]),
 array([-708.66387117, -361.29152593, -319.79439915, -307.86706229,
        -302.66966512, -299.98352453, -298.62824038, -297.5663963 ,
        -297.0096405 , -296.46261088, -296.22316292]),
 array([-727.07438676, -363.33826655, -319.4365721 , -308.47959238,
        -302.6728666 , -300.02935992, -298.65534641, -297.77018563,
        -297.01626027, -296.53601978, -296.24497005]),
 array([-713.89093731, -363.94282368, -319.73377933, -307.57272171,
        -303.18166931, -300.30255192, -298.74523268, -297.53090257,
        -296.92320786, -296.57911444, -296.20461052]),
 array([-716.3937101 , -364.69910988, -320.6711278 , -307.70002879,
        -303.08862868, -300.1045918 , -298.68132204, -297.5903682 ,
        -297.13043953, -296.53667144, -296.22734564]),
 array([-707.59469883, -364.5759246 , -320.06621152, -308.33989528,
        -302.62226624, -300.03092044, -298.63159779, -297.62282369,
        -296.94478415, -296.58081134, -296.23776654]),
 array([-718.83176958, -362.55685819, -318.97371701, -308.25686467,
        -302.58476982, -300.31715401, -298.69788732, -297.61633113,
        -297.10931126, -296.54408324, -296.23718921]),
 array([-743.24774601, -363.76996893, -320.74572226, -307.57534134,
        -302.79195373, -300.16617383, -298.66356904, -297.68307315,
        -297.10909073, -296.50701067, -296.30500739]),
 array([-728.00839316, -366.48908294, -319.82435462, -307.45837914,
        -302.81616576, -300.27543556, -298.74725068, -297.70581243,
        -296.93810238, -296.51496937, -296.24019322])]

In [28]:
expect2 = np.ones(100)
for i in range(100):
    expect2[i] = integral(result2[i], ts)

In [29]:
expect2


Out[29]:
array([-302.61901882, -302.78617275, -303.00393965, -302.81173615,
       -302.62796775, -303.06430497, -302.82589461, -302.98016589,
       -303.02462573, -302.87313549, -303.09433272, -302.81137049,
       -302.94655415, -303.00207119, -302.92747317, -302.82739246,
       -303.21086051, -302.96558214, -303.28469465, -303.17755459,
       -302.81751018, -302.95470062, -302.8498879 , -303.17687279,
       -302.99067597, -302.98411892, -302.73110076, -302.8657179 ,
       -302.96547942, -303.19439218, -302.74751475, -303.02951051,
       -302.92182291, -302.85069949, -302.83966977, -303.11982488,
       -302.81186365, -303.04852189, -302.84223896, -303.02626674,
       -302.93643945, -302.92746138, -302.90761717, -303.05046998,
       -302.95039996, -302.87202186, -302.9526318 , -302.97864131,
       -302.81369641, -303.03860245, -302.94580497, -303.00380235,
       -302.88858344, -302.90508011, -302.97081271, -302.9891426 ,
       -302.92717923, -302.90668096, -302.76362894, -302.94041429,
       -303.09743004, -302.95392407, -302.94930744, -303.03706623,
       -303.00103895, -302.98804451, -303.05704165, -302.95108577,
       -303.02147042, -303.03625248, -302.96203847, -302.95552928,
       -303.00922853, -302.84611339, -302.98529251, -302.99535482,
       -302.85623316, -303.13299545, -303.17171933, -302.95494431,
       -303.03454012, -303.19902343, -302.92912123, -302.9943588 ,
       -303.04952307, -302.81696895, -303.04917591, -302.97486308,
       -302.81155396, -302.85409548, -302.80332122, -302.88698454,
       -302.76557248, -302.97396593, -302.91196051, -302.98582627,
       -302.88669388, -302.90614415, -303.08891183, -303.01723042])

BF21


In [19]:
bf_21 = []
for a,b in zip(expect1, expect2):
    bf_21.append(np.exp(b-a))

In [20]:
bf_21


Out[20]:
[4945.5628128686149,
 4806.350060063829,
 4924.0783315006802,
 4886.6056925781786,
 4916.3165350658282,
 4722.6877612537937,
 4940.4424232527035,
 4919.4088039358894,
 4894.9090686738127,
 4859.6166477149563,
 4870.2180029562351,
 4882.6196792602814,
 4844.5461101819837,
 4869.8872579462322,
 4886.9434165609628,
 4808.5396640072349,
 4825.2244568659216,
 4861.4952340506525,
 4861.7997753240561,
 4825.8263660592393,
 4833.3649260443881,
 4893.664572563096,
 4847.3133926665405,
 4830.5785302203376,
 4948.0574685109086,
 4812.4231565900191,
 4895.492960959652,
 4921.6158922068344,
 4784.3967762347856,
 4824.5724968356271,
 4844.4775094029646,
 4767.5427139823714,
 4782.1240958139842,
 4798.107244163738,
 4878.9514517610078,
 4875.5108812648341,
 4786.8135097083687,
 4952.3107421687337,
 4828.2426745716784,
 4735.8796437308938,
 4820.5554579099162,
 4773.6485487258187,
 4777.7445053481742,
 4824.0963021464549,
 4956.9236617470842,
 4882.0630006345355,
 4854.2195496829127,
 4910.5557434229677,
 4777.7691474876128,
 4837.44446385437,
 4873.5472936061578,
 4866.9793503289584,
 4914.7565299651624,
 4831.7005708199222,
 4860.3441150336594,
 4842.2458605898073,
 4867.6882330283952,
 4762.0036758489423,
 4886.1144042736332,
 4803.9271184633626,
 4860.7887789521483,
 4968.4770602121243,
 4885.5026777999119,
 4922.3318950540925,
 4909.5996829313426,
 4947.7755461679481,
 4833.22874185817,
 4788.5037225949272,
 4785.5562285334026,
 4953.5882530632671,
 4842.7234237262301,
 4833.8873074159519,
 4877.7355111451243,
 4858.8518320066696,
 4763.7177150725684,
 4796.6407927408318,
 4783.0194754978857,
 4842.3442106128105,
 4831.3661555932076,
 4785.0126427930054,
 4825.652398658407,
 4803.7783704134281,
 4858.7261516590788,
 4864.9489140638243,
 4838.3584453822468,
 4875.1177428512128,
 4961.9668085840258,
 4804.9760176189975,
 4788.7425204559231,
 4907.0993127427637,
 4833.220172878654,
 4906.5199570075392,
 4822.8272820292595,
 4872.2047700777657,
 4857.9649414746418,
 4905.4626361463424,
 4943.8565379112442,
 4919.8776481114764,
 4838.4035215956146,
 4911.1781324030335]

In [21]:
bias = np.average(bf_21) - 4862
std = np.sqrt(np.var(bf_21))

In [22]:
bias


Out[22]:
-6.6961979172310748

In [23]:
std


Out[23]:
54.929592568557609

In [24]:
np.sqrt(np.sum([(i - 4862)**2 for i in bf_21])/100)


Out[24]:
55.336237731657214

In [ ]: