import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
from scipy.stats import norm
import numpy as np

LH_true = np.array([0.0243454 , 0.01137771, 0.01254166, 0.01764927, 0.01033814,
       0.02188591, 0.01433098, 0.02341697, 0.01063864, 0.01546347,
       0.02686151, 0.02025511, 0.01197237, 0.02294361, 0.01465379,
       0.0151744 , 0.01387005, 0.01617782, 0.00764115, 0.01585363,
       0.02129582, 0.02050885, 0.01058422, 0.00994643, 0.01816286,
       0.01130973, 0.01100134, 0.0147438 , 0.01585406, 0.00797675,
       0.02615668, 0.01925256, 0.01349633, 0.01097237, 0.02214721,
       0.01255305, 0.01814757, 0.01468691, 0.01447975, 0.01437719,
       0.01880171, 0.01347181, 0.00708943, 0.01589191, 0.00989473,
       0.01779402, 0.02564946, 0.01093551, 0.01478732, 0.0212522 ,
       0.00711471, 0.02169546, 0.01605215, 0.01323693, 0.00752848,
       0.019766  , 0.01428411, 0.01656917, 0.01463805, 0.00667371,
       0.01616888, 0.01166911, 0.0056077 , 0.02470745, 0.01036723,
       0.0126541 , 0.01747745, 0.0171829 , 0.01240231, 0.01147828,
       0.01886307, 0.02116652, 0.01692161, 0.01111378, 0.01393348,
       0.02386079, 0.02208303, 0.0199446 , 0.0107561 , 0.01627575,
       0.01685479, 0.0132076 , 0.01698396, 0.01858902, 0.00952094,
       0.01216046, 0.0106047 , 0.01459445, 0.01772976, 0.01722888,
       0.01728338, 0.01786537, 0.013072  , 0.01994857, 0.02338869,
       0.02684308, 0.02221262, 0.01947833, 0.01023174, 0.01598115,
       0.01896411, 0.0186295 , 0.0160543 , 0.01382898, 0.01204012,
       0.02464213, 0.01491632, 0.01788966, 0.01631663, 0.01475178,
       0.01406165, 0.01178407, 0.02474272, 0.01520064, 0.01239701,
       0.0152896 , 0.01348954, 0.01809647, 0.01170881, 0.02105506,
       0.01733557, 0.01744543, 0.02129121, 0.01120059, 0.01936956,
       0.02254451, 0.01549223, 0.02056385, 0.01295331, 0.01065183,
       0.01168009, 0.01060082, 0.00763025, 0.01442777, 0.02457093,
       0.00859534, 0.01106061, 0.01566492, 0.01324606, 0.01816762,
       0.02703854, 0.01756388, 0.01991268, 0.01629434, 0.01725145,
       0.01265852, 0.02766356, 0.02158618, 0.02161537, 0.00999176, 0.01473731, 0.01859166,
       0.01449057, 0.01835252, 0.0186778 , 0.01387449, 0.01903486,
       0.02722244, 0.01148044, 0.01982909, 0.026942  , 0.02122395,
       0.02773364, 0.02430927, 0.01051236, 0.01358496, 0.01102623,
       0.03416789, 0.03194469, 0.02149661, 0.01648806, 0.01531931,
       0.01690401, 0.01875775, 0.01430259, 0.01651443, 0.02838931,
       0.01727156, 0.02462665, 0.01555527, 0.01529346, 0.01392489,
       0.03032773, 0.02009171, 0.01412658, 0.01495382, 0.0152912 ,
       0.01597281, 0.01865346, 0.01833004, 0.01451648, 0.02242841,
       0.01782251, 0.01723732, 0.02525619, 0.01026545, 0.02427086,
       0.02305396, 0.04328358, 0.02482204, 0.01895393, 0.01382958,
       0.02659518, 0.01616063, 0.01551417, 0.00895099, 0.02512712,
       0.01415321, 0.0170071 , 0.0105686 , 0.01563909, 0.021591  ,
       0.01358423, 0.0184547 , 0.01539448, 0.00932675, 0.01997146,
       0.02333521, 0.01917388, 0.01850855, 0.02079451, 0.01310238,
       0.02184266, 0.01591911, 0.01651602, 0.01609568, 0.01704943,
       0.01193077, 0.02053374, 0.02039069, 0.02638249, 0.01671001,
       0.01905075, 0.01243356, 0.01343778, 0.01656691, 0.0095928 ,
       0.02071538, 0.02337493, 0.00827804, 0.01976005, 0.02027279,
       0.0247019 , 0.01459988, 0.01947134, 0.02537729, 0.00908717,
       0.02414107, 0.01676044, 0.01828911, 0.01069696, 0.01870233,
       0.02104198, 0.01302839, 0.0202646 , 0.01280324, 0.02970006,
       0.01539649, 0.01506436, 0.02363847, 0.01555497, 0.02231712,
       0.02302281, 0.00850748, 0.01601754, 0.01767472, 0.01077911,
       0.0081332 , 0.01378332, 0.01805357, 0.01497471, 0.02957416,
       0.01215248, 0.01825334, 0.0116856 , 0.021292  , 0.01611323,
       0.0144216 , 0.00901409, 0.02075969, 0.01812357, 0.01125501,
       0.01719236, 0.02411616, 0.02248682, 0.0132942 , 0.02110585,
       0.02063637, 0.01527086, 0.01527054, 0.01304916, 0.0187296 ])

LH_blank = np.array([0.08304965, 0.06080693, 0.0482525 , 0.0649201 , 0.0640573 ,
       0.06705837, 0.05588193, 0.06804985, 0.06204738, 0.07110258,
       0.06302665, 0.06502905, 0.05035468, 0.06022349, 0.0672238 ,
       0.06167749, 0.05564668, 0.04939812, 0.05372307, 0.05914843,
       0.06945211, 0.06564107, 0.05507835, 0.05505144, 0.05764116,
       0.07468537, 0.09165873, 0.05438113, 0.06730468, 0.05179002,
       0.06210032, 0.05342516, 0.06438767, 0.05800271, 0.05721558,
       0.05063468, 0.05135811, 0.06327395, 0.0535465 , 0.06835398,
       0.05815953, 0.0510736 , 0.0518777 , 0.0525936 , 0.04894333,
       0.04719285, 0.0595056 , 0.0646691 , 0.05812805, 0.04536958,
       0.04551008, 0.05569348, 0.0607035 , 0.05834383, 0.0599524 ,
       0.05684288, 0.07685856, 0.07334129, 0.05275547, 0.06272876,
       0.0759981 , 0.05757865, 0.05477774, 0.06868113, 0.06001401,
       0.05662394, 0.06233353, 0.06314249, 0.06525627, 0.04958797,
       0.05472175, 0.04701968, 0.05103793, 0.06741105, 0.06329287,
       0.06975287, 0.06096613, 0.06295818, 0.07347939, 0.06249537,
       0.07376806, 0.05273684, 0.06754793, 0.07171878, 0.06415552,
       0.04686758, 0.0644156 , 0.05213181, 0.06045513, 0.05235446,
       0.05073884, 0.05955901, 0.04698793, 0.07063938, 0.06507942,
       0.06418177, 0.0661636 , 0.07836832, 0.05613743, 0.06591954,
       0.05424148, 0.06357661, 0.06114524, 0.0742442 , 0.05157953,
       0.06200482, 0.06292991, 0.05647538, 0.05909437, 0.06021794,
       0.06420677, 0.06153891, 0.06777815, 0.06706225, 0.06150297,
       0.05009785, 0.06696403, 0.07399453, 0.05355416, 0.062324  ,
       0.06045424, 0.06034979, 0.05991676, 0.05596294, 0.05135072,
       0.0662274 , 0.06995949, 0.06120868, 0.06505551, 0.05986491,
       0.05456196, 0.05744792, 0.05685432, 0.05828814, 0.06398348,
       0.04472965, 0.04956053, 0.06066678, 0.05240257, 0.08326158,
       0.07985956, 0.06432525, 0.06154276, 0.05817112, 0.060151  ,
       0.05059023, 0.05489021, 0.05563025, 0.063263  , 0.06576202, 0.07686813, 0.06580925,
       0.0520939 , 0.06379999, 0.07863038, 0.0610713 , 0.05265974,
       0.04835468, 0.05268484, 0.07517789, 0.05306532, 0.06226278,
       0.06318275, 0.05354689, 0.06454231, 0.06309215, 0.05697054,
       0.07827121, 0.06857839, 0.06095889, 0.05661007, 0.05444159,
       0.05447736, 0.05697821, 0.07127665, 0.07957589, 0.07016962,
       0.07917787, 0.06106016, 0.06776004, 0.05779531, 0.07288225,
       0.07865921, 0.05486289, 0.07440147, 0.06326295, 0.05677992,
       0.05197074, 0.06196661, 0.05926011, 0.06985814, 0.06930489,
       0.07357475, 0.0540926 , 0.05544375, 0.05936779, 0.07614674,
       0.06522005, 0.07360504, 0.07443281, 0.05293929, 0.06339275,
       0.07029855, 0.07083263, 0.06782097, 0.05652063, 0.07244678,
       0.05733038, 0.05271803, 0.04808172, 0.07060203, 0.07378644,
       0.0630273 , 0.05762263, 0.07018321, 0.07420641, 0.05416345,
       0.06422581, 0.06260748, 0.06567329, 0.06028148, 0.05978885,
       0.04843193, 0.06057947, 0.07205037, 0.07889045, 0.07589037,
       0.06160799, 0.0640422 , 0.07622705, 0.06008831, 0.0779916 ,
       0.06576271, 0.06497154, 0.09299609, 0.05454212, 0.05018721,
       0.05485121, 0.06243918, 0.06107676, 0.07047842, 0.09407295,
       0.07071589, 0.06648009, 0.06374476, 0.06310968, 0.05093832,
       0.07328377, 0.05327595, 0.07889496, 0.04354965, 0.07494471,
       0.07227842, 0.06500141, 0.05200499, 0.06035391, 0.07445067,
       0.07164518, 0.06222149, 0.07251397, 0.05433986, 0.06180596,
       0.05355925, 0.06436578, 0.06308719, 0.09213091, 0.06305138,
       0.0592763 , 0.06326752, 0.06648095, 0.08136742, 0.07603733,
       0.052779  , 0.0694418 , 0.05053868, 0.06106663, 0.06493369,
       0.05378584, 0.05587382, 0.05808794, 0.0585373 , 0.0646637 ,
       0.0830994 , 0.07565213, 0.06382791, 0.06599428, 0.05706224,
       0.06382753, 0.06938497, 0.06560417, 0.0586922 , 0.06824748])

LHR = np.sqrt(len(LH_true))*(LH_true - LH_blank)
sns.set(color_codes=True)
LHR_dis = sns.distplot(LHR, fit=norm, kde=False);
# LHR_dis.set(xlim=(-.03, .04))
plt.title('Histgram of the likelihhod ratio based on 350 samples of random split')
plt.ylabel('count')
plt.show()


sns.distplot(LH_true, fit=norm, kde=False);
sns.distplot(LH_blank, fit=norm, kde=False);
# plt.set(xlim=(None, .04))
plt.title('Histgram of two distributions of likelihhod based on 350 samples of random split')
plt.ylabel('count')
plt.show()
import seaborn as sns
import matplotlib.pyplot as plt
from scipy import stats
from scipy.stats import norm
import numpy as np

LH_true = np.array([0.0243454 , 0.01137771, 0.01254166, 0.01764927, 0.01033814,
       0.02188591, 0.01433098, 0.02341697, 0.01063864, 0.01546347,
       0.02686151, 0.02025511, 0.01197237, 0.02294361, 0.01465379,
       0.0151744 , 0.01387005, 0.01617782, 0.00764115, 0.01585363,
       0.02129582, 0.02050885, 0.01058422, 0.00994643, 0.01816286,
       0.01130973, 0.01100134, 0.0147438 , 0.01585406, 0.00797675,
       0.02615668, 0.01925256, 0.01349633, 0.01097237, 0.02214721,
       0.01255305, 0.01814757, 0.01468691, 0.01447975, 0.01437719,
       0.01880171, 0.01347181, 0.00708943, 0.01589191, 0.00989473,
       0.01779402, 0.02564946, 0.01093551, 0.01478732, 0.0212522 ,
       0.00711471, 0.02169546, 0.01605215, 0.01323693, 0.00752848,
       0.019766  , 0.01428411, 0.01656917, 0.01463805, 0.00667371,
       0.01616888, 0.01166911, 0.0056077 , 0.02470745, 0.01036723,
       0.0126541 , 0.01747745, 0.0171829 , 0.01240231, 0.01147828,
       0.01886307, 0.02116652, 0.01692161, 0.01111378, 0.01393348,
       0.02386079, 0.02208303, 0.0199446 , 0.0107561 , 0.01627575,
       0.01685479, 0.0132076 , 0.01698396, 0.01858902, 0.00952094,
       0.01216046, 0.0106047 , 0.01459445, 0.01772976, 0.01722888,
       0.01728338, 0.01786537, 0.013072  , 0.01994857, 0.02338869,
       0.02684308, 0.02221262, 0.01947833, 0.01023174, 0.01598115,
       0.01896411, 0.0186295 , 0.0160543 , 0.01382898, 0.01204012,
       0.02464213, 0.01491632, 0.01788966, 0.01631663, 0.01475178,
       0.01406165, 0.01178407, 0.02474272, 0.01520064, 0.01239701,
       0.0152896 , 0.01348954, 0.01809647, 0.01170881, 0.02105506,
       0.01733557, 0.01744543, 0.02129121, 0.01120059, 0.01936956,
       0.02254451, 0.01549223, 0.02056385, 0.01295331, 0.01065183,
       0.01168009, 0.01060082, 0.00763025, 0.01442777, 0.02457093,
       0.00859534, 0.01106061, 0.01566492, 0.01324606, 0.01816762,
       0.02703854, 0.01756388, 0.01991268, 0.01629434, 0.01725145,
       0.01265852, 0.02766356, 0.02158618, 0.02161537, 0.00999176, 0.01473731, 0.01859166,
       0.01449057, 0.01835252, 0.0186778 , 0.01387449, 0.01903486,
       0.02722244, 0.01148044, 0.01982909, 0.026942  , 0.02122395,
       0.02773364, 0.02430927, 0.01051236, 0.01358496, 0.01102623,
       0.03416789, 0.03194469, 0.02149661, 0.01648806, 0.01531931,
       0.01690401, 0.01875775, 0.01430259, 0.01651443, 0.02838931,
       0.01727156, 0.02462665, 0.01555527, 0.01529346, 0.01392489,
       0.03032773, 0.02009171, 0.01412658, 0.01495382, 0.0152912 ,
       0.01597281, 0.01865346, 0.01833004, 0.01451648, 0.02242841,
       0.01782251, 0.01723732, 0.02525619, 0.01026545, 0.02427086,
       0.02305396, 0.04328358, 0.02482204, 0.01895393, 0.01382958,
       0.02659518, 0.01616063, 0.01551417, 0.00895099, 0.02512712,
       0.01415321, 0.0170071 , 0.0105686 , 0.01563909, 0.021591  ,
       0.01358423, 0.0184547 , 0.01539448, 0.00932675, 0.01997146,
       0.02333521, 0.01917388, 0.01850855, 0.02079451, 0.01310238,
       0.02184266, 0.01591911, 0.01651602, 0.01609568, 0.01704943,
       0.01193077, 0.02053374, 0.02039069, 0.02638249, 0.01671001,
       0.01905075, 0.01243356, 0.01343778, 0.01656691, 0.0095928 ,
       0.02071538, 0.02337493, 0.00827804, 0.01976005, 0.02027279,
       0.0247019 , 0.01459988, 0.01947134, 0.02537729, 0.00908717,
       0.02414107, 0.01676044, 0.01828911, 0.01069696, 0.01870233,
       0.02104198, 0.01302839, 0.0202646 , 0.01280324, 0.02970006,
       0.01539649, 0.01506436, 0.02363847, 0.01555497, 0.02231712,
       0.02302281, 0.00850748, 0.01601754, 0.01767472, 0.01077911,
       0.0081332 , 0.01378332, 0.01805357, 0.01497471, 0.02957416,
       0.01215248, 0.01825334, 0.0116856 , 0.021292  , 0.01611323,
       0.0144216 , 0.00901409, 0.02075969, 0.01812357, 0.01125501,
       0.01719236, 0.02411616, 0.02248682, 0.0132942 , 0.02110585,
       0.02063637, 0.01527086, 0.01527054, 0.01304916, 0.0187296 ])

LH_blank = np.array([0.08304965, 0.06080693, 0.0482525 , 0.0649201 , 0.0640573 ,
       0.06705837, 0.05588193, 0.06804985, 0.06204738, 0.07110258,
       0.06302665, 0.06502905, 0.05035468, 0.06022349, 0.0672238 ,
       0.06167749, 0.05564668, 0.04939812, 0.05372307, 0.05914843,
       0.06945211, 0.06564107, 0.05507835, 0.05505144, 0.05764116,
       0.07468537, 0.09165873, 0.05438113, 0.06730468, 0.05179002,
       0.06210032, 0.05342516, 0.06438767, 0.05800271, 0.05721558,
       0.05063468, 0.05135811, 0.06327395, 0.0535465 , 0.06835398,
       0.05815953, 0.0510736 , 0.0518777 , 0.0525936 , 0.04894333,
       0.04719285, 0.0595056 , 0.0646691 , 0.05812805, 0.04536958,
       0.04551008, 0.05569348, 0.0607035 , 0.05834383, 0.0599524 ,
       0.05684288, 0.07685856, 0.07334129, 0.05275547, 0.06272876,
       0.0759981 , 0.05757865, 0.05477774, 0.06868113, 0.06001401,
       0.05662394, 0.06233353, 0.06314249, 0.06525627, 0.04958797,
       0.05472175, 0.04701968, 0.05103793, 0.06741105, 0.06329287,
       0.06975287, 0.06096613, 0.06295818, 0.07347939, 0.06249537,
       0.07376806, 0.05273684, 0.06754793, 0.07171878, 0.06415552,
       0.04686758, 0.0644156 , 0.05213181, 0.06045513, 0.05235446,
       0.05073884, 0.05955901, 0.04698793, 0.07063938, 0.06507942,
       0.06418177, 0.0661636 , 0.07836832, 0.05613743, 0.06591954,
       0.05424148, 0.06357661, 0.06114524, 0.0742442 , 0.05157953,
       0.06200482, 0.06292991, 0.05647538, 0.05909437, 0.06021794,
       0.06420677, 0.06153891, 0.06777815, 0.06706225, 0.06150297,
       0.05009785, 0.06696403, 0.07399453, 0.05355416, 0.062324  ,
       0.06045424, 0.06034979, 0.05991676, 0.05596294, 0.05135072,
       0.0662274 , 0.06995949, 0.06120868, 0.06505551, 0.05986491,
       0.05456196, 0.05744792, 0.05685432, 0.05828814, 0.06398348,
       0.04472965, 0.04956053, 0.06066678, 0.05240257, 0.08326158,
       0.07985956, 0.06432525, 0.06154276, 0.05817112, 0.060151  ,
       0.05059023, 0.05489021, 0.05563025, 0.063263  , 0.06576202, 0.07686813, 0.06580925,
       0.0520939 , 0.06379999, 0.07863038, 0.0610713 , 0.05265974,
       0.04835468, 0.05268484, 0.07517789, 0.05306532, 0.06226278,
       0.06318275, 0.05354689, 0.06454231, 0.06309215, 0.05697054,
       0.07827121, 0.06857839, 0.06095889, 0.05661007, 0.05444159,
       0.05447736, 0.05697821, 0.07127665, 0.07957589, 0.07016962,
       0.07917787, 0.06106016, 0.06776004, 0.05779531, 0.07288225,
       0.07865921, 0.05486289, 0.07440147, 0.06326295, 0.05677992,
       0.05197074, 0.06196661, 0.05926011, 0.06985814, 0.06930489,
       0.07357475, 0.0540926 , 0.05544375, 0.05936779, 0.07614674,
       0.06522005, 0.07360504, 0.07443281, 0.05293929, 0.06339275,
       0.07029855, 0.07083263, 0.06782097, 0.05652063, 0.07244678,
       0.05733038, 0.05271803, 0.04808172, 0.07060203, 0.07378644,
       0.0630273 , 0.05762263, 0.07018321, 0.07420641, 0.05416345,
       0.06422581, 0.06260748, 0.06567329, 0.06028148, 0.05978885,
       0.04843193, 0.06057947, 0.07205037, 0.07889045, 0.07589037,
       0.06160799, 0.0640422 , 0.07622705, 0.06008831, 0.0779916 ,
       0.06576271, 0.06497154, 0.09299609, 0.05454212, 0.05018721,
       0.05485121, 0.06243918, 0.06107676, 0.07047842, 0.09407295,
       0.07071589, 0.06648009, 0.06374476, 0.06310968, 0.05093832,
       0.07328377, 0.05327595, 0.07889496, 0.04354965, 0.07494471,
       0.07227842, 0.06500141, 0.05200499, 0.06035391, 0.07445067,
       0.07164518, 0.06222149, 0.07251397, 0.05433986, 0.06180596,
       0.05355925, 0.06436578, 0.06308719, 0.09213091, 0.06305138,
       0.0592763 , 0.06326752, 0.06648095, 0.08136742, 0.07603733,
       0.052779  , 0.0694418 , 0.05053868, 0.06106663, 0.06493369,
       0.05378584, 0.05587382, 0.05808794, 0.0585373 , 0.0646637 ,
       0.0830994 , 0.07565213, 0.06382791, 0.06599428, 0.05706224,
       0.06382753, 0.06938497, 0.06560417, 0.0586922 , 0.06824748])

LHR = np.sqrt(len(LH_true))*(LH_true - LH_blank)
sns.set(color_codes=True)
LHR_dis = sns.distplot(LHR, fit=norm, kde=False);
# LHR_dis.set(xlim=(-.03, .04))
plt.title('Histgram of the likelihhod ratio based on 350 samples of random split')
plt.ylabel('count')
plt.show()


sns.distplot(LH_true, fit=norm, kde=False);
sns.distplot(LH_blank, fit=norm, kde=False);
# plt.set(xlim=(None, .04))
plt.title('Histgram of two distributions of likelihhod based on 350 samples of random split')
plt.ylabel('count')
plt.show()
# LHR_dis.set(xlim=(-.03, .04)) # plt.set(xlim=(None, .04))