In [1]:
import sys
sys.path.append('../..')
from IPython.display import Image
In [3]:
import functools
import math
import os
import matplotlib.pyplot as plt
%matplotlib inline
import plot
import trout
pref = 'trt'
import seaborn as sns
sns.set_style('white')
In [4]:
nsnps = [100, 200, 400]
Violin plot of point estimators. With and without logquad correction. Red dot: 10 and 90% of CONFIDENCE intervals
In [5]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_lt_comp(case, 50, "Newb", "None")
In [5]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_lt_comp(case, 50, "Newb", "NbNe")
In [6]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_lt_comp(case, 100, "Newb", "None")
In [7]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_lt_comp(case, 100, "Newb", "NbNe")
Different sample sizes
In [4]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_nb(case, 'Newb', 86, nsnps, 'allsnps-', 'None')
In [5]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_nb(case, 'Newb', 86, nsnps, 'allsnps-', 'NbNe')
In [6]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_nb(case, 'Newb', 174, nsnps, 'allsnps-', 'None')
In [7]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_nb(case, 'Newb', 174, nsnps, 'allsnps-', 'NbNe')
In [8]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_nb(case, 'Newb', 353, nsnps, 'allsnps-', 'None')
In [9]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_nb(case, 'Newb', 353, nsnps, 'allsnps-', 'NbNe')
In [10]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_nb(case, 'Newb', 713, nsnps, 'allsnps-', 'None')
In [11]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_nb(case, 'Newb', 713, nsnps, 'allsnps-', 'NbNe')
In [4]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_cohort(case, "bulltrout", 174, 50, 'None')
In [5]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_cohort(case, "bulltrout", 174, 50, 'NbNe')
In [6]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_cohort(case, "bulltrout", 353, 50, 'None')
In [7]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_cohort(case, "bulltrout", 353, 50, 'NbNe')
In [ ]:
#Cannot do with 200, too little sibs
In [25]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_rel(case, "bulltrout", 174, 50, 'NbNe')
In [26]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.do_rel(case, "bulltrout", 86, 50, 'NbNe')
In [4]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 86, [100], [25, 50, 100])
In [7]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 174, [100], [25, 50, 100])
In [8]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 353, [100], [25, 50, 100])
In [9]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 713, [100], [25, 50, 100])
In [10]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 86, [200], [25, 50, 100])
In [11]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 174, [200], [25, 50, 100])
In [12]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 353, [200], [25, 50, 100])
In [13]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 713, [200], [25, 50, 100])
In [14]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 86, [400], [25, 50, 100])
In [15]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 174, [400], [25, 50, 100])
In [16]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 353, [400], [25, 50, 100])
In [17]:
case = trout.load_file(pref, 40, mydir='../..')
fig = plot.compare_correction_ci(case, 'bulltrout', 713, [400], [25, 50, 100])
In [5]:
case = trout.load_file(pref, 40, mydir='../..')
linear = [("bullt2", 606), ("bullt2", 1214), ("bullt2", 1822),
("bullt2", 2433), ("bullt2", 3040),
("bullt2", 4565), ("bullt2", 6090),]
fig = plot.do_nb_linear(case, linear, "NbNe", functools.partial(trout.correct_ci))
In [6]:
fig = plot.do_nb_linear(case, linear, "NbNe", functools.partial(trout.correct_ci, jcorr=0.2))
In [6]:
plot.do_hz_comp(pref, '../..', "bulltrout", 174)
In [7]:
plot.do_hz_comp(pref, '../..', "bulltrout", 353)
In [20]:
case = trout.load_file(pref, 25, mydir='../..')
plot.do_pcrit(case, "bulltrout", 353, True)
In [21]:
def get_limits(nb):
top = nb + 2 * math.sqrt(nb / 2)
bottom = nb - 2 * math.sqrt(nb / 2)
return top, bottom
ratios = []
nbs = [10, 20, 30, 40, 50, 75, 100, 200]
for nb in nbs:
top, bottom = get_limits(nb)
print(nb, top)
ratios.append(top / nb)
fig, ax = plt.subplots()
ax.plot(nbs, ratios, '.-')
Out[21]:
In [ ]:
case = trout.load_file(pref, 40, mydir='../..')
cis = [("WFrog", "wfrog", 148), ("WFrog", "wfrog", 297),
("WFrog", "wfrog", 597),
("Mosq", "mosquito", 102), ("Mosq", "mosquito", 167),
("Mosq", "mosquito", 210), ("Mosq", "mosquito", 428),
("SynSweed", "synseaweed", 81), ("SynSweed", "synseaweed", 164),
("SynSweed", "synseaweed", 207),
("BT-Std", "bulltrout", 86), ("BT-Std", "bulltrout", 174),
("BT-Std", "bulltrout", 353), ("BT-Std", "bulltrout", 713),
("WCT-S", "shepard", 513), ("WCT-S", "shepard", 1030),
("WCT-F", "fraley", 637), ("WCT-F", "fraley", 1278),
("BT-Long", "bullt2", 606), ("BT-Long", "bullt2", 1214),
("BT-Long", "bullt2", 1822),
("BT-Long", "bullt2", 2433), ("BT-Long", "bullt2", 3040),
("BT-Long", "bullt2", 4565), ("BT-Long", "bullt2", 6090),
("BT-Pred", "bullpred", 189), ("BT-Pred", "bullpred", 381),
("BT-Pred", "bullpred", 765)]
medians = plot.do_table_ci(trout.Nbs, case, '../../output/', cis, 100, 50)
##plot.do_table_ci(case, '../../output/', cis, 100, 50, 20)
#plot.do_table_ci(case, '../../output/', cis, 100, 25)
#plot.do_table_ci(case, '../../output/', cis, 200, 50)
In [ ]:
corr_nbs = {}
for (model, N0), val in trout.Nbs.items():
nb, real = medians[(model, N0)]
corr_nbs[(model, N0)] = real
In [ ]:
case = trout.load_file(pref, 40, mydir='../..')
corr_medians = plot.do_table_ci(corr_nbs, case, '/tmp/', cis, 100, 50)
In [ ]:
case = trout.load_file(pref, 40, mydir='../..')
medians = plot.do_table_ci(trout.Nbs, case, '/tmp/', cis, 100, 50, flex_nb=True)
In [ ]: