-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogl.py
executable file
·74 lines (54 loc) · 1.43 KB
/
logl.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/usr/bin/env python
import pickle
import csv
import matplotlib.pyplot as plt
from matplotlib.backends.backend_pdf import PdfPages
import numpy
def getloglik(filename):
loglik11= []
with open(filename, 'r') as csvfile:
spamreader = csv.reader(csvfile, delimiter=',', quotechar='|')
head = spamreader.next()
index = len(head)-1
for row in spamreader:
loglik11.append(row[index])
return numpy.array(loglik11,dtype='f')
loglik11 = getloglik('output11.csv')
loglik15 = getloglik('output15.csv')
lp2 = loglik11.max()
lp = loglik15.max()
print lp,lp2,lp-lp2
# Delta 167
# EWca 168
# EWSi 168
# EWl 168
# D 166
# k0 166
# k1 166
# c 5
# alpha 5
# beta 5
# eta 5
# delta 3
# gamma1 5
# gamma2 5
# Cc 10
k1 = 167+3*168+3*166+6*5 + 3 + 10
k2 = 167+3*168+2*166+6*5 + 10
n=8.*168
AIC1 = -2*k1 - 2*lp
AIC2 = -2*k2 - 2*lp2
print AIC1-AIC2
c1 = 2*k1*(k1+1)/(n-k1-1)
c2 = 2*k2*(k2+1)/(n-k2-1)
print AIC1-AIC2+c1-c2
print (k1*numpy.log(n) - 2*lp) - (k2*numpy.log(n) - 2*lp2)
plt.hist(loglik11, normed=1, histtype='step', cumulative=-1,label='2 parameters',bins=20)
plt.hist(loglik15, normed=1, histtype='step', cumulative=-1,label='2+1 parameters',bins=20)
plt.legend(loc=9)
plt.xlabel(r'$\log \mathcal{L}$')
plt.ylabel(r'complementary CDF')
pp = PdfPages("output15/lp.pdf")
plt.savefig(pp,format='pdf')
pp.close()
plt.close()