(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 6.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 238262, 5584] NotebookOptionsPosition[ 234999, 5474] NotebookOutlinePosition[ 235467, 5493] CellTagsIndexPosition[ 235424, 5490] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell["\<\ Estimation of gBGC from site frequency spectra correcting for polarization \ errors\ \>", "Title", CellChangeTimes->{{3.48255112685575*^9, 3.482551135465125*^9}, { 3.4825514754495*^9, 3.482551496308875*^9}, {3.5613134824825583`*^9, 3.5613134945188*^9}, {3.636046920884818*^9, 3.6360469784785957`*^9}}, FontWeight->"Plain"], Cell["\<\ Method published in \[OpenCurlyDoubleQuote]Quantification of GC-biased gene \ conversion in the human genome\[CloseCurlyDoubleQuote] by S. Gl\[EAcute]min, \ P.F. Arndt, P.W. Messer, D. Petrov, N. Galtier, and L. Duret.\ \>", "Subsubtitle", CellChangeTimes->{{3.6360469913521214`*^9, 3.636046992431287*^9}, { 3.6360471477104588`*^9, 3.636047277798527*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"Clear", "[", "\"\<`*\>\"", "]"}], ";"}]], "Input"], Cell[CellGroupData[{ Cell["Likelihoods functions", "Section", CellChangeTimes->{{3.4955360340102997`*^9, 3.4955360370102997`*^9}, { 3.564231080969344*^9, 3.564231084557279*^9}, {3.6360472817988777`*^9, 3.636047283038609*^9}}], Cell[CellGroupData[{ Cell[TextData[StyleBox["Expected values", FontWeight->"Plain"]], "Subsection", CellChangeTimes->{{3.564237392690611*^9, 3.5642374058879642`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{"Expectations", " ", "without", " ", "orientation", " ", "error"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"\[Mu]B", "[", RowBox[{"\[Theta]_", ",", "B_", ",", "n_", ",", "j_"}], "]"}], "=", RowBox[{ FractionBox[ RowBox[{"n", " ", "\[Theta]"}], RowBox[{"j", RowBox[{"(", RowBox[{ RowBox[{"-", "j"}], "+", "n"}], ")"}]}]], FractionBox[ RowBox[{"1", "-", RowBox[{"Exp", "[", RowBox[{ RowBox[{"-", "B"}], RowBox[{"(", RowBox[{"1", "-", RowBox[{"j", "/", "n"}]}], ")"}]}], "]"}]}], RowBox[{"1", "-", RowBox[{"Exp", "[", RowBox[{"-", "B"}], "]"}]}]]}]}], ";"}], " ", RowBox[{"(*", RowBox[{"Constant", " ", "gBGC", " ", "model", " ", "M1"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[Mu]fa", "[", RowBox[{"\[Theta]_", ",", "B_", ",", "f_", ",", "n_", ",", "j_"}], "]"}], "=", RowBox[{ RowBox[{"f", FractionBox[ RowBox[{"n", " ", "\[Theta]"}], RowBox[{"j", RowBox[{"(", RowBox[{ RowBox[{"-", "j"}], "+", "n"}], ")"}]}]], FractionBox[ RowBox[{"1", "-", RowBox[{"Exp", "[", RowBox[{ RowBox[{"-", "B"}], RowBox[{"(", RowBox[{"1", "-", RowBox[{"j", "/", "n"}]}], ")"}]}], "]"}]}], RowBox[{"1", "-", RowBox[{"Exp", "[", RowBox[{"-", "B"}], "]"}]}]]}], "+", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "f"}], ")"}], FractionBox["\[Theta]", "j"]}]}]}], ";"}], " ", RowBox[{"(*", RowBox[{"Hotspot", " ", "model", " ", "M2a"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[Mu]fb", "[", RowBox[{ "\[Theta]_", ",", "B0_", ",", "B1_", ",", "f_", ",", "n_", ",", "j_"}], "]"}], "=", RowBox[{ RowBox[{"f", FractionBox[ RowBox[{"n", " ", "\[Theta]"}], RowBox[{"j", RowBox[{"(", RowBox[{ RowBox[{"-", "j"}], "+", "n"}], ")"}]}]], FractionBox[ RowBox[{"1", "-", RowBox[{"Exp", "[", RowBox[{ RowBox[{"-", "B1"}], RowBox[{"(", RowBox[{"1", "-", RowBox[{"j", "/", "n"}]}], ")"}]}], "]"}]}], RowBox[{"1", "-", RowBox[{"Exp", "[", RowBox[{"-", "B1"}], "]"}]}]]}], "+", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "f"}], ")"}], FractionBox[ RowBox[{"n", " ", "\[Theta]"}], RowBox[{"j", RowBox[{"(", RowBox[{ RowBox[{"-", "j"}], "+", "n"}], ")"}]}]], FractionBox[ RowBox[{"1", "-", RowBox[{"Exp", "[", RowBox[{ RowBox[{"-", "B0"}], RowBox[{"(", RowBox[{"1", "-", RowBox[{"j", "/", "n"}]}], ")"}]}], "]"}]}], RowBox[{"1", "-", RowBox[{"Exp", "[", RowBox[{"-", "B0"}], "]"}]}]]}]}]}], ";"}], " ", RowBox[{"(*", RowBox[{"Hotspot", " ", "model", " ", "M2b"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Expectations", " ", "with", " ", "constant", " ", "orientation", " ", "errors"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[Mu]e", "[", RowBox[{ "\[Theta]1_", ",", "\[Theta]2_", ",", "\[Epsilon]1_", ",", "\[Epsilon]2_", ",", "n_", ",", "i_"}], "]"}], "=", RowBox[{"Simplify", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "\[Epsilon]1"}], ")"}], RowBox[{"\[Theta]1", "/", "i"}]}], "+", RowBox[{"\[Epsilon]2", " ", RowBox[{"\[Theta]2", "/", RowBox[{"(", RowBox[{"n", "-", "i"}], ")"}]}]}]}], "]"}]}], ";"}], " ", RowBox[{"(*", RowBox[{"Neutral", " ", "expectation"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[Mu]Be", "[", RowBox[{ "\[Theta]1_", ",", "\[Theta]2_", ",", "B_", ",", "\[Epsilon]1_", ",", "\[Epsilon]2_", ",", "n_", ",", "i_"}], "]"}], "=", RowBox[{"Simplify", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "\[Epsilon]1"}], ")"}], RowBox[{"\[Mu]B", "[", RowBox[{"\[Theta]1", ",", "B", ",", "n", ",", "i"}], "]"}]}], "+", RowBox[{"\[Epsilon]2", " ", RowBox[{"\[Mu]B", "[", RowBox[{"\[Theta]2", ",", RowBox[{"-", "B"}], ",", "n", ",", RowBox[{"n", "-", "i"}]}], "]"}]}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[Mu]fae", "[", RowBox[{ "\[Theta]1_", ",", "\[Theta]2_", ",", "B_", ",", "f_", ",", "\[Epsilon]1_", ",", "\[Epsilon]2_", ",", "n_", ",", "i_"}], "]"}], "=", RowBox[{"Simplify", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "\[Epsilon]1"}], ")"}], RowBox[{"\[Mu]fa", "[", RowBox[{"\[Theta]1", ",", "B", ",", "f", ",", "n", ",", "i"}], "]"}]}], "+", RowBox[{"\[Epsilon]2", " ", RowBox[{"\[Mu]fa", "[", RowBox[{"\[Theta]2", ",", RowBox[{"-", "B"}], ",", "f", ",", "n", ",", RowBox[{"n", "-", "i"}]}], "]"}]}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"\[Mu]fbe", "[", RowBox[{ "\[Theta]1_", ",", "\[Theta]2_", ",", "B0_", ",", "B1_", ",", "f_", ",", "\[Epsilon]1_", ",", "\[Epsilon]2_", ",", "n_", ",", "i_"}], "]"}], "=", RowBox[{"Simplify", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "\[Epsilon]1"}], ")"}], RowBox[{"\[Mu]fb", "[", RowBox[{ "\[Theta]1", ",", "B0", ",", "B1", ",", "f", ",", "n", ",", "i"}], "]"}]}], "+", RowBox[{"\[Epsilon]2", " ", RowBox[{"\[Mu]fb", "[", RowBox[{"\[Theta]2", ",", RowBox[{"-", "B0"}], ",", RowBox[{"-", "B1"}], ",", "f", ",", "n", ",", RowBox[{"n", "-", "i"}]}], "]"}]}]}], "]"}]}], ";"}]}]}]], "Input", CellChangeTimes->{{3.4940056658642187`*^9, 3.494005667105538*^9}, { 3.494005987221553*^9, 3.494005989143428*^9}, {3.494006188721553*^9, 3.494006196346553*^9}, {3.561179779508519*^9, 3.561179795143834*^9}, { 3.561179831034103*^9, 3.5611798678847857`*^9}, {3.564228969839754*^9, 3.5642289731461897`*^9}, {3.564232048673462*^9, 3.564232083574778*^9}, { 3.5642376995569077`*^9, 3.564237745299337*^9}, {3.5642527128164663`*^9, 3.5642527483522367`*^9}, {3.564252868366748*^9, 3.564252918020035*^9}, { 3.564253343221607*^9, 3.564253435142303*^9}, {3.564253591646447*^9, 3.564253714143167*^9}, {3.564255563836926*^9, 3.56425556645154*^9}, { 3.564465024740593*^9, 3.564465037837082*^9}, {3.5644678123008537`*^9, 3.564467812953165*^9}, {3.564939305739423*^9, 3.5649393513473787`*^9}, { 3.5650358498475103`*^9, 3.565035926672106*^9}, {3.565036029730361*^9, 3.565036247143754*^9}, {3.5650378462709627`*^9, 3.565037912733377*^9}, 3.565037967526767*^9, {3.5671640570585546`*^9, 3.5671640577462*^9}, { 3.567164092899674*^9, 3.567164154600419*^9}, {3.5671857028773317`*^9, 3.567185756719508*^9}, {3.567186268570753*^9, 3.567186351487999*^9}, { 3.5674041262860117`*^9, 3.567404316315624*^9}, {3.5674055421366777`*^9, 3.5674056230102882`*^9}, {3.567406224586637*^9, 3.567406233475617*^9}, { 3.567407581569457*^9, 3.567407674613771*^9}, {3.567413065228266*^9, 3.567413075857526*^9}, 3.567413196592614*^9, {3.567417849809593*^9, 3.5674178573254538`*^9}, {3.56783275483885*^9, 3.5678328549940233`*^9}, { 3.567832970231847*^9, 3.567833018982087*^9}, {3.567833286827713*^9, 3.567833420896872*^9}, {3.567834107471382*^9, 3.567834108404274*^9}, { 3.56871914505504*^9, 3.568719158635133*^9}, {3.5687192487108927`*^9, 3.568719284683043*^9}, {3.568956754467782*^9, 3.568956758747321*^9}, { 3.568957439396158*^9, 3.568957442186912*^9}, {3.593455188126164*^9, 3.5934552229128723`*^9}, {3.593456236872415*^9, 3.5934562542756844`*^9}, { 3.5934565061108627`*^9, 3.593456517049469*^9}, {3.593456594457025*^9, 3.593456632793089*^9}, {3.593456698343396*^9, 3.593456722748036*^9}, { 3.593456934917753*^9, 3.593456990983116*^9}, 3.5934571100162086`*^9, { 3.593457160744796*^9, 3.5934571841430483`*^9}, {3.593457222946492*^9, 3.5934572559791393`*^9}, {3.593505771249268*^9, 3.5935057717108517`*^9}, { 3.601640464169365*^9, 3.601640488497766*^9}, 3.601641358203021*^9, { 3.6360472941570387`*^9, 3.636047403787611*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[TextData[StyleBox["Saturated model", FontWeight->"Plain"]], "Subsection", CellChangeTimes->{{3.564237302072982*^9, 3.56423730475856*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"lnLmax", "[", "k_", "]"}], "=", RowBox[{ RowBox[{"-", "k"}], "+", RowBox[{"k", " ", RowBox[{"Log", "[", "k", "]"}]}], "-", RowBox[{"Log", "[", RowBox[{"k", "!"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"logLikMax", "[", RowBox[{"kn__", ",", "kWS__", ",", "kSW__"}], "]"}], ":=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLmax", "[", "kn", "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLmax", "[", "kWS", "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLmax", "[", "kSW", "]"}], "]"}]}], "]"}]}]}]}], "Input", CellChangeTimes->{{3.564233524524336*^9, 3.564233543056694*^9}, { 3.564233609983819*^9, 3.564233647176907*^9}, {3.564233716737445*^9, 3.5642337188516073`*^9}, 3.564233887736946*^9, {3.564238199777665*^9, 3.564238217907858*^9}, {3.5642382522012167`*^9, 3.5642382537128553`*^9}, { 3.56447753557412*^9, 3.564477569569031*^9}, 3.5644776283164997`*^9, { 3.56447770756248*^9, 3.5644777104187202`*^9}, {3.5644777703272333`*^9, 3.56447779560394*^9}, {3.57211327032513*^9, 3.572113300959813*^9}, { 3.572113388015717*^9, 3.572113392003645*^9}}] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Likelihood functions without orientation error\ \>", "Subsection", CellChangeTimes->{{3.482126208668176*^9, 3.482126209918176*^9}, { 3.484974887227271*^9, 3.484974889805396*^9}, {3.484991746711978*^9, 3.4849917493589497`*^9}, {3.495471792211625*^9, 3.495471792742875*^9}, { 3.49547188878975*^9, 3.495471898946*^9}, {3.56423327247073*^9, 3.564233291197975*^9}, {3.636047419797276*^9, 3.636047463030662*^9}, { 3.636047608822549*^9, 3.636047610038672*^9}}, FontWeight->"Plain"], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "Likelihood", " ", "functions", " ", "for", " ", "one", " ", "SNP", " ", "frequency"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"lnLnull", "[", RowBox[{"\[Theta]_", ",", "n_", ",", "i_", ",", "k_"}], "]"}], "=", RowBox[{ RowBox[{ RowBox[{"-", "\[Theta]"}], "/", "i"}], "+", RowBox[{"k", " ", RowBox[{"Log", "[", RowBox[{"\[Theta]", "/", "i"}], "]"}]}], "-", RowBox[{"Log", "[", RowBox[{"k", "!"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"lnLB", "[", RowBox[{"\[Theta]_", ",", "B_", ",", "n_", ",", "i_", ",", "k_"}], "]"}], "=", RowBox[{ RowBox[{"-", RowBox[{"\[Mu]B", "[", RowBox[{"\[Theta]", ",", "B", ",", "n", ",", "i"}], "]"}]}], "+", RowBox[{"k", " ", RowBox[{"Log", "[", RowBox[{"\[Mu]B", "[", RowBox[{"\[Theta]", ",", "B", ",", "n", ",", "i"}], "]"}], "]"}]}], "-", RowBox[{"Log", "[", RowBox[{"k", "!"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"lnLBfa", "[", RowBox[{ "\[Theta]_", ",", "B_", ",", "f_", ",", "n_", ",", "i_", ",", "k_"}], "]"}], "=", RowBox[{ RowBox[{"-", RowBox[{"\[Mu]fa", "[", RowBox[{"\[Theta]", ",", "B", ",", "f", ",", "n", ",", "i"}], "]"}]}], "+", RowBox[{"k", " ", RowBox[{"Log", "[", RowBox[{"\[Mu]fa", "[", RowBox[{"\[Theta]", ",", "B", ",", "f", ",", "n", ",", "i"}], "]"}], "]"}]}], "-", RowBox[{"Log", "[", RowBox[{"k", "!"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"lnLBfb", "[", RowBox[{ "\[Theta]_", ",", "B0_", ",", "B1_", ",", "f_", ",", "n_", ",", "i_", ",", "k_"}], "]"}], "=", RowBox[{ RowBox[{"-", RowBox[{"\[Mu]fb", "[", RowBox[{ "\[Theta]", ",", "B0", ",", "B1", ",", "f", ",", "n", ",", "i"}], "]"}]}], "+", RowBox[{"k", " ", RowBox[{"Log", "[", RowBox[{"\[Mu]fb", "[", RowBox[{ "\[Theta]", ",", "B0", ",", "B1", ",", "f", ",", "n", ",", "i"}], "]"}], "]"}]}], "-", RowBox[{"Log", "[", RowBox[{"k", "!"}], "]"}]}]}], ";"}]}]}]], "Input", CellChangeTimes->{{3.5642380034577637`*^9, 3.5642380894493847`*^9}, { 3.564253721353964*^9, 3.564253726200589*^9}, {3.567833464178841*^9, 3.567833549935272*^9}, {3.5678335814244423`*^9, 3.567833598853085*^9}, { 3.567834948821879*^9, 3.5678349600146313`*^9}, {3.636047489469079*^9, 3.636047490725548*^9}, {3.636047586821166*^9, 3.6360476315585012`*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{"Full", " ", "likelihood", " ", "functions"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"logLik0", "[", RowBox[{ "n_", ",", "gc_", ",", "\[Theta]_", ",", "\[Theta]WS_", ",", "\[Lambda]_", ",", "r__", ",", "kn__", ",", "kWS__", ",", "kSW__"}], "]"}], ":=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnull", "[", RowBox[{ RowBox[{"\[Theta]", " ", "r"}], ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kn"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnull", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", "r"}], ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kWS"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnull", "[", RowBox[{ RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", "r"}], ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kSW"}], "]"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"logLik1", "[", RowBox[{ "n_", ",", "gc_", ",", "\[Theta]_", ",", "\[Theta]WS_", ",", "\[Lambda]_", ",", "B_", ",", "r__", ",", "kn__", ",", "kWS__", ",", "kSW__"}], "]"}], ":=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnull", "[", RowBox[{ RowBox[{"\[Theta]", " ", "r"}], ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kn"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLB", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", "r"}], ",", "B", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kWS"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLB", "[", RowBox[{ RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", "r"}], ",", RowBox[{"-", "B"}], ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kSW"}], "]"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"logLik2a", "[", RowBox[{ "n_", ",", "gc_", ",", "\[Theta]_", ",", "\[Theta]WS_", ",", "\[Lambda]_", ",", "B_", ",", "f_", ",", "r__", ",", "kn__", ",", "kWS__", ",", "kSW__"}], "]"}], ":=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnull", "[", RowBox[{ RowBox[{"\[Theta]", " ", "r"}], ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kn"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLBfa", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", "r"}], ",", "B", ",", "f", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kWS"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLBfa", "[", RowBox[{ RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", "r"}], ",", RowBox[{"-", "B"}], ",", "f", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kSW"}], "]"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"logLik2b", "[", RowBox[{ "n_", ",", "gc_", ",", "\[Theta]_", ",", "\[Theta]WS_", ",", "\[Lambda]_", ",", "B0_", ",", "B1_", ",", "f_", ",", "r__", ",", "kn__", ",", "kWS__", ",", "kSW__"}], "]"}], ":=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnull", "[", RowBox[{ RowBox[{"\[Theta]", " ", "r"}], ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kn"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLBfb", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", "r"}], ",", "B0", ",", "B1", ",", "f", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kWS"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLBfb", "[", RowBox[{ RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", "r"}], ",", RowBox[{"-", "B0"}], ",", RowBox[{"-", "B1"}], ",", "f", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kSW"}], "]"}], "]"}]}], "]"}]}]}]}]}]], "Input", CellChangeTimes->{{3.5642312464387703`*^9, 3.564231467145146*^9}, { 3.564231601664914*^9, 3.5642316197715073`*^9}, {3.564231663082399*^9, 3.564231677292872*^9}, {3.56423192808986*^9, 3.5642319283827353`*^9}, { 3.5642320247561083`*^9, 3.564232027514914*^9}, {3.5642321160595512`*^9, 3.5642321600600853`*^9}, {3.564232854681942*^9, 3.56423287491221*^9}, { 3.5678336048957253`*^9, 3.5678336871168003`*^9}, {3.567834898802054*^9, 3.567834916924305*^9}, {3.636047497945342*^9, 3.636047498559001*^9}, { 3.6360476356154423`*^9, 3.636047659636778*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[TextData[StyleBox["Likelihood functions with orientation errors", FontWeight->"Plain"]], "Subsection", CellChangeTimes->{{3.564237252556658*^9, 3.56423728032006*^9}, 3.5642544652240343`*^9, {3.565036255047193*^9, 3.565036258435347*^9}, { 3.636047450521759*^9, 3.636047472318934*^9}, {3.6360476124308767`*^9, 3.636047613350885*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{ "Likelihood", " ", "functions", " ", "for", " ", "one", " ", "SNP", " ", "frequency"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{ RowBox[{"lnLnullerr", "[", RowBox[{ "\[Theta]1_", ",", "\[Theta]2_", ",", "\[Epsilon]1_", ",", "\[Epsilon]2_", ",", "n_", ",", "i_", ",", "k_"}], "]"}], "=", RowBox[{ RowBox[{"-", RowBox[{"\[Mu]e", "[", RowBox[{ "\[Theta]1", ",", "\[Theta]2", ",", "\[Epsilon]1", ",", "\[Epsilon]2", ",", "n", ",", "i"}], "]"}]}], "+", RowBox[{"k", " ", RowBox[{"Log", "[", RowBox[{"\[Mu]e", "[", RowBox[{ "\[Theta]1", ",", "\[Theta]2", ",", "\[Epsilon]1", ",", "\[Epsilon]2", ",", "n", ",", "i"}], "]"}], "]"}]}], "-", RowBox[{"Log", "[", RowBox[{"k", "!"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"lnLBerr", "[", RowBox[{ "\[Theta]1_", ",", "\[Theta]2_", ",", "B_", ",", "\[Epsilon]1_", ",", "\[Epsilon]2_", ",", "n_", ",", "i_", ",", "k_"}], "]"}], "=", RowBox[{ RowBox[{"-", RowBox[{"\[Mu]Be", "[", RowBox[{ "\[Theta]1", ",", "\[Theta]2", ",", "B", ",", "\[Epsilon]1", ",", "\[Epsilon]2", ",", "n", ",", "i"}], "]"}]}], "+", RowBox[{"k", " ", RowBox[{"Log", "[", RowBox[{"\[Mu]Be", "[", RowBox[{ "\[Theta]1", ",", "\[Theta]2", ",", "B", ",", "\[Epsilon]1", ",", "\[Epsilon]2", ",", "n", ",", "i"}], "]"}], "]"}]}], "-", RowBox[{"Log", "[", RowBox[{"k", "!"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"lnLBfaerr", "[", RowBox[{ "\[Theta]1_", ",", "\[Theta]2_", ",", "B_", ",", "f_", ",", "\[Epsilon]1_", ",", "\[Epsilon]2_", ",", "n_", ",", "i_", ",", "k_"}], "]"}], "=", RowBox[{ RowBox[{"-", RowBox[{"\[Mu]fae", "[", RowBox[{ "\[Theta]1", ",", "\[Theta]2", ",", "B", ",", "f", ",", "\[Epsilon]1", ",", "\[Epsilon]2", ",", "n", ",", "i"}], "]"}]}], "+", RowBox[{"k", " ", RowBox[{"Log", "[", RowBox[{"\[Mu]fae", "[", RowBox[{ "\[Theta]1", ",", "\[Theta]2", ",", "B", ",", "f", ",", "\[Epsilon]1", ",", "\[Epsilon]2", ",", "n", ",", "i"}], "]"}], "]"}]}], "-", RowBox[{"Log", "[", RowBox[{"k", "!"}], "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"lnLBfberr", "[", RowBox[{ "\[Theta]1_", ",", "\[Theta]2_", ",", "B0_", ",", "B1_", ",", "f_", ",", "\[Epsilon]1_", ",", "\[Epsilon]2_", ",", "n_", ",", "i_", ",", "k_"}], "]"}], "=", RowBox[{ RowBox[{"-", RowBox[{"\[Mu]fbe", "[", RowBox[{ "\[Theta]1", ",", "\[Theta]2", ",", "B0", ",", "B1", ",", "f", ",", "\[Epsilon]1", ",", "\[Epsilon]2", ",", "n", ",", "i"}], "]"}]}], "+", RowBox[{"k", " ", RowBox[{"Log", "[", RowBox[{"\[Mu]fbe", "[", RowBox[{ "\[Theta]1", ",", "\[Theta]2", ",", "B0", ",", "B1", ",", "f", ",", "\[Epsilon]1", ",", "\[Epsilon]2", ",", "n", ",", "i"}], "]"}], "]"}]}], "-", RowBox[{"Log", "[", RowBox[{"k", "!"}], "]"}]}]}], ";"}]}]}]], "Input", CellChangeTimes->{{3.564237314090456*^9, 3.564237336217445*^9}, 3.5642373667501307`*^9, {3.564237622250279*^9, 3.564237661396779*^9}, { 3.56425268338205*^9, 3.564252701619594*^9}, {3.564252762842174*^9, 3.5642527660469007`*^9}, {3.5642528256028233`*^9, 3.564252828122671*^9}, { 3.5642529971206217`*^9, 3.5642530710990753`*^9}, {3.564253130334136*^9, 3.5642531456277103`*^9}, {3.564253197856127*^9, 3.564253223345599*^9}, { 3.564253771257348*^9, 3.564253844785268*^9}, {3.564255644524529*^9, 3.5642556457958193`*^9}, {3.5644650489034357`*^9, 3.564465075033431*^9}, { 3.56446781887748*^9, 3.564467847430722*^9}, {3.564939365609761*^9, 3.564939391373795*^9}, {3.5678340414859533`*^9, 3.567834088768161*^9}, { 3.567834133296948*^9, 3.567834169693039*^9}, {3.601640430913149*^9, 3.601640436212866*^9}, {3.6016405457681*^9, 3.6016405589599667`*^9}, { 3.636047529309462*^9, 3.636047540448946*^9}, {3.636047647266924*^9, 3.636047647875*^9}}], Cell[BoxData[ RowBox[{ RowBox[{"(*", RowBox[{"Full", " ", "likelihood", " ", "functions"}], "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"logLik0err3", "[", RowBox[{ "n_", ",", "gc_", ",", "\[Theta]_", ",", "\[Theta]WS_", ",", "\[Lambda]_", ",", "r__", ",", "\[Epsilon]_", ",", "\[Epsilon]WS_", ",", "\[Epsilon]SW_", ",", "kn__", ",", "kWS__", ",", "kSW__"}], "]"}], ":=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnullerr", "[", RowBox[{ RowBox[{"\[Theta]", " ", "r"}], ",", RowBox[{"\[Theta]", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "\[Epsilon]", ",", "\[Epsilon]", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kn"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnullerr", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", "r"}], ",", RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kWS"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnullerr", "[", RowBox[{ RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", "r"}], ",", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "\[Epsilon]SW", ",", "\[Epsilon]WS", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kSW"}], "]"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"logLik1err3", "[", RowBox[{ "n_", ",", "gc_", ",", "\[Theta]_", ",", "\[Theta]WS_", ",", "\[Lambda]_", ",", "B_", ",", "r__", ",", "\[Epsilon]_", ",", "\[Epsilon]WS_", ",", "\[Epsilon]SW_", ",", "kn__", ",", "kWS__", ",", "kSW__"}], "]"}], ":=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnullerr", "[", RowBox[{ RowBox[{"\[Theta]", " ", "r"}], ",", RowBox[{"\[Theta]", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "\[Epsilon]", ",", "\[Epsilon]", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kn"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLBerr", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", "r"}], ",", RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "B", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kWS"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLBerr", "[", RowBox[{ RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", "r"}], ",", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], " ", "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", RowBox[{"-", "B"}], ",", "\[Epsilon]SW", ",", "\[Epsilon]WS", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kSW"}], "]"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"logLik2aerr3", "[", RowBox[{ "n_", ",", "gc_", ",", "\[Theta]_", ",", "\[Theta]WS_", ",", "\[Lambda]_", ",", "B_", ",", "f_", ",", "r__", ",", "\[Epsilon]_", ",", "\[Epsilon]WS_", ",", "\[Epsilon]SW_", ",", "kn__", ",", "kWS__", ",", "kSW__"}], "]"}], ":=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnullerr", "[", RowBox[{ RowBox[{"\[Theta]", " ", "r"}], ",", RowBox[{"\[Theta]", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "\[Epsilon]", ",", "\[Epsilon]", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kn"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLBfaerr", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", "r"}], ",", RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "B", ",", "f", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kWS"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLBfaerr", "[", RowBox[{ RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", "r"}], ",", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", RowBox[{"-", "B"}], ",", "f", ",", "\[Epsilon]SW", ",", "\[Epsilon]WS", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kSW"}], "]"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"logLik2berr3", "[", RowBox[{ "n_", ",", "gc_", ",", "\[Theta]_", ",", "\[Theta]WS_", ",", "\[Lambda]_", ",", "B0_", ",", "B1_", ",", "f_", ",", "r__", ",", "\[Epsilon]_", ",", "\[Epsilon]WS_", ",", "\[Epsilon]SW_", ",", "kn__", ",", "kWS__", ",", "kSW__"}], "]"}], ":=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnullerr", "[", RowBox[{ RowBox[{"\[Theta]", " ", "r"}], ",", RowBox[{"\[Theta]", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "\[Epsilon]", ",", "\[Epsilon]", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kn"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLBfberr", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", "r"}], ",", RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "B0", ",", "B1", ",", "f", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kWS"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLBfberr", "[", RowBox[{ RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", "r"}], ",", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", RowBox[{"-", "B0"}], ",", RowBox[{"-", "B1"}], ",", "f", ",", "\[Epsilon]SW", ",", "\[Epsilon]WS", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kSW"}], "]"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"logLik3pluserr3", "[", RowBox[{ "n_", ",", "gc_", ",", "\[Theta]_", ",", "\[Theta]WS_", ",", "\[Lambda]_", ",", "Bmoy_", ",", "\[Beta]_", ",", "r__", ",", "\[Epsilon]_", ",", "\[Epsilon]WS_", ",", "\[Epsilon]SW_", ",", "kn__", ",", "kWS__", ",", "kSW__"}], "]"}], ":=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnullerr", "[", RowBox[{ RowBox[{"\[Theta]", " ", "r"}], ",", RowBox[{"\[Theta]", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "\[Epsilon]", ",", "\[Epsilon]", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kn"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLB\[CapitalGamma]pluserr", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", "r"}], ",", RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "Bmoy", ",", "\[Beta]", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kWS"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLB\[CapitalGamma]moinserr", "[", RowBox[{ RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", "r"}], ",", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "Bmoy", ",", "\[Beta]", ",", "\[Epsilon]SW", ",", "\[Epsilon]WS", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kSW"}], "]"}], "]"}]}], "]"}]}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"logLik3moinserr3", "[", RowBox[{ "n_", ",", "gc_", ",", "\[Theta]_", ",", "\[Theta]WS_", ",", "\[Lambda]_", ",", "Bmoy_", ",", "\[Beta]_", ",", "r__", ",", "\[Epsilon]_", ",", "\[Epsilon]WS_", ",", "\[Epsilon]SW_", ",", "kn__", ",", "kWS__", ",", "kSW__"}], "]"}], ":=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLnullerr", "[", RowBox[{ RowBox[{"\[Theta]", " ", "r"}], ",", RowBox[{"\[Theta]", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "\[Epsilon]", ",", "\[Epsilon]", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kn"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLB\[CapitalGamma]moinserr", "[", RowBox[{ RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", "r"}], ",", RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "Bmoy", ",", "\[Beta]", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kWS"}], "]"}], "]"}]}], "]"}], "+", RowBox[{"Apply", "[", RowBox[{"Plus", ",", RowBox[{"Thread", "[", RowBox[{"lnLB\[CapitalGamma]pluserr", "[", RowBox[{ RowBox[{"\[Lambda]", " ", "gc", " ", "\[Theta]WS", " ", "r"}], ",", RowBox[{ RowBox[{"(", RowBox[{"1", "-", "gc"}], ")"}], "\[Theta]WS", " ", RowBox[{"Reverse", "[", "r", "]"}]}], ",", "Bmoy", ",", "\[Beta]", ",", "\[Epsilon]SW", ",", "\[Epsilon]WS", ",", "n", ",", RowBox[{"Range", "[", RowBox[{"n", "-", "1"}], "]"}], ",", "kSW"}], "]"}], "]"}]}], "]"}]}]}]}]}]], "Input", CellChangeTimes->{{3.5642530972076693`*^9, 3.56425311052999*^9}, { 3.564254457800436*^9, 3.5642545496593018`*^9}, {3.56425459156068*^9, 3.56425459399196*^9}, {3.564254634237797*^9, 3.5642546887869997`*^9}, { 3.564257531081271*^9, 3.564257589115464*^9}, {3.564257943994001*^9, 3.564257944786811*^9}, {3.564465084548792*^9, 3.564465150196624*^9}, 3.5644678667669373`*^9, 3.564477811385539*^9, {3.564939407978381*^9, 3.564939495027536*^9}, {3.565004756753952*^9, 3.565004757549827*^9}, { 3.567834181390832*^9, 3.567834367994503*^9}, {3.59350721307375*^9, 3.593507259568873*^9}, {3.593507354294498*^9, 3.5935073670388727`*^9}, { 3.593507400023406*^9, 3.5935074474350157`*^9}, {3.593533112060301*^9, 3.5935331147870493`*^9}, {3.601640380140945*^9, 3.601640406670535*^9}, { 3.6016405762992153`*^9, 3.6016406249562407`*^9}, {3.6016410993769693`*^9, 3.601641105225066*^9}, 3.601641237790537*^9, {3.636047571439555*^9, 3.6360475743427887`*^9}, {3.636047653212718*^9, 3.636047656606146*^9}}] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell["\<\ Optimization of the likelihood functions\ \>", "Section", CellChangeTimes->{{3.564231098812359*^9, 3.5642311002964582`*^9}, { 3.564464863801774*^9, 3.564464871743882*^9}, {3.6360477212774677`*^9, 3.636047726140313*^9}, 3.636048229228591*^9}], Cell[CellGroupData[{ Cell["Example dataset", "Subsection", CellChangeTimes->{{3.5642568869165573`*^9, 3.564256894138021*^9}, { 3.636047847879271*^9, 3.636047850941786*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"tabN", "=", RowBox[{"{", RowBox[{ "721", ",", "380", ",", "298", ",", "218", ",", "164", ",", "118", ",", "122", ",", "79", ",", "103", ",", "80", ",", "63", ",", "65", ",", "57", ",", "47", ",", "59", ",", "45", ",", "44", ",", "35", ",", "44", ",", "19", ",", "36", ",", "32", ",", "47", ",", "21", ",", "28", ",", "36", ",", "24", ",", "23", ",", "22", ",", "28", ",", "18", ",", "27", ",", "21", ",", "23", ",", "15", ",", "24", ",", "19", ",", "19", ",", "15", ",", "18", ",", "9", ",", "16", ",", "17", ",", "21", ",", "21", ",", "17", ",", "16", ",", "8", ",", "16", ",", "17", ",", "11", ",", "15", ",", "15", ",", "19", ",", "11", ",", "11", ",", "14", ",", "8", ",", "19", ",", "9", ",", "17", ",", "12", ",", "16", ",", "10", ",", "8", ",", "14", ",", "7", ",", "20", ",", "12", ",", "4", ",", "9", ",", "11", ",", "11", ",", "10", ",", "7", ",", "12", ",", "10", ",", "10", ",", "12", ",", "15", ",", "6", ",", "13", ",", "16", ",", "14", ",", "17", ",", "13", ",", "13", ",", "16", ",", "16", ",", "15", ",", "17", ",", "25", ",", "17", ",", "18", ",", "34", ",", "30", ",", "30", ",", "45", ",", "43"}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"tabWS", "=", RowBox[{"{", RowBox[{ "1268", ",", "758", ",", "572", ",", "403", ",", "354", ",", "250", ",", "242", ",", "206", ",", "168", ",", "144", ",", "131", ",", "127", ",", "107", ",", "113", ",", "94", ",", "88", ",", "98", ",", "77", ",", "37", ",", "57", ",", "60", ",", "52", ",", "58", ",", "57", ",", "40", ",", "65", ",", "54", ",", "35", ",", "31", ",", "40", ",", "23", ",", "48", ",", "25", ",", "34", ",", "36", ",", "42", ",", "27", ",", "28", ",", "35", ",", "24", ",", "19", ",", "17", ",", "20", ",", "17", ",", "17", ",", "18", ",", "8", ",", "15", ",", "17", ",", "10", ",", "14", ",", "13", ",", "23", ",", "16", ",", "15", ",", "9", ",", "22", ",", "16", ",", "14", ",", "13", ",", "14", ",", "6", ",", "14", ",", "9", ",", "14", ",", "10", ",", "16", ",", "16", ",", "18", ",", "13", ",", "13", ",", "20", ",", "12", ",", "13", ",", "14", ",", "12", ",", "21", ",", "15", ",", "17", ",", "15", ",", "8", ",", "11", ",", "11", ",", "10", ",", "16", ",", "11", ",", "14", ",", "13", ",", "11", ",", "19", ",", "12", ",", "10", ",", "19", ",", "8", ",", "17", ",", "22", ",", "18", ",", "20", ",", "24"}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"tabSW", "=", RowBox[{"{", RowBox[{ "4099", ",", "2248", ",", "1532", ",", "1143", ",", "903", ",", "595", ",", "611", ",", "511", ",", "476", ",", "415", ",", "378", ",", "312", ",", "252", ",", "220", ",", "235", ",", "198", ",", "181", ",", "190", ",", "127", ",", "143", ",", "158", ",", "163", ",", "128", ",", "131", ",", "119", ",", "115", ",", "99", ",", "73", ",", "71", ",", "104", ",", "75", ",", "78", ",", "87", ",", "75", ",", "72", ",", "62", ",", "53", ",", "67", ",", "64", ",", "50", ",", "45", ",", "54", ",", "59", ",", "44", ",", "51", ",", "50", ",", "41", ",", "36", ",", "46", ",", "40", ",", "42", ",", "46", ",", "38", ",", "35", ",", "31", ",", "31", ",", "36", ",", "43", ",", "31", ",", "29", ",", "25", ",", "38", ",", "35", ",", "23", ",", "37", ",", "24", ",", "29", ",", "28", ",", "21", ",", "25", ",", "29", ",", "27", ",", "26", ",", "32", ",", "25", ",", "26", ",", "25", ",", "18", ",", "27", ",", "31", ",", "18", ",", "23", ",", "18", ",", "21", ",", "29", ",", "29", ",", "21", ",", "23", ",", "37", ",", "26", ",", "24", ",", "29", ",", "33", ",", "20", ",", "35", ",", "27", ",", "32", ",", "38", ",", "29"}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"pGC", "=", "0.6"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Nchrom", "=", RowBox[{ RowBox[{"Length", "[", "tabN", "]"}], "+", "1"}]}], ";"}]}], "Input", CellChangeTimes->{{3.636047920458006*^9, 3.6360480372204237`*^9}, { 3.6360480706142473`*^9, 3.636048120495612*^9}}] }, Closed]], Cell[CellGroupData[{ Cell["General initial conditions", "Subsection", CellChangeTimes->{{3.564231560467885*^9, 3.56423156404556*^9}, { 3.5642317951558437`*^9, 3.564231797427649*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{"tabcoef", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", "1", "}"}], ",", RowBox[{"Array", "[", RowBox[{ RowBox[{ RowBox[{"Subscript", "[", RowBox[{"r", ",", "#1"}], "]"}], "&"}], ",", RowBox[{"Nchrom", "-", "2"}], ",", "2"}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"tabcoefe", "=", RowBox[{"Flatten", "[", RowBox[{"{", RowBox[{ RowBox[{"{", "1", "}"}], ",", RowBox[{"Array", "[", RowBox[{ RowBox[{ RowBox[{"Subscript", "[", RowBox[{"r", ",", "#1"}], "]"}], "&"}], ",", RowBox[{"Nchrom", "-", "3"}], ",", "2"}], "]"}], ",", RowBox[{"{", "1", "}"}]}], "}"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"\[Theta]init", "=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", "tabN"}], "]"}], "/", RowBox[{"HarmonicNumber", "[", "Nchrom", "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"\[Theta]WSinit", "=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", "tabWS"}], "]"}], "/", RowBox[{"HarmonicNumber", "[", "Nchrom", "]"}]}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"\[Lambda]init", "=", FractionBox[ RowBox[{"pGC", " ", RowBox[{"tabSW", "[", RowBox[{"[", "1", "]"}], "]"}]}], RowBox[{ RowBox[{"(", RowBox[{"1", "-", "pGC"}], ")"}], RowBox[{"tabWS", "[", RowBox[{"[", "1", "]"}], "]"}]}]]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"rinit", "=", RowBox[{ RowBox[{"tabN", " ", RowBox[{ RowBox[{"Range", "[", RowBox[{"Nchrom", "-", "1"}], "]"}], "/", RowBox[{"tabN", "[", RowBox[{"[", "1", "]"}], "]"}]}]}], "+", "0.1"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"(*", RowBox[{ RowBox[{"rinit", "=", RowBox[{"Table", "[", RowBox[{"1", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}]}], ";"}], "*)"}]}]}], "Input", CellChangeTimes->{{3.5642304395653563`*^9, 3.564230566937914*^9}, { 3.5642306210531816`*^9, 3.5642306690535393`*^9}, {3.5642307186900797`*^9, 3.564230719723556*^9}, {3.5642307500347*^9, 3.564230867472843*^9}, { 3.564231715207657*^9, 3.564231793202677*^9}, {3.5650053897748823`*^9, 3.5650054291564083`*^9}, {3.5650055915180693`*^9, 3.56500561007064*^9}, { 3.5650183843275127`*^9, 3.5650183881924334`*^9}, {3.567165882458559*^9, 3.567165896911628*^9}, {3.56716603263902*^9, 3.567166035409156*^9}, { 3.567166164573626*^9, 3.567166171513049*^9}, 3.5671662461627207`*^9, { 3.567166292152424*^9, 3.567166309926059*^9}, 3.567166475680993*^9, { 3.5671665897150593`*^9, 3.567166596239398*^9}, {3.5671853148370647`*^9, 3.567185319857675*^9}, {3.593627022179501*^9, 3.593627035993046*^9}, { 3.636048124937337*^9, 3.636048133174323*^9}, {3.6360496967659397`*^9, 3.636049696828706*^9}}] }, Closed]], Cell[CellGroupData[{ Cell["ML Estimates", "Subsection", CellChangeTimes->{{3.564231579156546*^9, 3.56423159473543*^9}, 3.593837615921116*^9}], Cell["Saturated model:", "Text", CellChangeTimes->{{3.564233658109749*^9, 3.5642336674106503`*^9}, 3.59383761592309*^9}], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{ RowBox[{"logLikMax", "[", RowBox[{"tabN", ",", "tabWS", ",", "tabSW"}], "]"}], "//", "N"}]], "Input", CellChangeTimes->{{3.564477890113482*^9, 3.564477909283383*^9}, { 3.565040344130828*^9, 3.56504035492936*^9}, {3.5650816915513763`*^9, 3.565081694856119*^9}, {3.565081878898121*^9, 3.565081882023203*^9}, { 3.565086032317608*^9, 3.565086039112772*^9}, 3.593837615923627*^9, { 3.636048234317527*^9, 3.636048235069351*^9}}], Cell[BoxData[ RowBox[{"-", "801.5016273941001`"}]], "Output", CellChangeTimes->{{3.593837632572783*^9, 3.593837634444993*^9}, 3.5938408651920958`*^9, 3.606409627101625*^9, 3.606410285309842*^9, 3.606410406356785*^9, 3.6065641057437468`*^9, {3.6279022622833138`*^9, 3.6279022785751743`*^9}, 3.630174235624724*^9, 3.63017427218645*^9, 3.636048235833269*^9}] }, Open ]], Cell["M0", "Text", CellChangeTimes->{{3.564231998899579*^9, 3.5642319991987886`*^9}, 3.593837615927609*^9}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"init0", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", "\[Theta]init"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", "\[Theta]WSinit"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", "\[Lambda]init"}], "}"}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"cons0", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"M0", "=", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik0", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "tabcoef", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "cons0"}], "}"}], ",", "init0", ",", RowBox[{"AccuracyGoal", "\[Rule]", "6"}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.564232469186648*^9, 3.564232504601274*^9}, { 3.564232651890757*^9, 3.564232705919312*^9}, {3.5642383301577883`*^9, 3.564238330725251*^9}, {3.564601538913146*^9, 3.56460156019914*^9}, { 3.56460258758848*^9, 3.5646025878041487`*^9}, {3.56460320179915*^9, 3.564603227939867*^9}, {3.565040333313615*^9, 3.5650403418806477`*^9}, { 3.565041050379075*^9, 3.565041055786252*^9}, {3.565081699666359*^9, 3.565081703907675*^9}, {3.565081896013822*^9, 3.565081899117942*^9}, 3.56716590787289*^9, 3.567165989906786*^9, 3.567166061569615*^9, 3.5671661042287703`*^9, {3.567166386117901*^9, 3.5671664049880466`*^9}, { 3.567166539306595*^9, 3.567166565481502*^9}, {3.567166681910309*^9, 3.5671667040045433`*^9}, {3.567166751637766*^9, 3.56716681464578*^9}, { 3.567166847242338*^9, 3.567166857410989*^9}, {3.567167391103218*^9, 3.567167413873209*^9}, {3.5671674492241917`*^9, 3.567167454744521*^9}, { 3.5671675092285852`*^9, 3.5671675159537373`*^9}, {3.567167677967989*^9, 3.567167690903077*^9}, {3.567185327213584*^9, 3.56718533284521*^9}, { 3.5672763374559927`*^9, 3.56727634106347*^9}, {3.5674025989937067`*^9, 3.567402607913027*^9}, {3.5674047715664387`*^9, 3.5674047741741056`*^9}, { 3.56871704131802*^9, 3.5687170571901093`*^9}, {3.568718054777659*^9, 3.568718058059078*^9}, {3.568719197547818*^9, 3.568719201530346*^9}, { 3.568720244638262*^9, 3.5687202990643263`*^9}, 3.5938376159287157`*^9, 3.636049696898858*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"-", "971.468976378459`"}], ",", RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", "\[Rule]", "1426.2245052591588`"}], ",", RowBox[{"\[Theta]WS", "\[Rule]", "3565.561262435421`"}], ",", RowBox[{"\[Lambda]", "\[Rule]", "1.768095170127735`"}], ",", RowBox[{ SubscriptBox["r", "2"], "\[Rule]", "1.1345892993781905`"}], ",", RowBox[{ SubscriptBox["r", "3"], "\[Rule]", "1.209947249655705`"}], ",", RowBox[{ SubscriptBox["r", "4"], "\[Rule]", "1.1749811607269443`"}], ",", RowBox[{ SubscriptBox["r", "5"], "\[Rule]", "1.2140165789706991`"}], ",", RowBox[{ SubscriptBox["r", "6"], "\[Rule]", "0.9902034666465057`"}], ",", RowBox[{ SubscriptBox["r", "7"], "\[Rule]", "1.155237377754251`"}], ",", RowBox[{ SubscriptBox["r", "8"], "\[Rule]", "1.1128862096982945`"}], ",", RowBox[{ SubscriptBox["r", "9"], "\[Rule]", "1.1014318012561166`"}], ",", RowBox[{ SubscriptBox["r", "10"], "\[Rule]", "1.0595327809018251`"}], ",", RowBox[{ SubscriptBox["r", "11"], "\[Rule]", "1.0610399399073798`"}], ",", RowBox[{ SubscriptBox["r", "12"], "\[Rule]", "1.0236623965697424`"}], ",", RowBox[{ SubscriptBox["r", "13"], "\[Rule]", "0.9130369255623685`"}], ",", RowBox[{ SubscriptBox["r", "14"], "\[Rule]", "0.9410700830656286`"}], ",", RowBox[{ SubscriptBox["r", "15"], "\[Rule]", "0.9562923890216617`"}], ",", RowBox[{ SubscriptBox["r", "16"], "\[Rule]", "0.9018839489213156`"}], ",", RowBox[{ SubscriptBox["r", "17"], "\[Rule]", "0.9659382066572274`"}], ",", RowBox[{ SubscriptBox["r", "18"], "\[Rule]", "0.9332328562367588`"}], ",", RowBox[{ SubscriptBox["r", "19"], "\[Rule]", "0.5755840242196991`"}], ",", RowBox[{ SubscriptBox["r", "20"], "\[Rule]", "0.7746797288528894`"}], ",", RowBox[{ SubscriptBox["r", "21"], "\[Rule]", "0.8798794274402932`"}], ",", RowBox[{ SubscriptBox["r", "22"], "\[Rule]", "0.8853051998602741`"}], ",", RowBox[{ SubscriptBox["r", "23"], "\[Rule]", "0.8458176339148834`"}], ",", RowBox[{ SubscriptBox["r", "24"], "\[Rule]", "0.8862094952636281`"}], ",", RowBox[{ SubscriptBox["r", "25"], "\[Rule]", "0.7498116052613285`"}], ",", RowBox[{ SubscriptBox["r", "26"], "\[Rule]", "0.9600602865356297`"}], ",", RowBox[{ SubscriptBox["r", "27"], "\[Rule]", "0.8423511682021586`"}], ",", RowBox[{ SubscriptBox["r", "28"], "\[Rule]", "0.6034664658224456`"}], ",", RowBox[{ SubscriptBox["r", "29"], "\[Rule]", "0.5813112284408554`"}], ",", RowBox[{ SubscriptBox["r", "30"], "\[Rule]", "0.8319517710638391`"}], ",", RowBox[{ SubscriptBox["r", "31"], "\[Rule]", "0.5653353429820154`"}], ",", RowBox[{ SubscriptBox["r", "32"], "\[Rule]", "0.8391861342905432`"}], ",", RowBox[{ SubscriptBox["r", "33"], "\[Rule]", "0.681386586409384`"}], ",", RowBox[{ SubscriptBox["r", "34"], "\[Rule]", "0.7327807084986734`"}], ",", RowBox[{ SubscriptBox["r", "35"], "\[Rule]", "0.7596081387974816`"}], ",", RowBox[{ SubscriptBox["r", "36"], "\[Rule]", "0.7921627733174094`"}], ",", RowBox[{ SubscriptBox["r", "37"], "\[Rule]", "0.5966842502975205`"}], ",", RowBox[{ SubscriptBox["r", "38"], "\[Rule]", "0.7044461191943427`"}], ",", RowBox[{ SubscriptBox["r", "39"], "\[Rule]", "0.7876412963007451`"}], ",", RowBox[{ SubscriptBox["r", "40"], "\[Rule]", "0.5908063301758848`"}], ",", RowBox[{ SubscriptBox["r", "41"], "\[Rule]", "0.5128862095889385`"}], ",", RowBox[{ SubscriptBox["r", "42"], "\[Rule]", "0.5570459684515461`"}], ",", RowBox[{ SubscriptBox["r", "43"], "\[Rule]", "0.6415975886629149`"}], ",", RowBox[{ SubscriptBox["r", "44"], "\[Rule]", "0.5172569707050437`"}], ",", RowBox[{ SubscriptBox["r", "45"], "\[Rule]", "0.5764883196231599`"}], ",", RowBox[{ SubscriptBox["r", "46"], "\[Rule]", "0.5962321025958743`"}], ",", RowBox[{ SubscriptBox["r", "47"], "\[Rule]", "0.4037678975871108`"}], ",", RowBox[{ SubscriptBox["r", "48"], "\[Rule]", "0.4774679729585489`"}], ",", RowBox[{ SubscriptBox["r", "49"], "\[Rule]", "0.5908063301759116`"}], ",", RowBox[{ SubscriptBox["r", "50"], "\[Rule]", "0.4521477016652952`"}], ",", RowBox[{ SubscriptBox["r", "51"], "\[Rule]", "0.5380557649816654`"}], ",", RowBox[{ SubscriptBox["r", "52"], "\[Rule]", "0.5642803316782343`"}], ",", RowBox[{ SubscriptBox["r", "53"], "\[Rule]", "0.670987189271245`"}], ",", RowBox[{ SubscriptBox["r", "54"], "\[Rule]", "0.5452901282083423`"}], ",", RowBox[{ SubscriptBox["r", "55"], "\[Rule]", "0.5056518463623854`"}], ",", RowBox[{ SubscriptBox["r", "56"], "\[Rule]", "0.41356443112325997`"}], ",", RowBox[{ SubscriptBox["r", "57"], "\[Rule]", "0.6872645065312093`"}], ",", RowBox[{ SubscriptBox["r", "58"], "\[Rule]", "0.6556141674146143`"}], ",", RowBox[{ SubscriptBox["r", "59"], "\[Rule]", "0.5246420498323339`"}], ",", RowBox[{ SubscriptBox["r", "60"], "\[Rule]", "0.4973624718318836`"}], ",", RowBox[{ SubscriptBox["r", "61"], "\[Rule]", "0.4872645064947209`"}], ",", RowBox[{ SubscriptBox["r", "62"], "\[Rule]", "0.4672192917208263`"}], ",", RowBox[{ SubscriptBox["r", "63"], "\[Rule]", "0.5981914093031903`"}], ",", RowBox[{ SubscriptBox["r", "64"], "\[Rule]", "0.3954785230567244`"}], ",", RowBox[{ SubscriptBox["r", "65"], "\[Rule]", "0.6367746798452788`"}], ",", RowBox[{ SubscriptBox["r", "66"], "\[Rule]", "0.4376789752121372`"}], ",", RowBox[{ SubscriptBox["r", "67"], "\[Rule]", "0.6159758855687316`"}], ",", RowBox[{ SubscriptBox["r", "68"], "\[Rule]", "0.6149208742648558`"}], ",", RowBox[{ SubscriptBox["r", "69"], "\[Rule]", "0.5927656368833187`"}], ",", RowBox[{ SubscriptBox["r", "70"], "\[Rule]", "0.5380557649818051`"}], ",", RowBox[{ SubscriptBox["r", "71"], "\[Rule]", "0.5885455916677251`"}], ",", RowBox[{ SubscriptBox["r", "72"], "\[Rule]", "0.7270535042778401`"}], ",", RowBox[{ SubscriptBox["r", "73"], "\[Rule]", "0.5501130370262141`"}], ",", RowBox[{ SubscriptBox["r", "74"], "\[Rule]", "0.6468726451825212`"}], ",", RowBox[{ SubscriptBox["r", "75"], "\[Rule]", "0.5990957047066182`"}], ",", RowBox[{ SubscriptBox["r", "76"], "\[Rule]", "0.5727204221094824`"}], ",", RowBox[{ SubscriptBox["r", "77"], "\[Rule]", "0.7775433309638172`"}], ",", RowBox[{ SubscriptBox["r", "78"], "\[Rule]", "0.5642803316784696`"}], ",", RowBox[{ SubscriptBox["r", "79"], "\[Rule]", "0.7262999247750831`"}], ",", RowBox[{ SubscriptBox["r", "80"], "\[Rule]", "0.7354935947089141`"}], ",", RowBox[{ SubscriptBox["r", "81"], "\[Rule]", "0.4150715901289943`"}], ",", RowBox[{ SubscriptBox["r", "82"], "\[Rule]", "0.5561416730484724`"}], ",", RowBox[{ SubscriptBox["r", "83"], "\[Rule]", "0.5003767898431483`"}], ",", RowBox[{ SubscriptBox["r", "84"], "\[Rule]", "0.5190655615119566`"}], ",", RowBox[{ SubscriptBox["r", "85"], "\[Rule]", "0.7814619443782349`"}], ",", RowBox[{ SubscriptBox["r", "86"], "\[Rule]", "0.6610399398347594`"}], ",", RowBox[{ SubscriptBox["r", "87"], "\[Rule]", "0.64250188406655`"}], ",", RowBox[{ SubscriptBox["r", "88"], "\[Rule]", "0.6498869631937338`"}], ",", RowBox[{ SubscriptBox["r", "89"], "\[Rule]", "0.7914091938148318`"}], ",", RowBox[{ SubscriptBox["r", "90"], "\[Rule]", "0.8681235871974357`"}], ",", RowBox[{ SubscriptBox["r", "91"], "\[Rule]", "0.6583270536248207`"}], ",", RowBox[{ SubscriptBox["r", "92"], "\[Rule]", "0.6794272797025002`"}], ",", RowBox[{ SubscriptBox["r", "93"], "\[Rule]", "0.995177091365293`"}], ",", RowBox[{ SubscriptBox["r", "94"], "\[Rule]", "0.5100226074787186`"}], ",", RowBox[{ SubscriptBox["r", "95"], "\[Rule]", "0.9879427281386386`"}], ",", RowBox[{ SubscriptBox["r", "96"], "\[Rule]", "1.027279578183589`"}], ",", RowBox[{ SubscriptBox["r", "97"], "\[Rule]", "0.9941220800614262`"}], ",", RowBox[{ SubscriptBox["r", "98"], "\[Rule]", "1.152072343843075`"}], ",", RowBox[{ SubscriptBox["r", "99"], "\[Rule]", "1.1489073099315126`"}]}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.5938376484321623`*^9, 3.593840867215947*^9, 3.6064096304714127`*^9, 3.606410353135206*^9, 3.606410408965725*^9, 3.6065641078397627`*^9, 3.62790228090338*^9, 3.6301742384163437`*^9, 3.630174274507462*^9, 3.636048240841539*^9}] }, Open ]], Cell["M1", "Text", CellChangeTimes->{{3.564232003416295*^9, 3.564232003664201*^9}, 3.5938376159349413`*^9}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"init1", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"B", ",", "1"}], "}"}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"cons1", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"M1", "=", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik1", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "B", ",", "tabcoef", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "cons1"}], "}"}], ",", "init1", ",", RowBox[{"AccuracyGoal", "\[Rule]", "6"}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.4849918812651997`*^9, 3.4849919131714497`*^9}, { 3.4849919690620747`*^9, 3.484992003148012*^9}, 3.484992082688813*^9, { 3.484992141204438*^9, 3.484992231870532*^9}, {3.484992265909301*^9, 3.484992343315551*^9}, {3.4849924113150015`*^9, 3.4849924815047894`*^9}, { 3.489138966926263*^9, 3.489138969941888*^9}, {3.4954718462585*^9, 3.4954718693835*^9}, {3.495471912680375*^9, 3.495471913196*^9}, { 3.495471979196*^9, 3.49547200297725*^9}, {3.495472044617875*^9, 3.49547208235225*^9}, {3.496504439538522*^9, 3.496504440085397*^9}, { 3.49926354336675*^9, 3.4992635633355*^9}, {3.499338237553625*^9, 3.499338263178625*^9}, {3.564226049081957*^9, 3.564226105960425*^9}, { 3.564229115421522*^9, 3.564229190300817*^9}, {3.5642303854180613`*^9, 3.564230396396782*^9}, {3.564230879500187*^9, 3.5642309560727453`*^9}, { 3.5642315198642282`*^9, 3.564231528465914*^9}, {3.564231629325408*^9, 3.5642316480873003`*^9}, {3.564231686212853*^9, 3.564231695069336*^9}, { 3.5642318008190317`*^9, 3.564231879410396*^9}, {3.5642319719944572`*^9, 3.5642319918483057`*^9}, {3.564232710118916*^9, 3.564232724696784*^9}, { 3.564238326760501*^9, 3.564238327311071*^9}, {3.564601563856604*^9, 3.564601571055615*^9}, {3.5650404516759357`*^9, 3.5650404566815557`*^9}, { 3.56504106147506*^9, 3.565041066370307*^9}, {3.5671673292190523`*^9, 3.567167356285079*^9}, {3.567167388106946*^9, 3.567167402624468*^9}, { 3.567167888232828*^9, 3.567167911779674*^9}, {3.5671853673896503`*^9, 3.56718537269184*^9}, {3.567276358695696*^9, 3.5672763624599257`*^9}, { 3.567402613448998*^9, 3.567402637153288*^9}, {3.567404779903269*^9, 3.567404782612885*^9}, 3.567839227821903*^9, {3.568717062028139*^9, 3.56871706412099*^9}, {3.568718067254978*^9, 3.568718070798678*^9}, { 3.56871920581846*^9, 3.568719208259226*^9}, {3.568720280637864*^9, 3.56872030546612*^9}, 3.593837615935915*^9, 3.636049696978725*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"-", "924.6735766150705`"}], ",", RowBox[{"{", RowBox[{ RowBox[{"B", "\[Rule]", "0.6010150890360325`"}], ",", RowBox[{"\[Theta]", "\[Rule]", "1402.6598174081807`"}], ",", RowBox[{"\[Theta]WS", "\[Rule]", "3353.3229999929754`"}], ",", RowBox[{"\[Lambda]", "\[Rule]", "1.9384926259532895`"}], ",", RowBox[{ SubscriptBox["r", "2"], "\[Rule]", "1.1361572220100309`"}], ",", RowBox[{ SubscriptBox["r", "3"], "\[Rule]", "1.213283619948389`"}], ",", RowBox[{ SubscriptBox["r", "4"], "\[Rule]", "1.1798297483640217`"}], ",", RowBox[{ SubscriptBox["r", "5"], "\[Rule]", "1.2206804466752637`"}], ",", RowBox[{ SubscriptBox["r", "6"], "\[Rule]", "0.9969815706201222`"}], ",", RowBox[{ SubscriptBox["r", "7"], "\[Rule]", "1.1647041430007048`"}], ",", RowBox[{ SubscriptBox["r", "8"], "\[Rule]", "1.1235003924806621`"}], ",", RowBox[{ SubscriptBox["r", "9"], "\[Rule]", "1.1134085034948047`"}], ",", RowBox[{ SubscriptBox["r", "10"], "\[Rule]", "1.0724625770078646`"}], ",", RowBox[{ SubscriptBox["r", "11"], "\[Rule]", "1.075391688059462`"}], ",", RowBox[{ SubscriptBox["r", "12"], "\[Rule]", "1.0388557613560354`"}], ",", RowBox[{ SubscriptBox["r", "13"], "\[Rule]", "0.9277837562455366`"}], ",", RowBox[{ SubscriptBox["r", "14"], "\[Rule]", "0.9574953367220935`"}], ",", RowBox[{ SubscriptBox["r", "15"], "\[Rule]", "0.9742222205180149`"}], ",", RowBox[{ SubscriptBox["r", "16"], "\[Rule]", "0.9199558195776216`"}], ",", RowBox[{ SubscriptBox["r", "17"], "\[Rule]", "0.9865315668441746`"}], ",", RowBox[{ SubscriptBox["r", "18"], "\[Rule]", "0.9543184806048697`"}], ",", RowBox[{ SubscriptBox["r", "19"], "\[Rule]", "0.5893184750096189`"}], ",", RowBox[{ SubscriptBox["r", "20"], "\[Rule]", "0.7941414505263216`"}], ",", RowBox[{ SubscriptBox["r", "21"], "\[Rule]", "0.9030868470598468`"}], ",", RowBox[{ SubscriptBox["r", "22"], "\[Rule]", "0.9097590376442521`"}], ",", RowBox[{ SubscriptBox["r", "23"], "\[Rule]", "0.8702287652174201`"}], ",", RowBox[{ SubscriptBox["r", "24"], "\[Rule]", "0.9128780335601893`"}], ",", RowBox[{ SubscriptBox["r", "25"], "\[Rule]", "0.7732937380213403`"}], ",", RowBox[{ SubscriptBox["r", "26"], "\[Rule]", "0.9912954980004621`"}], ",", RowBox[{ SubscriptBox["r", "27"], "\[Rule]", "0.8707759317194733`"}], ",", RowBox[{ SubscriptBox["r", "28"], "\[Rule]", "0.6245558639106285`"}], ",", RowBox[{ SubscriptBox["r", "29"], "\[Rule]", "0.6023211043233683`"}], ",", RowBox[{ SubscriptBox["r", "30"], "\[Rule]", "0.8630084371040169`"}], ",", RowBox[{ SubscriptBox["r", "31"], "\[Rule]", "0.587106446811483`"}], ",", RowBox[{ SubscriptBox["r", "32"], "\[Rule]", "0.8724873291795641`"}], ",", RowBox[{ SubscriptBox["r", "33"], "\[Rule]", "0.7092197452862277`"}], ",", RowBox[{ SubscriptBox["r", "34"], "\[Rule]", "0.7635613972190244`"}], ",", RowBox[{ SubscriptBox["r", "35"], "\[Rule]", "0.7923891678842356`"}], ",", RowBox[{ SubscriptBox["r", "36"], "\[Rule]", "0.8272535066548123`"}], ",", RowBox[{ SubscriptBox["r", "37"], "\[Rule]", "0.6237927285521451`"}], ",", RowBox[{ SubscriptBox["r", "38"], "\[Rule]", "0.7372441520741377`"}], ",", RowBox[{ SubscriptBox["r", "39"], "\[Rule]", "0.8251941275913985`"}], ",", RowBox[{ SubscriptBox["r", "40"], "\[Rule]", "0.6196310253863522`"}], ",", RowBox[{ SubscriptBox["r", "41"], "\[Rule]", "0.5384751531748685`"}], ",", RowBox[{ SubscriptBox["r", "42"], "\[Rule]", "0.585448336948763`"}], ",", RowBox[{ SubscriptBox["r", "43"], "\[Rule]", "0.6750087760693039`"}], ",", RowBox[{ SubscriptBox["r", "44"], "\[Rule]", "0.5447515322659705`"}], ",", RowBox[{ SubscriptBox["r", "45"], "\[Rule]", "0.6077490477641214`"}], ",", RowBox[{ SubscriptBox["r", "46"], "\[Rule]", "0.6291975859742586`"}], ",", RowBox[{ SubscriptBox["r", "47"], "\[Rule]", "0.4265182744377406`"}], ",", RowBox[{ SubscriptBox["r", "48"], "\[Rule]", "0.504871101652221`"}], ",", RowBox[{ SubscriptBox["r", "49"], "\[Rule]", "0.6253282640470387`"}], ",", RowBox[{ SubscriptBox["r", "50"], "\[Rule]", "0.4790337770711377`"}], ",", RowBox[{ SubscriptBox["r", "51"], "\[Rule]", "0.5706006009448665`"}], ",", RowBox[{ SubscriptBox["r", "52"], "\[Rule]", "0.5989839808368186`"}], ",", RowBox[{ SubscriptBox["r", "53"], "\[Rule]", "0.7129287232479218`"}], ",", RowBox[{ SubscriptBox["r", "54"], "\[Rule]", "0.5799189963210504`"}], ",", RowBox[{ SubscriptBox["r", "55"], "\[Rule]", "0.5382640029932312`"}], ",", RowBox[{ SubscriptBox["r", "56"], "\[Rule]", "0.4406433092614175`"}], ",", RowBox[{ SubscriptBox["r", "57"], "\[Rule]", "0.7329332001924803`"}], ",", RowBox[{ SubscriptBox["r", "58"], "\[Rule]", "0.6998121898376243`"}], ",", RowBox[{ SubscriptBox["r", "59"], "\[Rule]", "0.5605123368531612`"}], ",", RowBox[{ SubscriptBox["r", "60"], "\[Rule]", "0.5318390332873779`"}], ",", RowBox[{ SubscriptBox["r", "61"], "\[Rule]", "0.5214987786818085`"}], ",", RowBox[{ SubscriptBox["r", "62"], "\[Rule]", "0.5004800971017358`"}], ",", RowBox[{ SubscriptBox["r", "63"], "\[Rule]", "0.6413276196623691`"}], ",", RowBox[{ SubscriptBox["r", "64"], "\[Rule]", "0.42435820263413876`"}], ",", RowBox[{ SubscriptBox["r", "65"], "\[Rule]", "0.6838511869016998`"}], ",", RowBox[{ SubscriptBox["r", "66"], "\[Rule]", "0.4704287089415712`"}], ",", RowBox[{ SubscriptBox["r", "67"], "\[Rule]", "0.6626136026894069`"}], ",", RowBox[{ SubscriptBox["r", "68"], "\[Rule]", "0.6620191674004972`"}], ",", RowBox[{ SubscriptBox["r", "69"], "\[Rule]", "0.6386828032152323`"}], ",", RowBox[{ SubscriptBox["r", "70"], "\[Rule]", "0.5801984310816269`"}], ",", RowBox[{ SubscriptBox["r", "71"], "\[Rule]", "0.635144598505603`"}], ",", RowBox[{ SubscriptBox["r", "72"], "\[Rule]", "0.7852325309010798`"}], ",", RowBox[{ SubscriptBox["r", "73"], "\[Rule]", "0.5945925127282461`"}], ",", RowBox[{ SubscriptBox["r", "74"], "\[Rule]", "0.6997099404161397`"}], ",", RowBox[{ SubscriptBox["r", "75"], "\[Rule]", "0.648520025317439`"}], ",", RowBox[{ SubscriptBox["r", "76"], "\[Rule]", "0.6204316557409982`"}], ",", RowBox[{ SubscriptBox["r", "77"], "\[Rule]", "0.8429389791981978`"}], ",", RowBox[{ SubscriptBox["r", "78"], "\[Rule]", "0.6121852586333228`"}], ",", RowBox[{ SubscriptBox["r", "79"], "\[Rule]", "0.7885269315106254`"}], ",", RowBox[{ SubscriptBox["r", "80"], "\[Rule]", "0.7990761339079057`"}], ",", RowBox[{ SubscriptBox["r", "81"], "\[Rule]", "0.451270724669227`"}], ",", RowBox[{ SubscriptBox["r", "82"], "\[Rule]", "0.6050630448274585`"}], ",", RowBox[{ SubscriptBox["r", "83"], "\[Rule]", "0.5447654206640467`"}], ",", RowBox[{ SubscriptBox["r", "84"], "\[Rule]", "0.5654939000716357`"}], ",", RowBox[{ SubscriptBox["r", "85"], "\[Rule]", "0.8519282491050256`"}], ",", RowBox[{ SubscriptBox["r", "86"], "\[Rule]", "0.7211215996008912`"}], ",", RowBox[{ SubscriptBox["r", "87"], "\[Rule]", "0.7013534969246119`"}], ",", RowBox[{ SubscriptBox["r", "88"], "\[Rule]", "0.7098691134093683`"}], ",", RowBox[{ SubscriptBox["r", "89"], "\[Rule]", "0.8649989393427643`"}], ",", RowBox[{ SubscriptBox["r", "90"], "\[Rule]", "0.9494371056561351`"}], ",", RowBox[{ SubscriptBox["r", "91"], "\[Rule]", "0.7204314068728788`"}], ",", RowBox[{ SubscriptBox["r", "92"], "\[Rule]", "0.7439715585222314`"}], ",", RowBox[{ SubscriptBox["r", "93"], "\[Rule]", "1.0903659134453803`"}], ",", RowBox[{ SubscriptBox["r", "94"], "\[Rule]", "0.5591341132854852`"}], ",", RowBox[{ SubscriptBox["r", "95"], "\[Rule]", "1.083700112969913`"}], ",", RowBox[{ SubscriptBox["r", "96"], "\[Rule]", "1.1274905491844835`"}], ",", RowBox[{ SubscriptBox["r", "97"], "\[Rule]", "1.0917092693766441`"}], ",", RowBox[{ SubscriptBox["r", "98"], "\[Rule]", "1.2658614255149754`"}], ",", RowBox[{ SubscriptBox["r", "99"], "\[Rule]", "1.2630677780909718`"}]}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.593837654237851*^9, 3.593840870100851*^9, 3.606409635021916*^9, 3.606410367089221*^9, 3.606410412125806*^9, 3.606564109931817*^9, 3.627902283850205*^9, 3.630174278280425*^9, 3.636048244346952*^9}] }, Open ]], Cell["M2a\t", "Text", CellChangeTimes->{{3.567834554705792*^9, 3.567834555955729*^9}, 3.593837615941092*^9}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"init2a", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"B", ",", "1"}], "}"}], ",", RowBox[{"{", RowBox[{"f", ",", "0.9"}], "}"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"cons2a", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}], ",", RowBox[{"0", "\[LessEqual]", "f", "\[LessEqual]", "1"}], ",", RowBox[{"0", "\[LessEqual]", "B", "\[LessEqual]", "100"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"M2a", "=", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik2a", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "B", ",", "f", ",", "tabcoef", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "cons2a"}], "}"}], ",", "init2a", ",", RowBox[{"AccuracyGoal", "\[Rule]", "6"}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.4849918812651997`*^9, 3.4849919131714497`*^9}, { 3.4849919690620747`*^9, 3.484992003148012*^9}, 3.484992082688813*^9, { 3.484992141204438*^9, 3.484992231870532*^9}, {3.484992265909301*^9, 3.484992343315551*^9}, {3.4849924113150015`*^9, 3.4849924815047894`*^9}, { 3.489138966926263*^9, 3.489138969941888*^9}, {3.4954718462585*^9, 3.4954718693835*^9}, {3.495471912680375*^9, 3.495471913196*^9}, { 3.495471979196*^9, 3.49547200297725*^9}, {3.495472044617875*^9, 3.49547208235225*^9}, {3.496504439538522*^9, 3.496504440085397*^9}, { 3.49926354336675*^9, 3.4992635633355*^9}, {3.499338237553625*^9, 3.499338263178625*^9}, {3.564226049081957*^9, 3.564226105960425*^9}, { 3.564229115421522*^9, 3.564229190300817*^9}, {3.5642303854180613`*^9, 3.564230396396782*^9}, {3.564230879500187*^9, 3.5642309560727453`*^9}, { 3.5642315198642282`*^9, 3.564231528465914*^9}, {3.564231629325408*^9, 3.5642316480873003`*^9}, {3.564231686212853*^9, 3.564231695069336*^9}, { 3.5642318008190317`*^9, 3.564231879410396*^9}, {3.5642319719944572`*^9, 3.5642319918483057`*^9}, {3.564232195011612*^9, 3.5642322769935913`*^9}, { 3.5642327304816723`*^9, 3.564232744770629*^9}, {3.564232806520409*^9, 3.564232810491843*^9}, {3.5642329148891277`*^9, 3.56423292526394*^9}, { 3.564233454538677*^9, 3.564233454839303*^9}, {3.564238323592636*^9, 3.564238324495842*^9}, {3.564421114122242*^9, 3.564421157661137*^9}, { 3.5644659727488194`*^9, 3.564465999051002*^9}, {3.5644661669573097`*^9, 3.564466167564747*^9}, {3.564466227212494*^9, 3.5644662327696457`*^9}, { 3.5644663185076103`*^9, 3.5644663188889713`*^9}, {3.5644670322789297`*^9, 3.56446703240007*^9}, 3.564467094716072*^9, {3.564467137600419*^9, 3.564467200880419*^9}, {3.564605097378956*^9, 3.564605098978668*^9}, 3.565005835663903*^9, {3.5666752948130693`*^9, 3.566675366158661*^9}, { 3.566675762956566*^9, 3.566675768196155*^9}, {3.5666758454312677`*^9, 3.566675911306446*^9}, {3.567785813744672*^9, 3.567785838933971*^9}, { 3.5677867575881567`*^9, 3.567786809263554*^9}, {3.567835044126038*^9, 3.567835044945405*^9}, {3.568717094431422*^9, 3.568717184688394*^9}, { 3.56871736250753*^9, 3.568717375961493*^9}, {3.5687181081607857`*^9, 3.568718108393023*^9}, {3.5729372370460453`*^9, 3.5729372566426477`*^9}, 3.593837615942086*^9, {3.5938376613746023`*^9, 3.5938376670137033`*^9}, 3.63604969702736*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"-", "924.6735766321253`"}], ",", RowBox[{"{", RowBox[{ RowBox[{"B", "\[Rule]", "0.6010151077198812`"}], ",", RowBox[{"f", "\[Rule]", "0.9999999691576064`"}], ",", RowBox[{"\[Theta]", "\[Rule]", "1402.6598172528566`"}], ",", RowBox[{"\[Theta]WS", "\[Rule]", "3353.3229997516364`"}], ",", RowBox[{"\[Lambda]", "\[Rule]", "1.9384926259871138`"}], ",", RowBox[{ SubscriptBox["r", "2"], "\[Rule]", "1.136157222139281`"}], ",", RowBox[{ SubscriptBox["r", "3"], "\[Rule]", "1.213283620097589`"}], ",", RowBox[{ SubscriptBox["r", "4"], "\[Rule]", "1.179829748520025`"}], ",", RowBox[{ SubscriptBox["r", "5"], "\[Rule]", "1.220680446847108`"}], ",", RowBox[{ SubscriptBox["r", "6"], "\[Rule]", "0.996981570770761`"}], ",", RowBox[{ SubscriptBox["r", "7"], "\[Rule]", "1.1647041431844902`"}], ",", RowBox[{ SubscriptBox["r", "8"], "\[Rule]", "1.1235003926672602`"}], ",", RowBox[{ SubscriptBox["r", "9"], "\[Rule]", "1.1134085036883363`"}], ",", RowBox[{ SubscriptBox["r", "10"], "\[Rule]", "1.0724625772027299`"}], ",", RowBox[{ SubscriptBox["r", "11"], "\[Rule]", "1.0753916882623642`"}], ",", RowBox[{ SubscriptBox["r", "12"], "\[Rule]", "1.038855761559693`"}], ",", RowBox[{ SubscriptBox["r", "13"], "\[Rule]", "0.9277837564357979`"}], ",", RowBox[{ SubscriptBox["r", "14"], "\[Rule]", "0.9574953369236983`"}], ",", RowBox[{ SubscriptBox["r", "15"], "\[Rule]", "0.9742222207285172`"}], ",", RowBox[{ SubscriptBox["r", "16"], "\[Rule]", "0.9199558197830854`"}], ",", RowBox[{ SubscriptBox["r", "17"], "\[Rule]", "0.986531567067648`"}], ",", RowBox[{ SubscriptBox["r", "18"], "\[Rule]", "0.9543184808268298`"}], ",", RowBox[{ SubscriptBox["r", "19"], "\[Rule]", "0.5893184751621614`"}], ",", RowBox[{ SubscriptBox["r", "20"], "\[Rule]", "0.7941414507240891`"}], ",", RowBox[{ SubscriptBox["r", "21"], "\[Rule]", "0.9030868472837101`"}], ",", RowBox[{ SubscriptBox["r", "22"], "\[Rule]", "0.9097590378730012`"}], ",", RowBox[{ SubscriptBox["r", "23"], "\[Rule]", "0.870228765441`"}], ",", RowBox[{ SubscriptBox["r", "24"], "\[Rule]", "0.9128780337956693`"}], ",", RowBox[{ SubscriptBox["r", "25"], "\[Rule]", "0.7732937382297941`"}], ",", RowBox[{ SubscriptBox["r", "26"], "\[Rule]", "0.9912954982575864`"}], ",", RowBox[{ SubscriptBox["r", "27"], "\[Rule]", "0.8707759319529539`"}], ",", RowBox[{ SubscriptBox["r", "28"], "\[Rule]", "0.6245558640933452`"}], ",", RowBox[{ SubscriptBox["r", "29"], "\[Rule]", "0.602321104502947`"}], ",", RowBox[{ SubscriptBox["r", "30"], "\[Rule]", "0.8630084373403977`"}], ",", RowBox[{ SubscriptBox["r", "31"], "\[Rule]", "0.5871064469905147`"}], ",", RowBox[{ SubscriptBox["r", "32"], "\[Rule]", "0.8724873294195195`"}], ",", RowBox[{ SubscriptBox["r", "33"], "\[Rule]", "0.7092197454926645`"}], ",", RowBox[{ SubscriptBox["r", "34"], "\[Rule]", "0.7635613974370898`"}], ",", RowBox[{ SubscriptBox["r", "35"], "\[Rule]", "0.7923891681082881`"}], ",", RowBox[{ SubscriptBox["r", "36"], "\[Rule]", "0.8272535068856467`"}], ",", RowBox[{ SubscriptBox["r", "37"], "\[Rule]", "0.6237927287420448`"}], ",", RowBox[{ SubscriptBox["r", "38"], "\[Rule]", "0.7372441522861085`"}], ",", RowBox[{ SubscriptBox["r", "39"], "\[Rule]", "0.82519412781948`"}], ",", RowBox[{ SubscriptBox["r", "40"], "\[Rule]", "0.6196310255744603`"}], ",", RowBox[{ SubscriptBox["r", "41"], "\[Rule]", "0.5384751533473353`"}], ",", RowBox[{ SubscriptBox["r", "42"], "\[Rule]", "0.5854483371291725`"}], ",", RowBox[{ SubscriptBox["r", "43"], "\[Rule]", "0.675008776264459`"}], ",", RowBox[{ SubscriptBox["r", "44"], "\[Rule]", "0.544751532437417`"}], ",", RowBox[{ SubscriptBox["r", "45"], "\[Rule]", "0.6077490479448935`"}], ",", RowBox[{ SubscriptBox["r", "46"], "\[Rule]", "0.6291975861568455`"}], ",", RowBox[{ SubscriptBox["r", "47"], "\[Rule]", "0.42651827458745284`"}], ",", RowBox[{ SubscriptBox["r", "48"], "\[Rule]", "0.5048711018125644`"}], ",", RowBox[{ SubscriptBox["r", "49"], "\[Rule]", "0.6253282642228077`"}], ",", RowBox[{ SubscriptBox["r", "50"], "\[Rule]", "0.47903377722499957`"}], ",", RowBox[{ SubscriptBox["r", "51"], "\[Rule]", "0.5706006011086712`"}], ",", RowBox[{ SubscriptBox["r", "52"], "\[Rule]", "0.598983981001584`"}], ",", RowBox[{ SubscriptBox["r", "53"], "\[Rule]", "0.7129287234223598`"}], ",", RowBox[{ SubscriptBox["r", "54"], "\[Rule]", "0.5799189964780109`"}], ",", RowBox[{ SubscriptBox["r", "55"], "\[Rule]", "0.5382640031432582`"}], ",", RowBox[{ SubscriptBox["r", "56"], "\[Rule]", "0.4406433094003166`"}], ",", RowBox[{ SubscriptBox["r", "57"], "\[Rule]", "0.7329332003514571`"}], ",", RowBox[{ SubscriptBox["r", "58"], "\[Rule]", "0.6998121899895038`"}], ",", RowBox[{ SubscriptBox["r", "59"], "\[Rule]", "0.5605123369922049`"}], ",", RowBox[{ SubscriptBox["r", "60"], "\[Rule]", "0.5318390334213757`"}], ",", RowBox[{ SubscriptBox["r", "61"], "\[Rule]", "0.5214987788118317`"}], ",", RowBox[{ SubscriptBox["r", "62"], "\[Rule]", "0.5004800972277591`"}], ",", RowBox[{ SubscriptBox["r", "63"], "\[Rule]", "0.6413276197868905`"}], ",", RowBox[{ SubscriptBox["r", "64"], "\[Rule]", "0.4243582027524158`"}], ",", RowBox[{ SubscriptBox["r", "65"], "\[Rule]", "0.6838511870151828`"}], ",", RowBox[{ SubscriptBox["r", "66"], "\[Rule]", "0.4704287090529331`"}], ",", RowBox[{ SubscriptBox["r", "67"], "\[Rule]", "0.6626136027909917`"}], ",", RowBox[{ SubscriptBox["r", "68"], "\[Rule]", "0.6620191674958033`"}], ",", RowBox[{ SubscriptBox["r", "69"], "\[Rule]", "0.6386828033053056`"}], ",", RowBox[{ SubscriptBox["r", "70"], "\[Rule]", "0.580198431169445`"}], ",", RowBox[{ SubscriptBox["r", "71"], "\[Rule]", "0.6351445985831072`"}], ",", RowBox[{ SubscriptBox["r", "72"], "\[Rule]", "0.7852325309573042`"}], ",", RowBox[{ SubscriptBox["r", "73"], "\[Rule]", "0.5945925127965901`"}], ",", RowBox[{ SubscriptBox["r", "74"], "\[Rule]", "0.6997099404649146`"}], ",", RowBox[{ SubscriptBox["r", "75"], "\[Rule]", "0.6485200253650635`"}], ",", RowBox[{ SubscriptBox["r", "76"], "\[Rule]", "0.6204316557852966`"}], ",", RowBox[{ SubscriptBox["r", "77"], "\[Rule]", "0.8429389791973554`"}], ",", RowBox[{ SubscriptBox["r", "78"], "\[Rule]", "0.6121852586640016`"}], ",", RowBox[{ SubscriptBox["r", "79"], "\[Rule]", "0.7885269314984087`"}], ",", RowBox[{ SubscriptBox["r", "80"], "\[Rule]", "0.7990761338827886`"}], ",", RowBox[{ SubscriptBox["r", "81"], "\[Rule]", "0.45127072471364327`"}], ",", RowBox[{ SubscriptBox["r", "82"], "\[Rule]", "0.6050630448282143`"}], ",", RowBox[{ SubscriptBox["r", "83"], "\[Rule]", "0.5447654206724781`"}], ",", RowBox[{ SubscriptBox["r", "84"], "\[Rule]", "0.5654939000668332`"}], ",", RowBox[{ SubscriptBox["r", "85"], "\[Rule]", "0.8519282490062822`"}], ",", RowBox[{ SubscriptBox["r", "86"], "\[Rule]", "0.7211215995306431`"}], ",", RowBox[{ SubscriptBox["r", "87"], "\[Rule]", "0.701353496849843`"}], ",", RowBox[{ SubscriptBox["r", "88"], "\[Rule]", "0.7098691133206857`"}], ",", RowBox[{ SubscriptBox["r", "89"], "\[Rule]", "0.8649989391850146`"}], ",", RowBox[{ SubscriptBox["r", "90"], "\[Rule]", "0.9494371054506391`"}], ",", RowBox[{ SubscriptBox["r", "91"], "\[Rule]", "0.7204314067453872`"}], ",", RowBox[{ SubscriptBox["r", "92"], "\[Rule]", "0.7439715583725403`"}], ",", RowBox[{ SubscriptBox["r", "93"], "\[Rule]", "1.0903659131266152`"}], ",", RowBox[{ SubscriptBox["r", "94"], "\[Rule]", "0.5591341131968484`"}], ",", RowBox[{ SubscriptBox["r", "95"], "\[Rule]", "1.0837001126142165`"}], ",", RowBox[{ SubscriptBox["r", "96"], "\[Rule]", "1.1274905487857403`"}], ",", RowBox[{ SubscriptBox["r", "97"], "\[Rule]", "1.0917092689753933`"}], ",", RowBox[{ SubscriptBox["r", "98"], "\[Rule]", "1.2658614249958733`"}], ",", RowBox[{ SubscriptBox["r", "99"], "\[Rule]", "1.2630677775480035`"}]}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.593837671716776*^9, 3.593840876422956*^9, 3.606409646609065*^9, 3.6064103644539547`*^9, 3.606564114725834*^9, 3.63604824932826*^9}] }, Open ]], Cell["M0*", "Text", CellChangeTimes->{{3.564254696525721*^9, 3.564254711296219*^9}, 3.593837615945965*^9, {3.636048277808207*^9, 3.636048278638686*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"init0e3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]", ",", "0.01"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]WS", ",", "0.01"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]SW", ",", "0.005"}], "}"}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoefe", ",", "rinit"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "2"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"cons0e3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]", "\[LessEqual]", RowBox[{"1", "/", "2"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]WS", "\[LessEqual]", RowBox[{"1", "/", "2"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]SW", "\[LessEqual]", RowBox[{"1", "/", "2"}]}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"#", ">", "0"}], "&"}], ",", "tabcoefe"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "2"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"M0e3", "=", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik0err3", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "tabcoefe", ",", "\[Epsilon]", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "cons0e3"}], "}"}], ",", "init0e3", ",", RowBox[{"AccuracyGoal", "\[Rule]", "6"}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.564257616458166*^9, 3.564257730881503*^9}, { 3.564258344046747*^9, 3.564258377812049*^9}, {3.564258655633152*^9, 3.564258678670308*^9}, {3.564259163230528*^9, 3.564259213154874*^9}, { 3.5642594916648207`*^9, 3.564259582458425*^9}, {3.564259633488701*^9, 3.564259666964861*^9}, {3.564260818745007*^9, 3.564260864821734*^9}, { 3.5643902471642323`*^9, 3.564390250674714*^9}, {3.56439057196614*^9, 3.564390579291585*^9}, {3.564420895627928*^9, 3.564420906750004*^9}, { 3.564420965661008*^9, 3.564420995681019*^9}, {3.5644218547441053`*^9, 3.564421860825508*^9}, {3.564467251194352*^9, 3.564467257536964*^9}, { 3.5646499378970222`*^9, 3.5646499618894176`*^9}, {3.567168268755954*^9, 3.567168296712059*^9}, {3.567185407011644*^9, 3.5671854128426657`*^9}, { 3.5672764008949413`*^9, 3.567276404918326*^9}, {3.567402919914804*^9, 3.567402924165704*^9}, {3.567403185575417*^9, 3.5674032020422983`*^9}, { 3.567404806027811*^9, 3.56740480860177*^9}, {3.567406538464699*^9, 3.567406546001855*^9}, {3.567406580326034*^9, 3.567406609193047*^9}, 3.5674070424790087`*^9, {3.567415551539797*^9, 3.567415586527021*^9}, { 3.56741561812897*^9, 3.567415636781228*^9}, 3.567417199358523*^9, 3.5674173052788773`*^9, {3.568717223200315*^9, 3.5687172254265614`*^9}, { 3.568718164547765*^9, 3.568718167146441*^9}, {3.5687192211762*^9, 3.5687192238870792`*^9}, {3.568720345751384*^9, 3.568720357668529*^9}, { 3.593348004464582*^9, 3.593348027357484*^9}, {3.593348755289654*^9, 3.593348784756736*^9}, {3.593349265416524*^9, 3.593349282437333*^9}, { 3.593349592331809*^9, 3.593349613617342*^9}, {3.5933496669214897`*^9, 3.593349668888267*^9}, {3.5933498521197233`*^9, 3.59334986339218*^9}, { 3.593349919100996*^9, 3.593349935656147*^9}, {3.593506168473413*^9, 3.593506207339313*^9}, {3.5935066291522083`*^9, 3.5935066351229353`*^9}, { 3.59350674608365*^9, 3.593506752461071*^9}, 3.593837615947096*^9, 3.6360496971161013`*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"-", "954.4337870054187`"}], ",", RowBox[{"{", RowBox[{ RowBox[{"\[Epsilon]", "\[Rule]", "0.011080616268097003`"}], ",", RowBox[{"\[Epsilon]SW", "\[Rule]", "0.004160603430075215`"}], ",", RowBox[{"\[Epsilon]WS", "\[Rule]", "5.863377320745637`*^-13"}], ",", RowBox[{"\[Theta]", "\[Rule]", "1428.3482570854756`"}], ",", RowBox[{"\[Theta]WS", "\[Rule]", "3531.3031924677225`"}], ",", RowBox[{"\[Lambda]", "\[Rule]", "1.7953761224050195`"}], ",", RowBox[{ SubscriptBox["r", "2"], "\[Rule]", "1.1377023152409664`"}], ",", RowBox[{ SubscriptBox["r", "3"], "\[Rule]", "1.2137386717261396`"}], ",", RowBox[{ SubscriptBox["r", "4"], "\[Rule]", "1.1802210648583111`"}], ",", RowBox[{ SubscriptBox["r", "5"], "\[Rule]", "1.2178056039295753`"}], ",", RowBox[{ SubscriptBox["r", "6"], "\[Rule]", "0.9926298755685089`"}], ",", RowBox[{ SubscriptBox["r", "7"], "\[Rule]", "1.1595420025583827`"}], ",", RowBox[{ SubscriptBox["r", "8"], "\[Rule]", "1.1154307990403953`"}], ",", RowBox[{ SubscriptBox["r", "9"], "\[Rule]", "1.10510245505995`"}], ",", RowBox[{ SubscriptBox["r", "10"], "\[Rule]", "1.064234993888036`"}], ",", RowBox[{ SubscriptBox["r", "11"], "\[Rule]", "1.0631290666382731`"}], ",", RowBox[{ SubscriptBox["r", "12"], "\[Rule]", "1.027431812995448`"}], ",", RowBox[{ SubscriptBox["r", "13"], "\[Rule]", "0.9167852351597141`"}], ",", RowBox[{ SubscriptBox["r", "14"], "\[Rule]", "0.9433704840335774`"}], ",", RowBox[{ SubscriptBox["r", "15"], "\[Rule]", "0.9596175592309824`"}], ",", RowBox[{ SubscriptBox["r", "16"], "\[Rule]", "0.9047102188967397`"}], ",", RowBox[{ SubscriptBox["r", "17"], "\[Rule]", "0.9695954378019618`"}], ",", RowBox[{ SubscriptBox["r", "18"], "\[Rule]", "0.9361389196420569`"}], ",", RowBox[{ SubscriptBox["r", "19"], "\[Rule]", "0.5772656123340674`"}], ",", RowBox[{ SubscriptBox["r", "20"], "\[Rule]", "0.7767951409125079`"}], ",", RowBox[{ SubscriptBox["r", "21"], "\[Rule]", "0.8830306739610125`"}], ",", RowBox[{ SubscriptBox["r", "22"], "\[Rule]", "0.8893781322328859`"}], ",", RowBox[{ SubscriptBox["r", "23"], "\[Rule]", "0.8492015501474972`"}], ",", RowBox[{ SubscriptBox["r", "24"], "\[Rule]", "0.8885946480739473`"}], ",", RowBox[{ SubscriptBox["r", "25"], "\[Rule]", "0.7521651929819076`"}], ",", RowBox[{ SubscriptBox["r", "26"], "\[Rule]", "0.961990508798319`"}], ",", RowBox[{ SubscriptBox["r", "27"], "\[Rule]", "0.8443438866477185`"}], ",", RowBox[{ SubscriptBox["r", "28"], "\[Rule]", "0.6050347786241503`"}], ",", RowBox[{ SubscriptBox["r", "29"], "\[Rule]", "0.5822363058199054`"}], ",", RowBox[{ SubscriptBox["r", "30"], "\[Rule]", "0.8342669384775518`"}], ",", RowBox[{ SubscriptBox["r", "31"], "\[Rule]", "0.567348341651212`"}], ",", RowBox[{ SubscriptBox["r", "32"], "\[Rule]", "0.8411048345280294`"}], ",", RowBox[{ SubscriptBox["r", "33"], "\[Rule]", "0.6831078086478096`"}], ",", RowBox[{ SubscriptBox["r", "34"], "\[Rule]", "0.7341586223322675`"}], ",", RowBox[{ SubscriptBox["r", "35"], "\[Rule]", "0.7601814919995987`"}], ",", RowBox[{ SubscriptBox["r", "36"], "\[Rule]", "0.7933686394159959`"}], ",", RowBox[{ SubscriptBox["r", "37"], "\[Rule]", "0.5967589992682739`"}], ",", RowBox[{ SubscriptBox["r", "38"], "\[Rule]", "0.7037937619504792`"}], ",", RowBox[{ SubscriptBox["r", "39"], "\[Rule]", "0.78926290182521`"}], ",", RowBox[{ SubscriptBox["r", "40"], "\[Rule]", "0.591214977415477`"}], ",", RowBox[{ SubscriptBox["r", "41"], "\[Rule]", "0.5129696742269318`"}], ",", RowBox[{ SubscriptBox["r", "42"], "\[Rule]", "0.5568203681930954`"}], ",", RowBox[{ SubscriptBox["r", "43"], "\[Rule]", "0.6422495068585016`"}], ",", RowBox[{ SubscriptBox["r", "44"], "\[Rule]", "0.5170124021021765`"}], ",", RowBox[{ SubscriptBox["r", "45"], "\[Rule]", "0.5769445050505322`"}], ",", RowBox[{ SubscriptBox["r", "46"], "\[Rule]", "0.5963499643809601`"}], ",", RowBox[{ SubscriptBox["r", "47"], "\[Rule]", "0.4037954579423717`"}], ",", RowBox[{ SubscriptBox["r", "48"], "\[Rule]", "0.47603759009348157`"}], ",", RowBox[{ SubscriptBox["r", "49"], "\[Rule]", "0.5901074814698`"}], ",", RowBox[{ SubscriptBox["r", "50"], "\[Rule]", "0.4514754219933724`"}], ",", RowBox[{ SubscriptBox["r", "51"], "\[Rule]", "0.5370688249614479`"}], ",", RowBox[{ SubscriptBox["r", "52"], "\[Rule]", "0.5642218201401942`"}], ",", RowBox[{ SubscriptBox["r", "53"], "\[Rule]", "0.6692814619100335`"}], ",", RowBox[{ SubscriptBox["r", "54"], "\[Rule]", "0.5433003105051154`"}], ",", RowBox[{ SubscriptBox["r", "55"], "\[Rule]", "0.503294817807144`"}], ",", RowBox[{ SubscriptBox["r", "56"], "\[Rule]", "0.41228194924526973`"}], ",", RowBox[{ SubscriptBox["r", "57"], "\[Rule]", "0.6841139127358138`"}], ",", RowBox[{ SubscriptBox["r", "58"], "\[Rule]", "0.6538071332893729`"}], ",", RowBox[{ SubscriptBox["r", "59"], "\[Rule]", "0.5226444891521147`"}], ",", RowBox[{ SubscriptBox["r", "60"], "\[Rule]", "0.4946923251764742`"}], ",", RowBox[{ SubscriptBox["r", "61"], "\[Rule]", "0.4821719177302338`"}], ",", RowBox[{ SubscriptBox["r", "62"], "\[Rule]", "0.4658800401459631`"}], ",", RowBox[{ SubscriptBox["r", "63"], "\[Rule]", "0.5956640956000414`"}], ",", RowBox[{ SubscriptBox["r", "64"], "\[Rule]", "0.3906528133992845`"}], ",", RowBox[{ SubscriptBox["r", "65"], "\[Rule]", "0.6326655745939794`"}], ",", RowBox[{ SubscriptBox["r", "66"], "\[Rule]", "0.43223844272979967`"}], ",", RowBox[{ SubscriptBox["r", "67"], "\[Rule]", "0.6095084621333082`"}], ",", RowBox[{ SubscriptBox["r", "68"], "\[Rule]", "0.6072778648806739`"}], ",", RowBox[{ SubscriptBox["r", "69"], "\[Rule]", "0.5855327784816652`"}], ",", RowBox[{ SubscriptBox["r", "70"], "\[Rule]", "0.5289673741492613`"}], ",", RowBox[{ SubscriptBox["r", "71"], "\[Rule]", "0.5832895506966961`"}], ",", RowBox[{ SubscriptBox["r", "72"], "\[Rule]", "0.7196324103844038`"}], ",", RowBox[{ SubscriptBox["r", "73"], "\[Rule]", "0.5405211038100634`"}], ",", RowBox[{ SubscriptBox["r", "74"], "\[Rule]", "0.6363543173984397`"}], ",", RowBox[{ SubscriptBox["r", "75"], "\[Rule]", "0.587799579612391`"}], ",", RowBox[{ SubscriptBox["r", "76"], "\[Rule]", "0.5601432681294556`"}], ",", RowBox[{ SubscriptBox["r", "77"], "\[Rule]", "0.760848207490531`"}], ",", RowBox[{ SubscriptBox["r", "78"], "\[Rule]", "0.5443339645725923`"}], ",", RowBox[{ SubscriptBox["r", "79"], "\[Rule]", "0.7084437948527065`"}], ",", RowBox[{ SubscriptBox["r", "80"], "\[Rule]", "0.7213310148535479`"}], ",", RowBox[{ SubscriptBox["r", "81"], "\[Rule]", "0.4036370999657541`"}], ",", RowBox[{ SubscriptBox["r", "82"], "\[Rule]", "0.53575481410077`"}], ",", RowBox[{ SubscriptBox["r", "83"], "\[Rule]", "0.4747648060335631`"}], ",", RowBox[{ SubscriptBox["r", "84"], "\[Rule]", "0.4964157543547954`"}], ",", RowBox[{ SubscriptBox["r", "85"], "\[Rule]", "0.7534001179598211`"}], ",", RowBox[{ SubscriptBox["r", "86"], "\[Rule]", "0.6373307127402092`"}], ",", RowBox[{ SubscriptBox["r", "87"], "\[Rule]", "0.6073765460171655`"}], ",", RowBox[{ SubscriptBox["r", "88"], "\[Rule]", "0.6101166507933224`"}], ",", RowBox[{ SubscriptBox["r", "89"], "\[Rule]", "0.7605651958025501`"}], ",", RowBox[{ SubscriptBox["r", "90"], "\[Rule]", "0.8103345150745709`"}], ",", RowBox[{ SubscriptBox["r", "91"], "\[Rule]", "0.6036751294601663`"}], ",", RowBox[{ SubscriptBox["r", "92"], "\[Rule]", "0.6301251898128609`"}], ",", RowBox[{ SubscriptBox["r", "93"], "\[Rule]", "0.9136868550956988`"}], ",", RowBox[{ SubscriptBox["r", "94"], "\[Rule]", "0.44818462069321896`"}], ",", RowBox[{ SubscriptBox["r", "95"], "\[Rule]", "0.8801859753836877`"}], ",", RowBox[{ SubscriptBox["r", "96"], "\[Rule]", "0.8580657210503831`"}], ",", RowBox[{ SubscriptBox["r", "97"], "\[Rule]", "0.8118863212286774`"}], ",", RowBox[{ SubscriptBox["r", "98"], "\[Rule]", "0.9151598822726754`"}]}], "}"}]}], "}"}]], "Output", GeneratedCell->False, CellAutoOverwrite->False, CellChangeTimes->{ 3.593348270962479*^9, 3.5933484956926403`*^9, 3.593348713965291*^9, { 3.593348766109223*^9, 3.593348786604374*^9}, 3.593349199865632*^9, { 3.593349259211022*^9, 3.593349284026058*^9}, {3.593349647469309*^9, 3.593349671640036*^9}, 3.593349937222558*^9, 3.593453516339282*^9, 3.59345382494979*^9, 3.59345425721968*^9, 3.593505800424738*^9, 3.593505831204718*^9, 3.593505964723877*^9, {3.593506188538784*^9, 3.593506209562334*^9}, 3.5935067553955107`*^9, 3.593506920870984*^9, 3.593507510703329*^9, 3.593507678607761*^9, 3.593507847720851*^9, 3.593510665580166*^9, 3.59351778395682*^9, 3.593627145037381*^9, 3.593627219417302*^9, 3.593759674673596*^9, 3.5937670101531553`*^9, 3.593767322786929*^9, 3.593785415645396*^9, 3.5938376159511557`*^9, 3.6064096724009523`*^9, 3.6065641197906427`*^9, 3.627902292916437*^9, 3.630174287413062*^9, {3.636048264633157*^9, 3.636048283166876*^9}}] }, Open ]], Cell["M1*", "Text", CellChangeTimes->{{3.564254696525721*^9, 3.564254711296219*^9}, { 3.5642548723629217`*^9, 3.564254872553527*^9}, 3.593837615952228*^9, { 3.636048303545431*^9, 3.636048304343451*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"init1e3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"B", ",", RowBox[{"B", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]", ",", RowBox[{"\[Epsilon]", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]WS", ",", RowBox[{"\[Epsilon]WS", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]SW", ",", RowBox[{"\[Epsilon]SW", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoefe", ",", "rinit"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "2"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"cons1e3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]WS", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]SW", "\[LessEqual]", RowBox[{"1", "/", "4"}]}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"10", ">", "#", ">", "0"}], "&"}], ",", "tabcoefe"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "2"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"M1e3", "=", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik1err3", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "B", ",", "tabcoefe", ",", "\[Epsilon]", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "cons1e3"}], "}"}], ",", "init1e3", ",", RowBox[{"AccuracyGoal", "\[Rule]", "6"}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.5642577241235847`*^9, 3.564257749704468*^9}, { 3.5642578206053534`*^9, 3.564257824227219*^9}, {3.564257894510888*^9, 3.564257920556471*^9}, {3.564258085258842*^9, 3.5642581876178913`*^9}, { 3.564258437640936*^9, 3.564258451734435*^9}, {3.5642584918053417`*^9, 3.564258562844203*^9}, {3.564258714773546*^9, 3.56425884308426*^9}, { 3.564258913465157*^9, 3.564258919025383*^9}, {3.5642595973546877`*^9, 3.564259597738083*^9}, {3.564259769334746*^9, 3.564259839905995*^9}, { 3.564260349531742*^9, 3.5642603571948977`*^9}, {3.56426040695984*^9, 3.5642606000949306`*^9}, {3.564390716440209*^9, 3.564390721051715*^9}, { 3.564390868789227*^9, 3.5643908814673634`*^9}, {3.5643909181864567`*^9, 3.564390947606907*^9}, {3.564390989749899*^9, 3.564390991974864*^9}, { 3.56439129718023*^9, 3.564391297415978*^9}, {3.564418884264182*^9, 3.564418896958001*^9}, {3.5644190406825743`*^9, 3.564419044996611*^9}, { 3.564419102123251*^9, 3.564419105456602*^9}, {3.5644191647086782`*^9, 3.564419172099958*^9}, {3.5644193422987967`*^9, 3.5644193452088842`*^9}, { 3.564420558146777*^9, 3.564420562328792*^9}, {3.564420598667795*^9, 3.564420599625935*^9}, {3.564420749874487*^9, 3.564420760079729*^9}, { 3.5644214018364162`*^9, 3.5644214155825233`*^9}, {3.564421493825964*^9, 3.56442149872165*^9}, {3.56442158005374*^9, 3.5644216371845703`*^9}, { 3.564466455261829*^9, 3.5644664633714523`*^9}, {3.564466581973983*^9, 3.5644665866190357`*^9}, {3.5644666588121023`*^9, 3.564466660689242*^9}, { 3.564642471434883*^9, 3.5646426547488203`*^9}, {3.564938675319601*^9, 3.5649388420628653`*^9}, {3.565005979756937*^9, 3.56500599040947*^9}, { 3.565041114867258*^9, 3.565041210507667*^9}, {3.565082155936466*^9, 3.565082177899263*^9}, {3.567168311113689*^9, 3.5671683659283743`*^9}, { 3.567185422796089*^9, 3.567185433579032*^9}, {3.567276442405864*^9, 3.567276445661359*^9}, {3.567402930340309*^9, 3.5674029347387657`*^9}, { 3.5674032056564093`*^9, 3.567403237571084*^9}, {3.567403306467596*^9, 3.567403309876526*^9}, {3.567404790109828*^9, 3.567404799243469*^9}, { 3.567404863571045*^9, 3.567404863706314*^9}, 3.567786264887442*^9, { 3.5687172398281403`*^9, 3.568717242708214*^9}, {3.56871817832001*^9, 3.568718180524124*^9}, {3.568719229896356*^9, 3.568719232191062*^9}, { 3.5687203719014273`*^9, 3.568720377819476*^9}, {3.59334744200837*^9, 3.5933474780586576`*^9}, {3.5933480859640007`*^9, 3.593348107245837*^9}, { 3.5933481492533216`*^9, 3.593348149422243*^9}, {3.593348774048688*^9, 3.593348797437286*^9}, {3.593349298503961*^9, 3.5933493159196653`*^9}, { 3.593349408554369*^9, 3.5933494229177094`*^9}, {3.593349498487121*^9, 3.593349499417815*^9}, {3.593453567605763*^9, 3.59345363251348*^9}, { 3.5935058580845737`*^9, 3.593505909575251*^9}, {3.593506003008971*^9, 3.593506004345495*^9}, {3.593506064692576*^9, 3.5935060659646177`*^9}, { 3.5935060998487597`*^9, 3.5935061528346987`*^9}, 3.593506284370851*^9, { 3.5935063165190687`*^9, 3.593506329152761*^9}, {3.593506769797804*^9, 3.593506824166952*^9}, {3.5935075767439737`*^9, 3.5935075769105377`*^9}, { 3.593507734165144*^9, 3.59350775346859*^9}, {3.593507905312686*^9, 3.5935079399262943`*^9}, {3.593759692017202*^9, 3.5937597140436287`*^9}, { 3.593767245913066*^9, 3.593767247336506*^9}, 3.593837615953558*^9, { 3.606409762460683*^9, 3.606409784881844*^9}, 3.636049697194765*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"-", "921.4519277093241`"}], ",", RowBox[{"{", RowBox[{ RowBox[{"B", "\[Rule]", "0.588229136002107`"}], ",", RowBox[{"\[Epsilon]", "\[Rule]", "0.007834432965173105`"}], ",", RowBox[{"\[Epsilon]SW", "\[Rule]", "0.0004466929757906144`"}], ",", RowBox[{"\[Epsilon]WS", "\[Rule]", "0.002743422579205719`"}], ",", RowBox[{"\[Theta]", "\[Rule]", "1406.8459463435142`"}], ",", RowBox[{"\[Theta]WS", "\[Rule]", "3373.739220663517`"}], ",", RowBox[{"\[Lambda]", "\[Rule]", "1.9283286336715704`"}], ",", RowBox[{ SubscriptBox["r", "2"], "\[Rule]", "1.1360288067557163`"}], ",", RowBox[{ SubscriptBox["r", "3"], "\[Rule]", "1.2131953962878435`"}], ",", RowBox[{ SubscriptBox["r", "4"], "\[Rule]", "1.180034679561751`"}], ",", RowBox[{ SubscriptBox["r", "5"], "\[Rule]", "1.2204471712420808`"}], ",", RowBox[{ SubscriptBox["r", "6"], "\[Rule]", "0.9966183753102248`"}], ",", RowBox[{ SubscriptBox["r", "7"], "\[Rule]", "1.1645246674755985`"}], ",", RowBox[{ SubscriptBox["r", "8"], "\[Rule]", "1.1229151817800223`"}], ",", RowBox[{ SubscriptBox["r", "9"], "\[Rule]", "1.113071619855664`"}], ",", RowBox[{ SubscriptBox["r", "10"], "\[Rule]", "1.0723368520499637`"}], ",", RowBox[{ SubscriptBox["r", "11"], "\[Rule]", "1.0745621693374205`"}], ",", RowBox[{ SubscriptBox["r", "12"], "\[Rule]", "1.0384820274756783`"}], ",", RowBox[{ SubscriptBox["r", "13"], "\[Rule]", "0.9274908219240693`"}], ",", RowBox[{ SubscriptBox["r", "14"], "\[Rule]", "0.9567443658775755`"}], ",", RowBox[{ SubscriptBox["r", "15"], "\[Rule]", "0.9736425699341056`"}], ",", RowBox[{ SubscriptBox["r", "16"], "\[Rule]", "0.9193520458570292`"}], ",", RowBox[{ SubscriptBox["r", "17"], "\[Rule]", "0.9860225996076881`"}], ",", RowBox[{ SubscriptBox["r", "18"], "\[Rule]", "0.9536014214734226`"}], ",", RowBox[{ SubscriptBox["r", "19"], "\[Rule]", "0.5887977224951214`"}], ",", RowBox[{ SubscriptBox["r", "20"], "\[Rule]", "0.7932903807848515`"}], ",", RowBox[{ SubscriptBox["r", "21"], "\[Rule]", "0.9023206562567723`"}], ",", RowBox[{ SubscriptBox["r", "22"], "\[Rule]", "0.9092604885063681`"}], ",", RowBox[{ SubscriptBox["r", "23"], "\[Rule]", "0.869464514780914`"}], ",", RowBox[{ SubscriptBox["r", "24"], "\[Rule]", "0.9118406010348542`"}], ",", RowBox[{ SubscriptBox["r", "25"], "\[Rule]", "0.772418402507809`"}], ",", RowBox[{ SubscriptBox["r", "26"], "\[Rule]", "0.9898877166000107`"}], ",", RowBox[{ SubscriptBox["r", "27"], "\[Rule]", "0.8695941898545683`"}], ",", RowBox[{ SubscriptBox["r", "28"], "\[Rule]", "0.6235239663646879`"}], ",", RowBox[{ SubscriptBox["r", "29"], "\[Rule]", "0.6012019221455983`"}], ",", RowBox[{ SubscriptBox["r", "30"], "\[Rule]", "0.8618328470530795`"}], ",", RowBox[{ SubscriptBox["r", "31"], "\[Rule]", "0.5862556229496138`"}], ",", RowBox[{ SubscriptBox["r", "32"], "\[Rule]", "0.8710508622324892`"}], ",", RowBox[{ SubscriptBox["r", "33"], "\[Rule]", "0.7079939386036448`"}], ",", RowBox[{ SubscriptBox["r", "34"], "\[Rule]", "0.7622344385401679`"}], ",", RowBox[{ SubscriptBox["r", "35"], "\[Rule]", "0.7905920101082092`"}], ",", RowBox[{ SubscriptBox["r", "36"], "\[Rule]", "0.8257282951165564`"}], ",", RowBox[{ SubscriptBox["r", "37"], "\[Rule]", "0.6221268502337909`"}], ",", RowBox[{ SubscriptBox["r", "38"], "\[Rule]", "0.735237824124033`"}], ",", RowBox[{ SubscriptBox["r", "39"], "\[Rule]", "0.8236134769113233`"}], ",", RowBox[{ SubscriptBox["r", "40"], "\[Rule]", "0.6180626596736056`"}], ",", RowBox[{ SubscriptBox["r", "41"], "\[Rule]", "0.5369169768982182`"}], ",", RowBox[{ SubscriptBox["r", "42"], "\[Rule]", "0.583545879521671`"}], ",", RowBox[{ SubscriptBox["r", "43"], "\[Rule]", "0.6731068243579028`"}], ",", RowBox[{ SubscriptBox["r", "44"], "\[Rule]", "0.5431141369401761`"}], ",", RowBox[{ SubscriptBox["r", "45"], "\[Rule]", "0.6060538261213441`"}], ",", RowBox[{ SubscriptBox["r", "46"], "\[Rule]", "0.6272786582959842`"}], ",", RowBox[{ SubscriptBox["r", "47"], "\[Rule]", "0.4248137108148809`"}], ",", RowBox[{ SubscriptBox["r", "48"], "\[Rule]", "0.5026641855073618`"}], ",", RowBox[{ SubscriptBox["r", "49"], "\[Rule]", "0.6230772047965525`"}], ",", RowBox[{ SubscriptBox["r", "50"], "\[Rule]", "0.4771856502644853`"}], ",", RowBox[{ SubscriptBox["r", "51"], "\[Rule]", "0.5682328034510588`"}], ",", RowBox[{ SubscriptBox["r", "52"], "\[Rule]", "0.5969535286020561`"}], ",", RowBox[{ SubscriptBox["r", "53"], "\[Rule]", "0.7102322968535261`"}], ",", RowBox[{ SubscriptBox["r", "54"], "\[Rule]", "0.5770981893580821`"}], ",", RowBox[{ SubscriptBox["r", "55"], "\[Rule]", "0.5354147019669175`"}], ",", RowBox[{ SubscriptBox["r", "56"], "\[Rule]", "0.4383869045850719`"}], ",", RowBox[{ SubscriptBox["r", "57"], "\[Rule]", "0.7292031164315047`"}], ",", RowBox[{ SubscriptBox["r", "58"], "\[Rule]", "0.6966515055604848`"}], ",", RowBox[{ SubscriptBox["r", "59"], "\[Rule]", "0.5576539221325972`"}], ",", RowBox[{ SubscriptBox["r", "60"], "\[Rule]", "0.5286469531850005`"}], ",", RowBox[{ SubscriptBox["r", "61"], "\[Rule]", "0.5171564894828016`"}], ",", RowBox[{ SubscriptBox["r", "62"], "\[Rule]", "0.49738511393412216`"}], ",", RowBox[{ SubscriptBox["r", "63"], "\[Rule]", "0.6377394770389513`"}], ",", RowBox[{ SubscriptBox["r", "64"], "\[Rule]", "0.42007620458560213`"}], ",", RowBox[{ SubscriptBox["r", "65"], "\[Rule]", "0.6791644943833165`"}], ",", RowBox[{ SubscriptBox["r", "66"], "\[Rule]", "0.4658328704550328`"}], ",", RowBox[{ SubscriptBox["r", "67"], "\[Rule]", "0.6573059899933574`"}], ",", RowBox[{ SubscriptBox["r", "68"], "\[Rule]", "0.6558627188812071`"}], ",", RowBox[{ SubscriptBox["r", "69"], "\[Rule]", "0.6333801904749379`"}], ",", RowBox[{ SubscriptBox["r", "70"], "\[Rule]", "0.5735868942143989`"}], ",", RowBox[{ SubscriptBox["r", "71"], "\[Rule]", "0.6302070980825306`"}], ",", RowBox[{ SubscriptBox["r", "72"], "\[Rule]", "0.7791486140440843`"}], ",", RowBox[{ SubscriptBox["r", "73"], "\[Rule]", "0.587367579095974`"}], ",", RowBox[{ SubscriptBox["r", "74"], "\[Rule]", "0.6913615089268352`"}], ",", RowBox[{ SubscriptBox["r", "75"], "\[Rule]", "0.6406995037292254`"}], ",", RowBox[{ SubscriptBox["r", "76"], "\[Rule]", "0.6115780121472495`"}], ",", RowBox[{ SubscriptBox["r", "77"], "\[Rule]", "0.832363142990705`"}], ",", RowBox[{ SubscriptBox["r", "78"], "\[Rule]", "0.6008215315660606`"}], ",", RowBox[{ SubscriptBox["r", "79"], "\[Rule]", "0.7771035214696804`"}], ",", RowBox[{ SubscriptBox["r", "80"], "\[Rule]", "0.788963691057849`"}], ",", RowBox[{ SubscriptBox["r", "81"], "\[Rule]", "0.4436282221292365`"}], ",", RowBox[{ SubscriptBox["r", "82"], "\[Rule]", "0.5921195175023974`"}], ",", RowBox[{ SubscriptBox["r", "83"], "\[Rule]", "0.5299090730294631`"}], ",", RowBox[{ SubscriptBox["r", "84"], "\[Rule]", "0.55138012031086`"}], ",", RowBox[{ SubscriptBox["r", "85"], "\[Rule]", "0.834701395732836`"}], ",", RowBox[{ SubscriptBox["r", "86"], "\[Rule]", "0.7049609395454521`"}], ",", RowBox[{ SubscriptBox["r", "87"], "\[Rule]", "0.6816356427380387`"}], ",", RowBox[{ SubscriptBox["r", "88"], "\[Rule]", "0.6869422383722015`"}], ",", RowBox[{ SubscriptBox["r", "89"], "\[Rule]", "0.8427121771850584`"}], ",", RowBox[{ SubscriptBox["r", "90"], "\[Rule]", "0.9182745111982048`"}], ",", RowBox[{ SubscriptBox["r", "91"], "\[Rule]", "0.6884266423812989`"}], ",", RowBox[{ SubscriptBox["r", "92"], "\[Rule]", "0.7111035232148236`"}], ",", RowBox[{ SubscriptBox["r", "93"], "\[Rule]", "1.044503290732884`"}], ",", RowBox[{ SubscriptBox["r", "94"], "\[Rule]", "0.5193632690079175`"}], ",", RowBox[{ SubscriptBox["r", "95"], "\[Rule]", "1.0199784044789972`"}], ",", RowBox[{ SubscriptBox["r", "96"], "\[Rule]", "1.0403220557405317`"}], ",", RowBox[{ SubscriptBox["r", "97"], "\[Rule]", "0.9850209333919193`"}], ",", RowBox[{ SubscriptBox["r", "98"], "\[Rule]", "1.12024576392016`"}]}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.606409791555632*^9, 3.6065641253553534`*^9, 3.627902303518073*^9, 3.630174294078204*^9, 3.636048308351265*^9}] }, Open ]], Cell["M2a*", "Text", CellChangeTimes->{{3.564254696525721*^9, 3.564254711296219*^9}, { 3.5642548723629217`*^9, 3.564254872553527*^9}, {3.564466261321538*^9, 3.564466262346858*^9}, 3.593837615958664*^9, {3.6360483122247353`*^9, 3.636048313248025*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"init2ae3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"B", ",", RowBox[{"B", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]", ",", RowBox[{"\[Epsilon]", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]WS", ",", RowBox[{"\[Epsilon]WS", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]SW", ",", RowBox[{"\[Epsilon]SW", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"f", ",", "0.3"}], "}"}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"cons2ae3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}], ",", RowBox[{"0", "<", "B"}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]WS", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]SW", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "f", "\[LessEqual]", "1"}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"M2ae3", "=", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik2aerr3", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "B", ",", "f", ",", "tabcoef", ",", "\[Epsilon]", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "cons2ae3"}], "}"}], ",", "init2ae3", ",", RowBox[{"AccuracyGoal", "\[Rule]", "6"}], ",", RowBox[{"MaxIterations", "\[Rule]", "1000"}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.5642577241235847`*^9, 3.564257749704468*^9}, { 3.5642578206053534`*^9, 3.564257824227219*^9}, {3.564257894510888*^9, 3.564257920556471*^9}, {3.564258085258842*^9, 3.5642581876178913`*^9}, { 3.564258437640936*^9, 3.564258451734435*^9}, {3.5642584918053417`*^9, 3.564258562844203*^9}, {3.564258714773546*^9, 3.56425884308426*^9}, { 3.564258913465157*^9, 3.564258919025383*^9}, {3.5642595973546877`*^9, 3.564259597738083*^9}, {3.564259769334746*^9, 3.564259839905995*^9}, { 3.564260349531742*^9, 3.5642603571948977`*^9}, {3.56426040695984*^9, 3.5642606000949306`*^9}, {3.564390716440209*^9, 3.564390721051715*^9}, { 3.564390868789227*^9, 3.5643908814673634`*^9}, {3.5643909181864567`*^9, 3.564390947606907*^9}, {3.564390989749899*^9, 3.564390991974864*^9}, { 3.56439129718023*^9, 3.564391297415978*^9}, {3.564418884264182*^9, 3.564418896958001*^9}, {3.5644190406825743`*^9, 3.564419044996611*^9}, { 3.564419102123251*^9, 3.564419105456602*^9}, {3.5644191647086782`*^9, 3.564419172099958*^9}, {3.5644193422987967`*^9, 3.5644193452088842`*^9}, { 3.564420558146777*^9, 3.564420562328792*^9}, {3.564420598667795*^9, 3.564420599625935*^9}, {3.564420749874487*^9, 3.564420760079729*^9}, { 3.5644214018364162`*^9, 3.5644214155825233`*^9}, {3.564421493825964*^9, 3.56442149872165*^9}, {3.56442158005374*^9, 3.5644216371845703`*^9}, { 3.5644662771195908`*^9, 3.5644662940731993`*^9}, {3.564466482946065*^9, 3.564466486536077*^9}, {3.564467640548579*^9, 3.564467674601096*^9}, { 3.564467707383567*^9, 3.56446772273847*^9}, {3.56446775857195*^9, 3.564467765860962*^9}, {3.564469085717156*^9, 3.56446908602992*^9}, { 3.5644691689721746`*^9, 3.5644691910167913`*^9}, {3.564469248212188*^9, 3.564469290489394*^9}, {3.564469330033928*^9, 3.56446935534626*^9}, { 3.565038133678452*^9, 3.565038149395665*^9}, {3.565038294538906*^9, 3.565038350024108*^9}, {3.56667552150385*^9, 3.5666755592120037`*^9}, { 3.566675979480361*^9, 3.56667603759625*^9}, 3.566676091298222*^9, 3.567785844424178*^9, {3.5677860084152327`*^9, 3.567786022172352*^9}, 3.567786088825808*^9, {3.5677861479502497`*^9, 3.567786154243649*^9}, 3.567786209723259*^9, {3.56778655514825*^9, 3.567786634322435*^9}, { 3.567786821010351*^9, 3.567786920708294*^9}, 3.567834539205043*^9, { 3.5687172514401207`*^9, 3.5687172536768847`*^9}, {3.568717451082345*^9, 3.568717465021495*^9}, {3.568718207188142*^9, 3.5687182097529383`*^9}, { 3.568719318986308*^9, 3.5687193939342737`*^9}, {3.568720389261157*^9, 3.568720393794636*^9}, {3.5687204381095467`*^9, 3.568720516095132*^9}, { 3.572937320373774*^9, 3.572937337248168*^9}, {3.593454304633361*^9, 3.593454334060339*^9}, {3.593454386151325*^9, 3.5934543928149567`*^9}, 3.593837615960013*^9, {3.6065664971951437`*^9, 3.606566528499823*^9}, { 3.606566736204895*^9, 3.606566747986783*^9}, 3.6360496972442007`*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"-", "919.8249382558752`"}], ",", RowBox[{"{", RowBox[{ RowBox[{"B", "\[Rule]", "7.742252884018617`"}], ",", RowBox[{"f", "\[Rule]", "0.14915715909852506`"}], ",", RowBox[{"\[Epsilon]", "\[Rule]", "0.014137077170937453`"}], ",", RowBox[{"\[Epsilon]SW", "\[Rule]", "5.7838457469568205`*^-12"}], ",", RowBox[{"\[Epsilon]WS", "\[Rule]", "0.007882877496293007`"}], ",", RowBox[{"\[Theta]", "\[Rule]", "1402.1706429641354`"}], ",", RowBox[{"\[Theta]WS", "\[Rule]", "3366.0761429735003`"}], ",", RowBox[{"\[Lambda]", "\[Rule]", "1.954573855131447`"}], ",", RowBox[{ SubscriptBox["r", "2"], "\[Rule]", "1.1410351228295699`"}], ",", RowBox[{ SubscriptBox["r", "3"], "\[Rule]", "1.2228539169879262`"}], ",", RowBox[{ SubscriptBox["r", "4"], "\[Rule]", "1.1933665671996756`"}], ",", RowBox[{ SubscriptBox["r", "5"], "\[Rule]", "1.2377398830045487`"}], ",", RowBox[{ SubscriptBox["r", "6"], "\[Rule]", "1.0131610650041476`"}], ",", RowBox[{ SubscriptBox["r", "7"], "\[Rule]", "1.1868236971474047`"}], ",", RowBox[{ SubscriptBox["r", "8"], "\[Rule]", "1.146570832032589`"}], ",", RowBox[{ SubscriptBox["r", "9"], "\[Rule]", "1.1386094321575875`"}], ",", RowBox[{ SubscriptBox["r", "10"], "\[Rule]", "1.0987888070492253`"}], ",", RowBox[{ SubscriptBox["r", "11"], "\[Rule]", "1.1023432664642363`"}], ",", RowBox[{ SubscriptBox["r", "12"], "\[Rule]", "1.0666953403374182`"}], ",", RowBox[{ SubscriptBox["r", "13"], "\[Rule]", "0.9536513559950837`"}], ",", RowBox[{ SubscriptBox["r", "14"], "\[Rule]", "0.9843960358634072`"}], ",", RowBox[{ SubscriptBox["r", "15"], "\[Rule]", "1.0024689248695022`"}], ",", RowBox[{ SubscriptBox["r", "16"], "\[Rule]", "0.9470342410323308`"}], ",", RowBox[{ SubscriptBox["r", "17"], "\[Rule]", "1.0161205195823368`"}], ",", RowBox[{ SubscriptBox["r", "18"], "\[Rule]", "0.9828468304638153`"}], ",", RowBox[{ SubscriptBox["r", "19"], "\[Rule]", "0.6068605158035044`"}], ",", RowBox[{ SubscriptBox["r", "20"], "\[Rule]", "0.817523132431344`"}], ",", RowBox[{ SubscriptBox["r", "21"], "\[Rule]", "0.9298429899960771`"}], ",", RowBox[{ SubscriptBox["r", "22"], "\[Rule]", "0.9368818613529005`"}], ",", RowBox[{ SubscriptBox["r", "23"], "\[Rule]", "0.8954230792923931`"}], ",", RowBox[{ SubscriptBox["r", "24"], "\[Rule]", "0.938658076657791`"}], ",", RowBox[{ SubscriptBox["r", "25"], "\[Rule]", "0.7946489247718228`"}], ",", RowBox[{ SubscriptBox["r", "26"], "\[Rule]", "1.0177662758194979`"}], ",", RowBox[{ SubscriptBox["r", "27"], "\[Rule]", "0.8934879770735018`"}], ",", RowBox[{ SubscriptBox["r", "28"], "\[Rule]", "0.6399146736940111`"}], ",", RowBox[{ SubscriptBox["r", "29"], "\[Rule]", "0.6165018920908342`"}], ",", RowBox[{ SubscriptBox["r", "30"], "\[Rule]", "0.8832677478937073`"}], ",", RowBox[{ SubscriptBox["r", "31"], "\[Rule]", "0.6000560053169307`"}], ",", RowBox[{ SubscriptBox["r", "32"], "\[Rule]", "0.8908402172468717`"}], ",", RowBox[{ SubscriptBox["r", "33"], "\[Rule]", "0.7231201552682425`"}], ",", RowBox[{ SubscriptBox["r", "34"], "\[Rule]", "0.7778444408219282`"}], ",", RowBox[{ SubscriptBox["r", "35"], "\[Rule]", "0.8055478591570906`"}], ",", RowBox[{ SubscriptBox["r", "36"], "\[Rule]", "0.8406405445445759`"}], ",", RowBox[{ SubscriptBox["r", "37"], "\[Rule]", "0.6320972838138647`"}], ",", RowBox[{ SubscriptBox["r", "38"], "\[Rule]", "0.7462463441571764`"}], ",", RowBox[{ SubscriptBox["r", "39"], "\[Rule]", "0.8349646450094146`"}], ",", RowBox[{ SubscriptBox["r", "40"], "\[Rule]", "0.6254208049725062`"}], ",", RowBox[{ SubscriptBox["r", "41"], "\[Rule]", "0.542316243945852`"}], ",", RowBox[{ SubscriptBox["r", "42"], "\[Rule]", "0.5883078594597552`"}], ",", RowBox[{ SubscriptBox["r", "43"], "\[Rule]", "0.677662437526054`"}], ",", RowBox[{ SubscriptBox["r", "44"], "\[Rule]", "0.5460934132061337`"}], ",", RowBox[{ SubscriptBox["r", "45"], "\[Rule]", "0.6082906103167901`"}], ",", RowBox[{ SubscriptBox["r", "46"], "\[Rule]", "0.6284326546862097`"}], ",", RowBox[{ SubscriptBox["r", "47"], "\[Rule]", "0.42418138879923434`"}], ",", RowBox[{ SubscriptBox["r", "48"], "\[Rule]", "0.501414252724059`"}], ",", RowBox[{ SubscriptBox["r", "49"], "\[Rule]", "0.6207504257697478`"}], ",", RowBox[{ SubscriptBox["r", "50"], "\[Rule]", "0.47438258709246894`"}], ",", RowBox[{ SubscriptBox["r", "51"], "\[Rule]", "0.5636325935424459`"}], ",", RowBox[{ SubscriptBox["r", "52"], "\[Rule]", "0.5913178879242031`"}], ",", RowBox[{ SubscriptBox["r", "53"], "\[Rule]", "0.7024602706781802`"}], ",", RowBox[{ SubscriptBox["r", "54"], "\[Rule]", "0.5687996398735387`"}], ",", RowBox[{ SubscriptBox["r", "55"], "\[Rule]", "0.5264655098062567`"}], ",", RowBox[{ SubscriptBox["r", "56"], "\[Rule]", "0.42997804869200884`"}], ",", RowBox[{ SubscriptBox["r", "57"], "\[Rule]", "0.7141887740890048`"}], ",", RowBox[{ SubscriptBox["r", "58"], "\[Rule]", "0.6809609411189085`"}], ",", RowBox[{ SubscriptBox["r", "59"], "\[Rule]", "0.5435184949094495`"}], ",", RowBox[{ SubscriptBox["r", "60"], "\[Rule]", "0.513557289690652`"}], ",", RowBox[{ SubscriptBox["r", "61"], "\[Rule]", "0.5001968326994806`"}], ",", RowBox[{ SubscriptBox["r", "62"], "\[Rule]", "0.48020216269269306`"}], ",", RowBox[{ SubscriptBox["r", "63"], "\[Rule]", "0.6151498330400885`"}], ",", RowBox[{ SubscriptBox["r", "64"], "\[Rule]", "0.4022470914087933`"}], ",", RowBox[{ SubscriptBox["r", "65"], "\[Rule]", "0.6508545067445954`"}], ",", RowBox[{ SubscriptBox["r", "66"], "\[Rule]", "0.4440077949092315`"}], ",", RowBox[{ SubscriptBox["r", "67"], "\[Rule]", "0.6263156823659958`"}], ",", RowBox[{ SubscriptBox["r", "68"], "\[Rule]", "0.6220534578256649`"}], ",", RowBox[{ SubscriptBox["r", "69"], "\[Rule]", "0.6001174475701403`"}], ",", RowBox[{ SubscriptBox["r", "70"], "\[Rule]", "0.5398175979022181`"}], ",", RowBox[{ SubscriptBox["r", "71"], "\[Rule]", "0.5931763519644501`"}], ",", RowBox[{ SubscriptBox["r", "72"], "\[Rule]", "0.7314004889545076`"}], ",", RowBox[{ SubscriptBox["r", "73"], "\[Rule]", "0.5467747025124614`"}], ",", RowBox[{ SubscriptBox["r", "74"], "\[Rule]", "0.641332724695423`"}], ",", RowBox[{ SubscriptBox["r", "75"], "\[Rule]", "0.5928603654513067`"}], ",", RowBox[{ SubscriptBox["r", "76"], "\[Rule]", "0.5622484824653944`"}], ",", RowBox[{ SubscriptBox["r", "77"], "\[Rule]", "0.7645395057629646`"}], ",", RowBox[{ SubscriptBox["r", "78"], "\[Rule]", "0.5468407518420171`"}], ",", RowBox[{ SubscriptBox["r", "79"], "\[Rule]", "0.706654432969498`"}], ",", RowBox[{ SubscriptBox["r", "80"], "\[Rule]", "0.715390949616049`"}], ",", RowBox[{ SubscriptBox["r", "81"], "\[Rule]", "0.3987986718606133`"}], ",", RowBox[{ SubscriptBox["r", "82"], "\[Rule]", "0.5274229854738272`"}], ",", RowBox[{ SubscriptBox["r", "83"], "\[Rule]", "0.4673912253703013`"}], ",", RowBox[{ SubscriptBox["r", "84"], "\[Rule]", "0.4846991290143163`"}], ",", RowBox[{ SubscriptBox["r", "85"], "\[Rule]", "0.7342901872310574`"}], ",", RowBox[{ SubscriptBox["r", "86"], "\[Rule]", "0.614467219706121`"}], ",", RowBox[{ SubscriptBox["r", "87"], "\[Rule]", "0.5890987211190156`"}], ",", RowBox[{ SubscriptBox["r", "88"], "\[Rule]", "0.5874822777517011`"}], ",", RowBox[{ SubscriptBox["r", "89"], "\[Rule]", "0.719195521777999`"}], ",", RowBox[{ SubscriptBox["r", "90"], "\[Rule]", "0.7769821182943265`"}], ",", RowBox[{ SubscriptBox["r", "91"], "\[Rule]", "0.5706788601375302`"}], ",", RowBox[{ SubscriptBox["r", "92"], "\[Rule]", "0.5835881017530483`"}], ",", RowBox[{ SubscriptBox["r", "93"], "\[Rule]", "0.8575194968733927`"}], ",", RowBox[{ SubscriptBox["r", "94"], "\[Rule]", "0.40874117604593785`"}], ",", RowBox[{ SubscriptBox["r", "95"], "\[Rule]", "0.8099448654716979`"}], ",", RowBox[{ SubscriptBox["r", "96"], "\[Rule]", "0.8108737053044357`"}], ",", RowBox[{ SubscriptBox["r", "97"], "\[Rule]", "0.7429800790320626`"}], ",", RowBox[{ SubscriptBox["r", "98"], "\[Rule]", "0.8232073180373982`"}], ",", RowBox[{ SubscriptBox["r", "99"], "\[Rule]", "0.6980036588028642`"}]}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.6065667897636623`*^9, 3.627933717044712*^9, 3.636048326517118*^9}] }, Open ]], Cell["M2b*", "Text", CellChangeTimes->{{3.606566577143504*^9, 3.60656657908672*^9}, { 3.636048316927557*^9, 3.63604831772762*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{"init2be3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"B0", ",", RowBox[{ RowBox[{"B", "/", "2"}], "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"B1", ",", RowBox[{ RowBox[{"2", "B"}], "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]", ",", RowBox[{"\[Epsilon]", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]WS", ",", RowBox[{"\[Epsilon]WS", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]SW", ",", RowBox[{"\[Epsilon]SW", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"f", ",", "0.9"}], "}"}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"cons2be3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]WS", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]SW", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "f", "\[LessEqual]", "1"}], ",", RowBox[{"B0", "<", "B1"}]}], "}"}], ",", RowBox[{"Take", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", RowBox[{"{", RowBox[{"2", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"M2be3", "=", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik2berr3", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "B0", ",", "B1", ",", "f", ",", "tabcoef", ",", "\[Epsilon]", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "cons2be3"}], "}"}], ",", "init2be3", ",", RowBox[{"AccuracyGoal", "\[Rule]", "6"}], ",", RowBox[{"MaxIterations", "\[Rule]", "1000"}]}], "]"}]}]}], "Input", CellChangeTimes->{{3.5642577241235847`*^9, 3.564257749704468*^9}, { 3.5642578206053534`*^9, 3.564257824227219*^9}, {3.564257894510888*^9, 3.564257920556471*^9}, {3.564258085258842*^9, 3.5642581876178913`*^9}, { 3.564258437640936*^9, 3.564258451734435*^9}, {3.5642584918053417`*^9, 3.564258562844203*^9}, {3.564258714773546*^9, 3.56425884308426*^9}, { 3.564258913465157*^9, 3.564258919025383*^9}, {3.5642595973546877`*^9, 3.564259597738083*^9}, {3.564259769334746*^9, 3.564259839905995*^9}, { 3.564260349531742*^9, 3.5642603571948977`*^9}, {3.56426040695984*^9, 3.5642606000949306`*^9}, {3.564390716440209*^9, 3.564390721051715*^9}, { 3.564390868789227*^9, 3.5643908814673634`*^9}, {3.5643909181864567`*^9, 3.564390947606907*^9}, {3.564390989749899*^9, 3.564390991974864*^9}, { 3.56439129718023*^9, 3.564391297415978*^9}, {3.564418884264182*^9, 3.564418896958001*^9}, {3.5644190406825743`*^9, 3.564419044996611*^9}, { 3.564419102123251*^9, 3.564419105456602*^9}, {3.5644191647086782`*^9, 3.564419172099958*^9}, {3.5644193422987967`*^9, 3.5644193452088842`*^9}, { 3.564420558146777*^9, 3.564420562328792*^9}, {3.564420598667795*^9, 3.564420599625935*^9}, {3.564420749874487*^9, 3.564420760079729*^9}, { 3.5644214018364162`*^9, 3.5644214155825233`*^9}, {3.564421493825964*^9, 3.56442149872165*^9}, {3.56442158005374*^9, 3.5644216371845703`*^9}, { 3.5644662771195908`*^9, 3.5644662940731993`*^9}, {3.564466482946065*^9, 3.564466486536077*^9}, {3.564467640548579*^9, 3.564467674601096*^9}, { 3.564467707383567*^9, 3.56446772273847*^9}, {3.56446775857195*^9, 3.564467765860962*^9}, {3.564469085717156*^9, 3.56446908602992*^9}, { 3.5644691689721746`*^9, 3.5644691910167913`*^9}, {3.564469248212188*^9, 3.564469290489394*^9}, {3.564469330033928*^9, 3.56446935534626*^9}, { 3.565038133678452*^9, 3.565038149395665*^9}, {3.565038294538906*^9, 3.565038350024108*^9}, {3.56667552150385*^9, 3.5666755592120037`*^9}, { 3.566675979480361*^9, 3.56667603759625*^9}, 3.566676091298222*^9, 3.567785844424178*^9, {3.5677860084152327`*^9, 3.567786022172352*^9}, 3.567786088825808*^9, {3.5677861479502497`*^9, 3.567786154243649*^9}, 3.567786209723259*^9, {3.56778655514825*^9, 3.567786634322435*^9}, { 3.567786821010351*^9, 3.567786920708294*^9}, 3.567834539205043*^9, { 3.5687172514401207`*^9, 3.5687172536768847`*^9}, {3.568717451082345*^9, 3.568717465021495*^9}, {3.568718207188142*^9, 3.5687182097529383`*^9}, { 3.568719318986308*^9, 3.5687193939342737`*^9}, {3.568720389261157*^9, 3.568720393794636*^9}, {3.5687204381095467`*^9, 3.568720516095132*^9}, { 3.572937320373774*^9, 3.572937337248168*^9}, {3.593454304633361*^9, 3.593454334060339*^9}, {3.593454386151325*^9, 3.5934543928149567`*^9}, 3.593837615960013*^9, {3.6065664971951437`*^9, 3.606566528499823*^9}, { 3.606566589387878*^9, 3.6065666320146217`*^9}, {3.606578950758459*^9, 3.606578963964335*^9}, {3.606579003241955*^9, 3.6065790218485126`*^9}, { 3.606579359083378*^9, 3.606579361353706*^9}, {3.606580657217044*^9, 3.606580657388421*^9}, 3.636049697316311*^9}], Cell[BoxData[ RowBox[{"{", RowBox[{ RowBox[{"-", "921.0826776124777`"}], ",", RowBox[{"{", RowBox[{ RowBox[{"B0", "\[Rule]", RowBox[{"-", "754724.0219673376`"}]}], ",", RowBox[{"B1", "\[Rule]", "0.6306272891353204`"}], ",", RowBox[{"f", "\[Rule]", "0.9939668048520196`"}], ",", RowBox[{"\[Epsilon]", "\[Rule]", "0.018636336621099443`"}], ",", RowBox[{"\[Epsilon]SW", "\[Rule]", "0.0052753434929652945`"}], ",", RowBox[{"\[Epsilon]WS", "\[Rule]", "0.022170207762125273`"}], ",", RowBox[{"\[Theta]", "\[Rule]", "1422.3627494137545`"}], ",", RowBox[{"\[Theta]WS", "\[Rule]", "3454.033723979549`"}], ",", RowBox[{"\[Lambda]", "\[Rule]", "1.8942988914577144`"}], ",", RowBox[{ SubscriptBox["r", "2"], "\[Rule]", "1.1359399421957166`"}], ",", RowBox[{ SubscriptBox["r", "3"], "\[Rule]", "1.2132365829428122`"}], ",", RowBox[{ SubscriptBox["r", "4"], "\[Rule]", "1.1804261359170314`"}], ",", RowBox[{ SubscriptBox["r", "5"], "\[Rule]", "1.2203479966627553`"}], ",", RowBox[{ SubscriptBox["r", "6"], "\[Rule]", "0.9965278611855886`"}], ",", RowBox[{ SubscriptBox["r", "7"], "\[Rule]", "1.1644415882589367`"}], ",", RowBox[{ SubscriptBox["r", "8"], "\[Rule]", "1.1226857919615163`"}], ",", RowBox[{ SubscriptBox["r", "9"], "\[Rule]", "1.1130623030141398`"}], ",", RowBox[{ SubscriptBox["r", "10"], "\[Rule]", "1.0722557886011632`"}], ",", RowBox[{ SubscriptBox["r", "11"], "\[Rule]", "1.0740507655515164`"}], ",", RowBox[{ SubscriptBox["r", "12"], "\[Rule]", "1.0383947010329753`"}], ",", RowBox[{ SubscriptBox["r", "13"], "\[Rule]", "0.9273450354467029`"}], ",", RowBox[{ SubscriptBox["r", "14"], "\[Rule]", "0.9562935460883591`"}], ",", RowBox[{ SubscriptBox["r", "15"], "\[Rule]", "0.9730948821702825`"}], ",", RowBox[{ SubscriptBox["r", "16"], "\[Rule]", "0.9191290875435782`"}], ",", RowBox[{ SubscriptBox["r", "17"], "\[Rule]", "0.9859457085845047`"}], ",", RowBox[{ SubscriptBox["r", "18"], "\[Rule]", "0.9532328998328551`"}], ",", RowBox[{ SubscriptBox["r", "19"], "\[Rule]", "0.5883513828341365`"}], ",", RowBox[{ SubscriptBox["r", "20"], "\[Rule]", "0.7921627593312305`"}], ",", RowBox[{ SubscriptBox["r", "21"], "\[Rule]", "0.9013260867909321`"}], ",", RowBox[{ SubscriptBox["r", "22"], "\[Rule]", "0.9087563490216887`"}], ",", RowBox[{ SubscriptBox["r", "23"], "\[Rule]", "0.8681253891244609`"}], ",", RowBox[{ SubscriptBox["r", "24"], "\[Rule]", "0.9109117511164027`"}], ",", RowBox[{ SubscriptBox["r", "25"], "\[Rule]", "0.7712239332883165`"}], ",", RowBox[{ SubscriptBox["r", "26"], "\[Rule]", "0.9884997794524293`"}], ",", RowBox[{ SubscriptBox["r", "27"], "\[Rule]", "0.8683838898917452`"}], ",", RowBox[{ SubscriptBox["r", "28"], "\[Rule]", "0.6213112381471332`"}], ",", RowBox[{ SubscriptBox["r", "29"], "\[Rule]", "0.5993101164095778`"}], ",", RowBox[{ SubscriptBox["r", "30"], "\[Rule]", "0.8603921456430532`"}], ",", RowBox[{ SubscriptBox["r", "31"], "\[Rule]", "0.5842399498438484`"}], ",", RowBox[{ SubscriptBox["r", "32"], "\[Rule]", "0.8689594451643154`"}], ",", RowBox[{ SubscriptBox["r", "33"], "\[Rule]", "0.705629027058164`"}], ",", RowBox[{ SubscriptBox["r", "34"], "\[Rule]", "0.7606180172202234`"}], ",", RowBox[{ SubscriptBox["r", "35"], "\[Rule]", "0.7876961702710973`"}], ",", RowBox[{ SubscriptBox["r", "36"], "\[Rule]", "0.8241165842574788`"}], ",", RowBox[{ SubscriptBox["r", "37"], "\[Rule]", "0.6189530441389118`"}], ",", RowBox[{ SubscriptBox["r", "38"], "\[Rule]", "0.732645371706147`"}], ",", RowBox[{ SubscriptBox["r", "39"], "\[Rule]", "0.8210881281576596`"}], ",", RowBox[{ SubscriptBox["r", "40"], "\[Rule]", "0.6150610367898035`"}], ",", RowBox[{ SubscriptBox["r", "41"], "\[Rule]", "0.5334885670141403`"}], ",", RowBox[{ SubscriptBox["r", "42"], "\[Rule]", "0.5789699433501284`"}], ",", RowBox[{ SubscriptBox["r", "43"], "\[Rule]", "0.6682044538120426`"}], ",", RowBox[{ SubscriptBox["r", "44"], "\[Rule]", "0.539946569179884`"}], ",", RowBox[{ SubscriptBox["r", "45"], "\[Rule]", "0.6020722508749226`"}], ",", RowBox[{ SubscriptBox["r", "46"], "\[Rule]", "0.6227056291821698`"}], ",", RowBox[{ SubscriptBox["r", "47"], "\[Rule]", "0.41890726643277054`"}], ",", RowBox[{ SubscriptBox["r", "48"], "\[Rule]", "0.4972438593974732`"}], ",", RowBox[{ SubscriptBox["r", "49"], "\[Rule]", "0.6177195093465615`"}], ",", RowBox[{ SubscriptBox["r", "50"], "\[Rule]", "0.47246371457767977`"}], ",", RowBox[{ SubscriptBox["r", "51"], "\[Rule]", "0.5617731370109875`"}], ",", RowBox[{ SubscriptBox["r", "52"], "\[Rule]", "0.5915021993519044`"}], ",", RowBox[{ SubscriptBox["r", "53"], "\[Rule]", "0.705009832074263`"}], ",", RowBox[{ SubscriptBox["r", "54"], "\[Rule]", "0.5694594085314377`"}], ",", RowBox[{ SubscriptBox["r", "55"], "\[Rule]", "0.5276446274755426`"}], ",", RowBox[{ SubscriptBox["r", "56"], "\[Rule]", "0.43125402457422407`"}], ",", RowBox[{ SubscriptBox["r", "57"], "\[Rule]", "0.7194823184981648`"}], ",", RowBox[{ SubscriptBox["r", "58"], "\[Rule]", "0.6878374638626232`"}], ",", RowBox[{ SubscriptBox["r", "59"], "\[Rule]", "0.5492316871377243`"}], ",", RowBox[{ SubscriptBox["r", "60"], "\[Rule]", "0.5186390986842891`"}], ",", RowBox[{ SubscriptBox["r", "61"], "\[Rule]", "0.5033696072187612`"}], ",", RowBox[{ SubscriptBox["r", "62"], "\[Rule]", "0.484859775117127`"}], ",", RowBox[{ SubscriptBox["r", "63"], "\[Rule]", "0.6258778580604042`"}], ",", RowBox[{ SubscriptBox["r", "64"], "\[Rule]", "0.4045547149286072`"}], ",", RowBox[{ SubscriptBox["r", "65"], "\[Rule]", "0.6628118991887071`"}], ",", RowBox[{ SubscriptBox["r", "66"], "\[Rule]", "0.44972459911820073`"}], ",", RowBox[{ SubscriptBox["r", "67"], "\[Rule]", "0.6405842979940557`"}], ",", RowBox[{ SubscriptBox["r", "68"], "\[Rule]", "0.6349249657242865`"}], ",", RowBox[{ SubscriptBox["r", "69"], "\[Rule]", "0.6174338866827981`"}], ",", RowBox[{ SubscriptBox["r", "70"], "\[Rule]", "0.5508713049479029`"}], ",", RowBox[{ SubscriptBox["r", "71"], "\[Rule]", "0.6124930809916442`"}], ",", RowBox[{ SubscriptBox["r", "72"], "\[Rule]", "0.758779671734238`"}], ",", RowBox[{ SubscriptBox["r", "73"], "\[Rule]", "0.5605793717946453`"}], ",", RowBox[{ SubscriptBox["r", "74"], "\[Rule]", "0.659121811259206`"}], ",", RowBox[{ SubscriptBox["r", "75"], "\[Rule]", "0.6129600460137916`"}], ",", RowBox[{ SubscriptBox["r", "76"], "\[Rule]", "0.5782279891703532`"}], ",", RowBox[{ SubscriptBox["r", "77"], "\[Rule]", "0.7958965715861034`"}], ",", RowBox[{ SubscriptBox["r", "78"], "\[Rule]", "0.5625618523622123`"}], ",", RowBox[{ SubscriptBox["r", "79"], "\[Rule]", "0.7353033618799922`"}], ",", RowBox[{ SubscriptBox["r", "80"], "\[Rule]", "0.7489371380030231`"}], ",", RowBox[{ SubscriptBox["r", "81"], "\[Rule]", "0.4135148725695353`"}], ",", RowBox[{ SubscriptBox["r", "82"], "\[Rule]", "0.5414244820102097`"}], ",", RowBox[{ SubscriptBox["r", "83"], "\[Rule]", "0.47432477862655814`"}], ",", RowBox[{ SubscriptBox["r", "84"], "\[Rule]", "0.495124553415125`"}], ",", RowBox[{ SubscriptBox["r", "85"], "\[Rule]", "0.7655757649461059`"}], ",", RowBox[{ SubscriptBox["r", "86"], "\[Rule]", "0.6343736870515857`"}], ",", RowBox[{ SubscriptBox["r", "87"], "\[Rule]", "0.6053193536415413`"}], ",", RowBox[{ SubscriptBox["r", "88"], "\[Rule]", "0.5955429766672288`"}], ",", RowBox[{ SubscriptBox["r", "89"], "\[Rule]", "0.7374426878243203`"}], ",", RowBox[{ SubscriptBox["r", "90"], "\[Rule]", "0.7947609716256491`"}], ",", RowBox[{ SubscriptBox["r", "91"], "\[Rule]", "0.5557449369833648`"}], ",", RowBox[{ SubscriptBox["r", "92"], "\[Rule]", "0.5612743791371176`"}], ",", RowBox[{ SubscriptBox["r", "93"], "\[Rule]", "0.8469864060058684`"}], ",", RowBox[{ SubscriptBox["r", "94"], "\[Rule]", "0.3456091401234224`"}], ",", RowBox[{ SubscriptBox["r", "95"], "\[Rule]", "0.7355958295064909`"}], ",", RowBox[{ SubscriptBox["r", "96"], "\[Rule]", "0.6821685066193071`"}], ",", RowBox[{ SubscriptBox["r", "97"], "\[Rule]", "0.5239289009795558`"}], ",", RowBox[{ SubscriptBox["r", "98"], "\[Rule]", "0.4735620746262264`"}], ",", RowBox[{ SubscriptBox["r", "99"], "\[Rule]", "1.0144480666766471`*^-8"}]}], "}"}]}], "}"}]], "Output", CellChangeTimes->{3.606580677213365*^9, 3.627933746924046*^9, 3.636048338668231*^9}] }, Open ]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell["\<\ Batch analyses of 1KG dataset - by windows\ \>", "Section", CellChangeTimes->{{3.564231098812359*^9, 3.5642311002964582`*^9}, { 3.564464863801774*^9, 3.564464871743882*^9}, {3.56459578377185*^9, 3.564595789935944*^9}, {3.572107799774447*^9, 3.572107803014323*^9}}], Cell[CellGroupData[{ Cell["1KG datasets", "Subsection", CellChangeTimes->{{3.5642568869165573`*^9, 3.564256894138021*^9}}], Cell[CellGroupData[{ Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{ "SetDirectory", "[", "\"\\"", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Replace", " ", "by", " ", "your", " ", "path"}], "*)"}]}], "\n", RowBox[{ RowBox[{"filename", "=", "\"\\""}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"file", "=", RowBox[{"filename", "<>", "\"\<.sfs\>\""}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"infile", "=", RowBox[{"Import", "[", RowBox[{"file", ",", "\"\\""}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"header", "=", RowBox[{"infile", "[", RowBox[{"[", "1", "]"}], "]"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"rawdata", "=", RowBox[{"Drop", "[", RowBox[{"infile", ",", "1"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"data", "=", RowBox[{"SortBy", "[", RowBox[{"rawdata", ",", RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"#", "[", RowBox[{"[", "1", "]"}], "]"}], "&"}], ",", RowBox[{ RowBox[{"#", "[", RowBox[{"[", "2", "]"}], "]"}], "&"}], ",", RowBox[{ RowBox[{"#", "[", RowBox[{"[", "3", "]"}], "]"}], "&"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"(*", RowBox[{ RowBox[{ "Sorting", " ", "the", " ", "dataset", " ", "to", " ", "be", " ", "sure", " ", "to", " ", "always", " ", "have", " ", "the", " ", "same", " ", RowBox[{"order", ":", " ", "Neutral"}]}], ",", " ", "WS", ",", "SW"}], "*)"}]}]}], "Input", CellChangeTimes->{{3.564256897689398*^9, 3.564256900970648*^9}, { 3.564256970231111*^9, 3.564257100847323*^9}, {3.564421650997624*^9, 3.564421651314232*^9}, {3.5644217488540573`*^9, 3.564421749276312*^9}, { 3.564477392756097*^9, 3.564477393078063*^9}, {3.5645959379749613`*^9, 3.564595938565783*^9}, {3.564651273721716*^9, 3.5646512743497543`*^9}, { 3.564678804594552*^9, 3.5646788079363003`*^9}, {3.564736361909131*^9, 3.564736365089426*^9}, {3.565001240596171*^9, 3.5650012410679893`*^9}, 3.5665650316071997`*^9, 3.5665650794652777`*^9, {3.566565201427243*^9, 3.5665652148572893`*^9}, {3.5665652660800467`*^9, 3.566565268076853*^9}, 3.5665773549157457`*^9, {3.566577425069697*^9, 3.566577463959676*^9}, { 3.566577678297639*^9, 3.566577679447592*^9}, {3.566583220875112*^9, 3.566583221438637*^9}, {3.566585903761466*^9, 3.566585904374092*^9}, { 3.566628368634087*^9, 3.566628376673265*^9}, {3.566629274009572*^9, 3.5666292785864363`*^9}, {3.566638508073452*^9, 3.566638517126606*^9}, { 3.56666337429722*^9, 3.566663389387981*^9}, {3.566666134295*^9, 3.566666139012691*^9}, {3.5666695904124126`*^9, 3.566669591006765*^9}, { 3.566672067325637*^9, 3.56667208055881*^9}, {3.566672957388056*^9, 3.5666729586475782`*^9}, {3.567158256554132*^9, 3.5671582756453743`*^9}, { 3.5671607921433163`*^9, 3.567160792389234*^9}, {3.56718286921067*^9, 3.56718288357099*^9}, {3.5671865531741333`*^9, 3.5671865671544657`*^9}, { 3.5671866344318047`*^9, 3.56718663735026*^9}, {3.56718909801475*^9, 3.5671890988687763`*^9}, {3.567189169866296*^9, 3.56718917047222*^9}, { 3.567189202280449*^9, 3.567189203893825*^9}, {3.567272620052313*^9, 3.567272626082601*^9}, {3.567787784857572*^9, 3.567787796580543*^9}, { 3.567874049316682*^9, 3.567874054374078*^9}, {3.568956821173686*^9, 3.568956821576655*^9}, {3.5689568626283216`*^9, 3.568956869738954*^9}, { 3.572109605361129*^9, 3.572109607180985*^9}, {3.572799103942095*^9, 3.5727991044523563`*^9}, {3.572799153710836*^9, 3.572799154836667*^9}, { 3.572979345647356*^9, 3.572979348719268*^9}, {3.572979525149105*^9, 3.572979525991453*^9}, {3.572979610788735*^9, 3.5729796120391283`*^9}, { 3.572979907807584*^9, 3.5729799204953136`*^9}, {3.594450447252812*^9, 3.594450449683289*^9}, {3.594455387404677*^9, 3.5944553876289377`*^9}, { 3.594542785109128*^9, 3.594542808262731*^9}, {3.5946092217605343`*^9, 3.594609222051128*^9}, 3.5946561179446573`*^9, {3.594656173851289*^9, 3.594656184065894*^9}, {3.5947092304177713`*^9, 3.594709233662362*^9}, { 3.5947445112075977`*^9, 3.5947445113698*^9}, {3.6015771645716677`*^9, 3.601577205361207*^9}, {3.604643868865712*^9, 3.604643876890901*^9}, { 3.609526020008062*^9, 3.609526023158188*^9}, {3.609666555796207*^9, 3.609666557142672*^9}, {3.609736927579123*^9, 3.609736933530569*^9}, { 3.609939342190461*^9, 3.609939347559832*^9}, {3.609939676297819*^9, 3.6099396780108643`*^9}, {3.610897256928137*^9, 3.6108972591656523`*^9}, { 3.6270321707434063`*^9, 3.627032180743888*^9}, {3.6273627098328648`*^9, 3.627362716369837*^9}, 3.6273627751252623`*^9, {3.627443958657436*^9, 3.627443996319121*^9}, {3.627460666400475*^9, 3.6274606699593983`*^9}, { 3.6275849885978727`*^9, 3.6275849958382797`*^9}, {3.6276308012505713`*^9, 3.627630802081779*^9}, {3.627818327125558*^9, 3.6278183291843843`*^9}, { 3.62781837742601*^9, 3.62781838438378*^9}, {3.629867736394743*^9, 3.629867745082003*^9}, {3.630059637541193*^9, 3.630059666829789*^9}, { 3.630059825295796*^9, 3.6300598527193747`*^9}, {3.630122260344906*^9, 3.630122285846784*^9}, 3.630122334408626*^9, {3.630998650720767*^9, 3.63099865711957*^9}, {3.631165598942795*^9, 3.631165602932115*^9}, { 3.631287874830538*^9, 3.6312879106861877`*^9}, 3.63128807027134*^9, { 3.63604977774209*^9, 3.636049911886869*^9}, {3.636135873571185*^9, 3.636135899841917*^9}, {3.636136102935809*^9, 3.636136116687954*^9}}], Cell[BoxData[ RowBox[{"{", RowBox[{"\<\"Chrom\"\>", ",", "\<\"Pos\"\>", ",", "\<\"ClassWS\"\>", ",", "\<\"dTel\"\>", ",", "\<\"dCen\"\>", ",", "\<\"localGC_100bp\"\>", ",", "\<\"HMrec_5kb\"\>", ",", "\<\"COmale100kb\"\>", ",", "\<\"COfemale100kb\"\>", ",", "\<\"HMrec_100kb\"\>", ",", "\<\"localGC_100kb\"\>", ",", "\<\"localGC_1Mb\"\>", ",", "\<\"MethFrq2000bp\"\>", ",", "\<\"MethCov2000bp\"\>", ",", "\<\"GCstat_hum10000bp\"\>", ",", "\<\"NbWS_SW_hum10000bp\"\>", ",", "\<\"localGC_10kb\"\>", ",", "\<\"HMrec_10kb\"\>", ",", "\<\"rec1KG_YRI.1Mb\"\>", ",", "\<\"rec1KG_CEU.1Mb\"\>", ",", "\<\"rec1KG_CHBJPT.1Mb\"\>", ",", "\<\"rec1KG_YRI.5kb\"\>", ",", "\<\"rec1KG_CEU.5kb\"\>", ",", "\<\"rec1KG_CHBJPT.5kb\"\>", ",", "\<\"COmale1Mb\"\>", ",", "\<\"COfemale1Mb\"\>", ",", "\<\"COmale10kb\"\>", ",", "\<\"COfemale10kb\"\>", ",", "\<\"COmale5kb\"\>", ",", "\<\"COfemale5kb\"\>", ",", "\<\"DSB_ABC_1Mb\"\>", ",", "\<\"DSB_AB_1Mb\"\>", ",", "\<\"DSB_C_1Mb\"\>", ",", "\<\"DSB_ABC_5kb\"\>", ",", "\<\"DSB_AB_5kb\"\>", ",", "\<\"DSB_C_5kb\"\>", ",", "\<\"fCE_1kb\"\>", ",", "\<\"fCE_5kb\"\>", ",", "\<\"fCE_100kb\"\>", ",", "\<\"fCE_20kb\"\>", ",", "\<\"window\"\>", ",", "\<\"X1\"\>", ",", "\<\"X2\"\>", ",", "\<\"X3\"\>", ",", "\<\"X4\"\>", ",", "\<\"X5\"\>", ",", "\<\"X6\"\>", ",", "\<\"X7\"\>", ",", "\<\"X8\"\>", ",", "\<\"X9\"\>", ",", "\<\"X10\"\>", ",", "\<\"X11\"\>", ",", "\<\"X12\"\>", ",", "\<\"X13\"\>", ",", "\<\"X14\"\>", ",", "\<\"X15\"\>", ",", "\<\"X16\"\>", ",", "\<\"X17\"\>", ",", "\<\"X18\"\>", ",", "\<\"X19\"\>", ",", "\<\"X20\"\>", ",", "\<\"X21\"\>", ",", "\<\"X22\"\>", ",", "\<\"X23\"\>", ",", "\<\"X24\"\>", ",", "\<\"X25\"\>", ",", "\<\"X26\"\>", ",", "\<\"X27\"\>", ",", "\<\"X28\"\>", ",", "\<\"X29\"\>", ",", "\<\"X30\"\>", ",", "\<\"X31\"\>", ",", "\<\"X32\"\>", ",", "\<\"X33\"\>", ",", "\<\"X34\"\>", ",", "\<\"X35\"\>", ",", "\<\"X36\"\>", ",", "\<\"X37\"\>", ",", "\<\"X38\"\>", ",", "\<\"X39\"\>", ",", "\<\"X40\"\>", ",", "\<\"X41\"\>", ",", "\<\"X42\"\>", ",", "\<\"X43\"\>", ",", "\<\"X44\"\>", ",", "\<\"X45\"\>", ",", "\<\"X46\"\>", ",", "\<\"X47\"\>", ",", "\<\"X48\"\>", ",", "\<\"X49\"\>", ",", "\<\"X50\"\>", ",", "\<\"X51\"\>", ",", "\<\"X52\"\>", ",", "\<\"X53\"\>", ",", "\<\"X54\"\>", ",", "\<\"X55\"\>", ",", "\<\"X56\"\>", ",", "\<\"X57\"\>", ",", "\<\"X58\"\>", ",", "\<\"X59\"\>", ",", "\<\"X60\"\>", ",", "\<\"X61\"\>", ",", "\<\"X62\"\>", ",", "\<\"X63\"\>", ",", "\<\"X64\"\>", ",", "\<\"X65\"\>", ",", "\<\"X66\"\>", ",", "\<\"X67\"\>", ",", "\<\"X68\"\>", ",", "\<\"X69\"\>", ",", "\<\"X70\"\>", ",", "\<\"X71\"\>", ",", "\<\"X72\"\>", ",", "\<\"X73\"\>", ",", "\<\"X74\"\>", ",", "\<\"X75\"\>", ",", "\<\"X76\"\>", ",", "\<\"X77\"\>", ",", "\<\"X78\"\>", ",", "\<\"X79\"\>", ",", "\<\"X80\"\>", ",", "\<\"X81\"\>", ",", "\<\"X82\"\>", ",", "\<\"X83\"\>", ",", "\<\"X84\"\>", ",", "\<\"X85\"\>", ",", "\<\"X86\"\>", ",", "\<\"X87\"\>", ",", "\<\"X88\"\>", ",", "\<\"X89\"\>", ",", "\<\"X90\"\>", ",", "\<\"X91\"\>", ",", "\<\"X92\"\>", ",", "\<\"X93\"\>", ",", "\<\"X94\"\>", ",", "\<\"X95\"\>", ",", "\<\"X96\"\>", ",", "\<\"X97\"\>", ",", "\<\"X98\"\>", ",", "\<\"X99\"\>", ",", "\<\"Start\"\>", ",", "\<\"End\"\>", ",", "\<\"RecHM22\"\>", ",", "\<\"GC\"\>", ",", "\<\"LgNoN\"\>", ",", "\<\"hot_numHM22\"\>", ",", "\<\"hot_recHM22\"\>", ",", "\<\"hot_lgHM22\"\>", ",", "\<\"RecYRI\"\>", ",", "\<\"hot_numYRI\"\>", ",", "\<\"hot_lgYRI\"\>", ",", "\<\"hot_recYRI\"\>", ",", "\<\"cold_recYRI\"\>", ",", "\<\"frac_hotYRI\"\>", ",", "\<\"RecCHBJPT\"\>", ",", "\<\"hot_numCHBJPT\"\>", ",", "\<\"hot_lgCHBJPT\"\>", ",", "\<\"hot_recCHBJPT\"\>", ",", "\<\"cold_recCHBJPT\"\>", ",", "\<\"frac_hotCHBJPT\"\>", ",", "\<\"RecCEU\"\>", ",", "\<\"hot_numCEU\"\>", ",", "\<\"hot_lgCEU\"\>", ",", "\<\"hot_recCEU\"\>", ",", "\<\"cold_recCEU\"\>", ",", "\<\"frac_hotCEU\"\>", ",", "\<\"RecHMT6\"\>", ",", "\<\"hot_numHMT6\"\>", ",", "\<\"hot_lgHMT6\"\>", ",", "\<\"hot_recHMT6\"\>", ",", "\<\"cold_recHMT6\"\>", ",", "\<\"frac_hotHMT6\"\>", ",", "\<\"frac_hotHM22\"\>", ",", "\<\"cold_recHM22\"\>", ",", "\<\"rhoHMT6\"\>", ",", "\<\"rhoYRI\"\>", ",", "\<\"rhoCEU\"\>", ",", "\<\"rhoCHBJPT\"\>", ",", "\<\"rhoHM22\"\>"}], "}"}]], "Output", CellChangeTimes->{ 3.636135055976267*^9, {3.636135894587837*^9, 3.636135900862657*^9}, 3.636136013541925*^9, 3.636136072518105*^9}] }, Open ]], Cell[BoxData[ RowBox[{ RowBox[{"initdata", "[", "i_", "]"}], " ", ":=", " ", RowBox[{"{", "\[IndentingNewLine]", RowBox[{"(*", "Spectra", "*)"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"X1", "=", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"X99", "=", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"tabN", "=", " ", RowBox[{"Take", "[", RowBox[{ RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{"3", " ", RowBox[{"(", RowBox[{"i", " ", "-", " ", "1"}], ")"}]}], " ", "+", " ", "1"}], "]"}], "]"}], ",", " ", RowBox[{"{", RowBox[{"X1", ",", "X99"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"tabSW", " ", "=", " ", RowBox[{"Take", "[", RowBox[{ RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{"3", " ", RowBox[{"(", RowBox[{"i", " ", "-", " ", "1"}], ")"}]}], " ", "+", " ", "2"}], "]"}], "]"}], ",", " ", RowBox[{"{", RowBox[{"X1", ",", "X99"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"tabWS", " ", "=", " ", RowBox[{"Take", "[", RowBox[{ RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{"3", " ", RowBox[{"(", RowBox[{"i", " ", "-", " ", "1"}], ")"}]}], " ", "+", " ", "3"}], "]"}], "]"}], ",", " ", RowBox[{"{", RowBox[{"X1", ",", "X99"}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Nchrom", "=", RowBox[{ RowBox[{"Length", "[", "tabN", "]"}], "+", "1"}]}], ";", "\[IndentingNewLine]", RowBox[{"tabcoef", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", "1", "}"}], ",", RowBox[{"Array", "[", RowBox[{ RowBox[{ RowBox[{"Subscript", "[", RowBox[{"r", ",", "#1"}], "]"}], "&"}], ",", RowBox[{"Nchrom", "-", "2"}], ",", "2"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Genomic", " ", "data"}], "*)"}], "\[IndentingNewLine]", RowBox[{"chrom", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"pos", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"dtelo", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"dcentro", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"MethFrq2000bp", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"MethCov2000bp", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"pGC", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Recombination", " ", "data"}], "*)"}], "\[IndentingNewLine]", RowBox[{"Rec5kb", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Rec5kbAFR", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Rec5kbEUR", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Rec5kbASI", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fracHotHM22", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ratiorecHM22", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"HotRecHM22", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ColdRecHM22", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fracHotHMT6", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ratiorecHMT6", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"HotRecHMT6", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ColdRecHMT6", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fracHotPop", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ratiorecPop", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"HotRecPop", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"ColdRecPop", "=", RowBox[{"data", "[", RowBox[{"[", RowBox[{ RowBox[{ RowBox[{"3", RowBox[{"(", RowBox[{"i", "-", "1"}], ")"}]}], "+", "1"}], ",", RowBox[{ RowBox[{"Position", "[", RowBox[{"header", ",", "\"\\""}], "]"}], "[", RowBox[{"[", RowBox[{"1", ",", "1"}], "]"}], "]"}]}], "]"}], "]"}]}], ";"}], "\[IndentingNewLine]", "}"}]}]], "Input", CellChangeTimes->{{3.564597733432832*^9, 3.5645977752388763`*^9}, 3.564598200137896*^9, {3.564598235434861*^9, 3.5645982636209593`*^9}, { 3.564598350619314*^9, 3.564598397975581*^9}, {3.567874159098691*^9, 3.5678741624261637`*^9}, {3.567874283875626*^9, 3.567874287017581*^9}, 3.5678744233630743`*^9, {3.570472135829384*^9, 3.570472143544458*^9}, { 3.5704722659299517`*^9, 3.570472298021316*^9}, {3.5704723533833437`*^9, 3.570472361740859*^9}, {3.5721096325710173`*^9, 3.572109662481513*^9}, { 3.572110027328513*^9, 3.572110085552742*^9}, {3.5721101258247347`*^9, 3.5721101333274727`*^9}, {3.572110810042102*^9, 3.572110970390203*^9}, { 3.5721110073487263`*^9, 3.572111014054043*^9}, {3.572113645695486*^9, 3.572113648414118*^9}, {3.594450456776449*^9, 3.594450457055071*^9}, { 3.5945428329597197`*^9, 3.5945428334174128`*^9}, {3.5946562022302923`*^9, 3.594656207449656*^9}, {3.59470924626012*^9, 3.594709246514844*^9}, { 3.5947093373871813`*^9, 3.594709389655521*^9}, {3.6015772614403753`*^9, 3.601577262796489*^9}, {3.6016172454760647`*^9, 3.601617245960869*^9}, { 3.60161738236023*^9, 3.6016173827766323`*^9}, {3.601617485038629*^9, 3.6016175157640247`*^9}, {3.601617553858082*^9, 3.601617699378196*^9}, { 3.60161773596531*^9, 3.601617775124343*^9}, {3.601617940609865*^9, 3.601618025066238*^9}, {3.6016180908474627`*^9, 3.601618091485772*^9}, { 3.6016181341125937`*^9, 3.6016181529118*^9}, {3.601636317257139*^9, 3.601636384277536*^9}, {3.6016364528587837`*^9, 3.601636464322336*^9}, { 3.60163652249794*^9, 3.601636537515051*^9}, {3.604659757956071*^9, 3.604659798181993*^9}, {3.6095260672102757`*^9, 3.609526253234453*^9}, { 3.6097369691645823`*^9, 3.6097369764212933`*^9}, {3.609737356954011*^9, 3.6097373574245043`*^9}, {3.609738225982328*^9, 3.609738226320417*^9}, 3.6099403789089127`*^9, {3.609940513986741*^9, 3.609940516199913*^9}, { 3.6270331767143383`*^9, 3.627033255421865*^9}, {3.627033289080982*^9, 3.627033292140724*^9}, {3.627033348828405*^9, 3.627033386569167*^9}, { 3.627033417695203*^9, 3.627033432204783*^9}, {3.627033729577442*^9, 3.6270337413190413`*^9}, {3.627033794617168*^9, 3.627033809569339*^9}, { 3.627033845883504*^9, 3.6270339423339853`*^9}, {3.627033975305623*^9, 3.627034181185096*^9}, {3.627034290360148*^9, 3.627034398814281*^9}, { 3.627034442396628*^9, 3.627034453675684*^9}, {3.627035238197044*^9, 3.6270352552945433`*^9}, {3.627035303160303*^9, 3.627035336798253*^9}, { 3.62703676998676*^9, 3.627036771563058*^9}, 3.627036852018591*^9, 3.627362900179928*^9, {3.627376464485401*^9, 3.627376503949101*^9}, { 3.627585012546576*^9, 3.627585022761169*^9}, {3.630059689915917*^9, 3.630059781466906*^9}, {3.630122302773437*^9, 3.630122317967156*^9}, { 3.631165624746059*^9, 3.631165634417769*^9}, {3.631287916829103*^9, 3.631287932339942*^9}, {3.6312884051927156`*^9, 3.6312884277937517`*^9}, { 3.63128856476543*^9, 3.631288568395639*^9}, {3.636049695075593*^9, 3.636049695093306*^9}, {3.636049789671994*^9, 3.636049789921427*^9}}], Cell[BoxData[ RowBox[{"estim", ":=", RowBox[{"{", "\[IndentingNewLine]", RowBox[{ RowBox[{"likemax", "=", RowBox[{"N", "[", RowBox[{"logLikMax", "[", RowBox[{ RowBox[{"tabN", "+", SuperscriptBox["10", RowBox[{"-", "10"}]]}], ",", RowBox[{"tabWS", "+", SuperscriptBox["10", RowBox[{"-", "10"}]]}], ",", RowBox[{"tabSW", "+", SuperscriptBox["10", RowBox[{"-", "10"}]]}]}], "]"}], "]"}]}], ";", RowBox[{"(*", RowBox[{ SuperscriptBox["10", RowBox[{"-", "10"}]], " ", "is", " ", "added", " ", "to", " ", "avoid", " ", "taking", " ", RowBox[{"Log", "[", "0", "]"}], " ", "in", " ", "spectra", " ", "with", " ", "few", " ", "SNPs"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Initial", " ", "value", " ", "for", " ", "fitting", " ", "models"}], "*)"}], "\[IndentingNewLine]", RowBox[{"\[Theta]init", "=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", "tabN"}], "]"}], "/", RowBox[{"HarmonicNumber", "[", "Nchrom", "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"\[Theta]WSinit", "=", RowBox[{ RowBox[{"Apply", "[", RowBox[{"Plus", ",", "tabWS"}], "]"}], "/", RowBox[{"HarmonicNumber", "[", "Nchrom", "]"}]}]}], ";", "\[IndentingNewLine]", RowBox[{"\[Lambda]init", "=", FractionBox[ RowBox[{"pGC", " ", RowBox[{"tabSW", "[", RowBox[{"[", "1", "]"}], "]"}]}], RowBox[{ RowBox[{"(", RowBox[{"1", "-", "pGC"}], ")"}], RowBox[{"tabWS", "[", RowBox[{"[", "1", "]"}], "]"}]}]]}], ";", "\[IndentingNewLine]", RowBox[{"rinit", "=", RowBox[{"Table", "[", RowBox[{"1", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"tabr", "=", "tabN"}], ";", "\[IndentingNewLine]", RowBox[{"For", "[", RowBox[{ RowBox[{"j", "=", "1"}], ",", RowBox[{"j", "\[LessEqual]", RowBox[{"(", RowBox[{"Nchrom", "-", "1"}], ")"}]}], ",", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"tabr", "[", RowBox[{"[", "j", "]"}], "]"}], "=", RowBox[{"Max", "[", RowBox[{"1", ",", RowBox[{"tabN", "[", RowBox[{"[", "j", "]"}], "]"}]}], "]"}]}], "}"}], ";", RowBox[{"j", "++"}]}]}], "]"}], ";", "\[IndentingNewLine]", RowBox[{"rinit", "=", RowBox[{"tabr", " ", RowBox[{ RowBox[{"Range", "[", RowBox[{"Nchrom", "-", "1"}], "]"}], "/", RowBox[{"Max", "[", RowBox[{"1", ",", RowBox[{"tabr", "[", RowBox[{"[", "1", "]"}], "]"}]}], "]"}]}]}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ RowBox[{ "Use", " ", "of", " ", "the", " ", "regression", " ", "approach", " ", "to", " ", "get", " ", "a", " ", "raw", " ", "estimate", " ", "of", " ", "B"}], ",", " ", RowBox[{ "serving", " ", "as", " ", "a", " ", "starting", " ", "point"}]}], "*)"}], "\[IndentingNewLine]", RowBox[{"datafit", "=", RowBox[{"Transpose", "[", RowBox[{"{", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"i", "/", "Nchrom"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}], ",", RowBox[{"Log", "[", RowBox[{ RowBox[{"(", RowBox[{"tabWS", "+", "1"}], ")"}], "/", RowBox[{"(", RowBox[{"tabSW", "+", "1"}], ")"}]}], "]"}]}], "}"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"fit", "=", RowBox[{"NonlinearModelFit", "[", RowBox[{"datafit", ",", RowBox[{ RowBox[{"a", " ", "x"}], "+", "b"}], ",", RowBox[{"{", RowBox[{"a", ",", "b"}], "}"}], ",", "x"}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"Binit", "=", RowBox[{"a", "/.", RowBox[{"fit", "[", "\"\\"", "]"}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", "skewness", "*)"}], "\[IndentingNewLine]", RowBox[{"weight", "=", FractionBox[ RowBox[{"(", RowBox[{"tabWS", "+", RowBox[{"Reverse", "[", "tabSW", "]"}]}], ")"}], RowBox[{"Mean", "[", RowBox[{"(", RowBox[{"tabWS", "+", RowBox[{"Reverse", "[", "tabSW", "]"}]}], ")"}], "]"}]]}], ";", "\[IndentingNewLine]", RowBox[{"meanDAF", "=", RowBox[{ RowBox[{"Mean", "[", RowBox[{"weight", " ", RowBox[{"Table", "[", RowBox[{ RowBox[{"i", "/", "Nchrom"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}]}], "]"}], "//", "N"}]}], ";", "\[IndentingNewLine]", RowBox[{"skewness", "=", RowBox[{ RowBox[{"Mean", "[", RowBox[{"weight", SuperscriptBox[ RowBox[{"(", RowBox[{ RowBox[{"Table", "[", RowBox[{ RowBox[{"i", "/", "Nchrom"}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Nchrom", "-", "1"}]}], "}"}]}], "]"}], "-", "meanDAF"}], ")"}], "3"]}], "]"}], "//", "N"}]}], ";", "\[IndentingNewLine]", RowBox[{"n", "=", RowBox[{"Sum", "[", RowBox[{ RowBox[{ RowBox[{"tabWS", "[", RowBox[{"[", "i", "]"}], "]"}], "+", RowBox[{"tabSW", "[", RowBox[{"[", "i", "]"}], "]"}]}], ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"Length", "[", "tabWS", "]"}]}], "}"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"SES", "=", RowBox[{"Sqrt", "[", FractionBox[ RowBox[{"6", "n", RowBox[{"(", RowBox[{"n", "-", "1"}], ")"}]}], RowBox[{ RowBox[{"(", RowBox[{"n", "-", "2"}], ")"}], RowBox[{"(", RowBox[{"n", "+", "1"}], ")"}], RowBox[{"(", RowBox[{"n", "+", "3"}], ")"}]}]], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"pvalueSk", "=", RowBox[{"2", RowBox[{"(", RowBox[{"1", "-", RowBox[{"CDF", "[", RowBox[{ RowBox[{"NormalDistribution", "[", RowBox[{"0", ",", "1"}], "]"}], ",", FractionBox[ RowBox[{"Abs", "[", "skewness", "]"}], "SES"]}], "]"}]}], ")"}]}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "In", " ", "the", " ", "lists", " ", "\"\\"", " ", "the", " ", "constrained", " ", "can", " ", "be", " ", RowBox[{"modified", ".", " ", "Using"}], " ", "constrains", " ", "more", " ", "stringent", " ", "that", " ", "the", " ", "possible", " ", "range", " ", "of", " ", "parameters", " ", "can", " ", "help", " ", "convergence"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Model", " ", "0"}], "*)"}], "\[IndentingNewLine]", RowBox[{"init0", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", "\[Theta]init"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", "\[Theta]WSinit"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", "\[Lambda]init"}], "}"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"cons0", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"10", ">", "#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"M0", "=", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik0", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "tabcoef", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "cons0"}], "}"}], ",", "init0", ",", RowBox[{"AccuracyGoal", "\[Rule]", "ACCGOAL"}], ",", RowBox[{"MaxIterations", "\[Rule]", "MAXIT"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Model", " ", "1"}], "*)"}], "\[IndentingNewLine]", RowBox[{"init1", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"B", ",", "0.5"}], "}"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"cons1", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}], ",", RowBox[{ RowBox[{"-", "1"}], "<", "B", "<", "10"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"10", ">", "#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"M1", "=", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik1", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "B", ",", "tabcoef", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "cons1"}], "}"}], ",", "init1", ",", RowBox[{"AccuracyGoal", "\[Rule]", "ACCGOAL"}], ",", RowBox[{"MaxIterations", "\[Rule]", "MAXIT"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Model", " ", "0", " ", "with", " ", "error"}], "*)"}], "\[IndentingNewLine]", RowBox[{"init0e3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]", ",", "0.01"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]WS", ",", "0.02"}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]SW", ",", "0.03"}], "}"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"cons0e3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]WS", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]SW", "\[LessEqual]", RowBox[{"1", "/", "4"}]}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"10", ">", "#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"M0e3", "=", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik0err3", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "tabcoef", ",", "\[Epsilon]", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "cons0e3"}], "}"}], ",", "init0e3", ",", RowBox[{"AccuracyGoal", "\[Rule]", "ACCGOAL"}], ",", RowBox[{"MaxIterations", "\[Rule]", "MAXIT"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Model", " ", "1", " ", "with", " ", "error"}], "*)"}], "\[IndentingNewLine]", RowBox[{"init1e3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M0", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"B", ",", RowBox[{"B", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]", ",", RowBox[{"\[Epsilon]", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]WS", ",", RowBox[{"\[Epsilon]WS", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]SW", ",", RowBox[{"\[Epsilon]SW", "/.", RowBox[{"M0e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"cons1e3", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}], ",", RowBox[{ RowBox[{"-", "1"}], "<", "B", "<", "10"}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]WS", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]SW", "\[LessEqual]", RowBox[{"1", "/", "4"}]}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"10", ">", "#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"M1e3", "=", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik1err3", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "B", ",", "tabcoef", ",", "\[Epsilon]", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "cons1e3"}], "}"}], ",", "init1e3", ",", RowBox[{"AccuracyGoal", "\[Rule]", "ACCGOAL"}], ",", RowBox[{"MaxIterations", "\[Rule]", "MAXIT"}]}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Model", " ", "3", " ", "with", " ", "error", " ", "HM", " ", "hotspot", " ", "map"}], "*)"}], "\[IndentingNewLine]", RowBox[{"initM3e3HM22", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"B0", ",", RowBox[{"B", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]", ",", RowBox[{"\[Epsilon]", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]WS", ",", RowBox[{"\[Epsilon]WS", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]SW", ",", RowBox[{"\[Epsilon]SW", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"consM3e3HM22", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]WS", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]SW", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{ RowBox[{"-", "5"}], "<", "B0", "<", "10"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"10", ">", "#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"M3e3HM22", "=", RowBox[{"If", "[", RowBox[{ RowBox[{"fracHotHM22", ">", "0"}], ",", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik2berr3", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "B0", ",", RowBox[{"ratiorecHM22", "*", "B0"}], ",", "fracHotHM22", ",", "tabcoef", ",", "\[Epsilon]", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "consM3e3HM22"}], "}"}], ",", "initM3e3HM22", ",", RowBox[{"AccuracyGoal", "\[Rule]", "ACCGOAL"}], ",", RowBox[{"MaxIterations", "\[Rule]", "MAXIT"}]}], "]"}], ",", "M1e3"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Model", " ", "3", " ", "with", " ", "error", " ", "HMT6", " ", "hotspot", " ", "map"}], "*)"}], "\[IndentingNewLine]", RowBox[{"initM3e3HMT6", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"B0", ",", RowBox[{"B", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]", ",", RowBox[{"\[Epsilon]", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]WS", ",", RowBox[{"\[Epsilon]WS", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]SW", ",", RowBox[{"\[Epsilon]SW", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"consM3e3HMT6", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]WS", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]SW", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{ RowBox[{"-", "5"}], "<", "B0", "<", "10"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"10", ">", "#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"M3e3HMT6", "=", RowBox[{"If", "[", RowBox[{ RowBox[{"fracHotHMT6", ">", "0"}], ",", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik2berr3", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "B0", ",", RowBox[{"ratiorecHMT6", "*", "B0"}], ",", "fracHotHMT6", ",", "tabcoef", ",", "\[Epsilon]", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "consM3e3HMT6"}], "}"}], ",", "initM3e3HMT6", ",", RowBox[{"AccuracyGoal", "\[Rule]", "ACCGOAL"}], ",", RowBox[{"MaxIterations", "\[Rule]", "MAXIT"}]}], "]"}], ",", "M1e3"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{ "Model", " ", "3", " ", "with", " ", "error", " ", "pop", " ", "specific", " ", "hotspot", " ", "map"}], "*)"}], "\[IndentingNewLine]", RowBox[{"initM3e3Pop", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"\[Theta]", ",", RowBox[{"\[Theta]", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Theta]WS", ",", RowBox[{"\[Theta]WS", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Lambda]", ",", RowBox[{"\[Lambda]", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"B0", ",", RowBox[{"B", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]", ",", RowBox[{"\[Epsilon]", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]WS", ",", RowBox[{"\[Epsilon]WS", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}], ",", RowBox[{"{", RowBox[{"\[Epsilon]SW", ",", RowBox[{"\[Epsilon]SW", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}]}], "}"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Thread", "[", RowBox[{"{", RowBox[{"tabcoef", ",", "rinit"}], "}"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"consM3e3Pop", "=", RowBox[{"Union", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"\[Theta]", ">", "0"}], ",", RowBox[{"\[Theta]WS", ">", "0"}], ",", RowBox[{"\[Lambda]", ">", "0"}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]WS", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{"0", "\[LessEqual]", "\[Epsilon]SW", "\[LessEqual]", RowBox[{"1", "/", "4"}]}], ",", RowBox[{ RowBox[{"-", "5"}], "<", "B0", "<", "10"}]}], "}"}], ",", RowBox[{"Drop", "[", RowBox[{ RowBox[{"Map", "[", RowBox[{ RowBox[{ RowBox[{"10", ">", "#", ">", "0"}], "&"}], ",", "tabcoef"}], "]"}], ",", "1"}], "]"}]}], "]"}]}], ";", "\[IndentingNewLine]", RowBox[{"M3e3Pop", "=", RowBox[{"If", "[", RowBox[{ RowBox[{"fracHotPop", ">", "0"}], ",", RowBox[{"FindMaximum", "[", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{"logLik2berr3", "[", RowBox[{ "Nchrom", ",", "pGC", ",", "\[Theta]", ",", "\[Theta]WS", ",", "\[Lambda]", ",", "B0", ",", RowBox[{"ratiorecPop", "*", "B0"}], ",", "fracHotPop", ",", "tabcoef", ",", "\[Epsilon]", ",", "\[Epsilon]WS", ",", "\[Epsilon]SW", ",", "tabN", ",", "tabWS", ",", "tabSW"}], "]"}], ",", "consM3e3Pop"}], "}"}], ",", "initM3e3Pop", ",", RowBox[{"AccuracyGoal", "\[Rule]", "ACCGOAL"}], ",", RowBox[{"MaxIterations", "\[Rule]", "MAXIT"}]}], "]"}], ",", "M1e3"}], "]"}]}], ";", "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"results", "=", RowBox[{"{", RowBox[{ "chrom", ",", "pos", ",", "pGC", ",", "dtelo", ",", "dcentro", ",", "MethFrq2000bp", ",", "MethCov2000bp", ",", "Rec5kb", ",", "Rec5kbAFR", ",", "Rec5kbEUR", ",", "Rec5kbASI", ",", "fracHotHM22", ",", "HotRecHM22", ",", "ColdRecHM22", ",", "ratiorecHM22", ",", "fracHotHMT6", ",", "HotRecHMT6", ",", "ColdRecHMT6", ",", "ratiorecHMT6", ",", "fracHotPop", ",", "HotRecPop", ",", "ColdRecPop", ",", "ratiorecPop", ",", "\[IndentingNewLine]", "skewness", ",", "pvalueSk", ",", "\[IndentingNewLine]", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"B", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"\[Lambda]", "/.", RowBox[{"M1", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"B", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"\[Lambda]", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"B0", "/.", RowBox[{"M3e3HM22", "[", RowBox[{"[", "2", "]"}], "]"}]}], "/.", RowBox[{"B0", "\[Rule]", "B"}]}], "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"B1", "/.", RowBox[{"M3e3HM22", "[", RowBox[{"[", "2", "]"}], "]"}]}], "/.", RowBox[{"B1", "\[Rule]", "B"}]}], "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"\[Lambda]", "/.", RowBox[{"M3e3HM22", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"B0", "/.", RowBox[{"M3e3HMT6", "[", RowBox[{"[", "2", "]"}], "]"}]}], "/.", RowBox[{"B0", "\[Rule]", "B"}]}], "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"B1", "/.", RowBox[{"M3e3HMT6", "[", RowBox[{"[", "2", "]"}], "]"}]}], "/.", RowBox[{"B1", "\[Rule]", "B"}]}], "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"\[Lambda]", "/.", RowBox[{"M3e3HMT6", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"B0", "/.", RowBox[{"M3e3Pop", "[", RowBox[{"[", "2", "]"}], "]"}]}], "/.", RowBox[{"B0", "\[Rule]", "B"}]}], "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{ RowBox[{ RowBox[{"B1", "/.", RowBox[{"M3e3Pop", "[", RowBox[{"[", "2", "]"}], "]"}]}], "/.", RowBox[{"B1", "\[Rule]", "B"}]}], "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"f", "/.", RowBox[{"M3e3Pop", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"\[Lambda]", "/.", RowBox[{"M3e3Pop", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"\[Epsilon]", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"\[Epsilon]WS", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"\[Epsilon]SW", "/.", RowBox[{"M1e3", "[", RowBox[{"[", "2", "]"}], "]"}]}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", "\[IndentingNewLine]", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"M0", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"M1", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"M0e3", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"M1e3", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"M3e3HM22", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"M3e3HMT6", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{ RowBox[{"M3e3Pop", "[", RowBox[{"[", "1", "]"}], "]"}], ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}], ",", RowBox[{"Catch", "[", RowBox[{"Check", "[", RowBox[{"likemax", ",", RowBox[{"Throw", "[", "\"\\"", "]"}]}], "]"}], "]"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", "}"}]}]], "Input", CellChangeTimes->{{3.564232469186648*^9, 3.564232504601274*^9}, { 3.564232651890757*^9, 3.564232705919312*^9}, {3.5642383301577883`*^9, 3.564238330725251*^9}, {3.564596012165976*^9, 3.5645960710609827`*^9}, { 3.5645962565608063`*^9, 3.564596261600336*^9}, {3.564596293158496*^9, 3.564596544978104*^9}, {3.5645966075925407`*^9, 3.564596798226078*^9}, { 3.564596828443215*^9, 3.564596899102438*^9}, {3.5645969583314466`*^9, 3.5645969718987503`*^9}, {3.564597017065658*^9, 3.5645970314482937`*^9}, { 3.564597066658351*^9, 3.5645971011191387`*^9}, 3.5645974326373177`*^9, { 3.564597587367559*^9, 3.564597601381064*^9}, {3.564598505946822*^9, 3.564598639021294*^9}, 3.564598676279375*^9, {3.5646003257724533`*^9, 3.564600359413574*^9}, {3.5646036071176157`*^9, 3.564603607508663*^9}, { 3.564720910077867*^9, 3.564720920776412*^9}, {3.5647213965961723`*^9, 3.56472140044217*^9}, {3.564722550114894*^9, 3.5647227076784477`*^9}, { 3.564725438625601*^9, 3.564725438833494*^9}, {3.565005156584021*^9, 3.565005157012401*^9}, {3.565005203171031*^9, 3.565005203485272*^9}, { 3.5650280646265697`*^9, 3.5650280739358053`*^9}, {3.566578313514299*^9, 3.566578377092432*^9}, 3.567158285524542*^9, {3.567182898484277*^9, 3.567182903370412*^9}, {3.567786975158716*^9, 3.56778701370608*^9}, { 3.567787067393105*^9, 3.567787136524708*^9}, {3.567787170065757*^9, 3.567787285429204*^9}, {3.567787340691123*^9, 3.567787352576964*^9}, { 3.567787478256016*^9, 3.567787519751205*^9}, {3.5677875752636013`*^9, 3.5677876180974073`*^9}, {3.567787656400393*^9, 3.567787729161573*^9}, { 3.5677946847666063`*^9, 3.5677948015262823`*^9}, {3.5677951465550947`*^9, 3.567795178659089*^9}, {3.5677956463350363`*^9, 3.56779564924641*^9}, { 3.567795761060503*^9, 3.567795830757791*^9}, {3.567795865437357*^9, 3.567795977404728*^9}, {3.567796526694042*^9, 3.5677965279798183`*^9}, { 3.5689571048412447`*^9, 3.5689571190070353`*^9}, {3.568957152151449*^9, 3.568957297169928*^9}, {3.568957336561582*^9, 3.568957342388544*^9}, { 3.568958133852895*^9, 3.568958250050845*^9}, {3.56895877877352*^9, 3.568958819774907*^9}, {3.5689592545021057`*^9, 3.568959366643921*^9}, { 3.568971941678248*^9, 3.568972021527689*^9}, {3.568972056699017*^9, 3.5689721351006203`*^9}, {3.5689722532850523`*^9, 3.568972267666596*^9}, { 3.5689723384860487`*^9, 3.5689723409936743`*^9}, {3.5689724366196327`*^9, 3.568972529562912*^9}, {3.5689725863091087`*^9, 3.568972602590781*^9}, { 3.568972658938731*^9, 3.568972666853112*^9}, {3.568972735323998*^9, 3.5689728936447287`*^9}, {3.568973230165069*^9, 3.568973244004806*^9}, 3.568973618101531*^9, {3.568975947298752*^9, 3.568975958692848*^9}, { 3.5689761671611958`*^9, 3.5689761676037292`*^9}, 3.568976636795155*^9, { 3.568977140494974*^9, 3.568977148811504*^9}, {3.56897773195886*^9, 3.568977740324318*^9}, {3.568978361329644*^9, 3.568978372023465*^9}, { 3.568985158723487*^9, 3.568985165849016*^9}, {3.5689853576551323`*^9, 3.5689853944667473`*^9}, {3.5689854713861437`*^9, 3.568985601610443*^9}, { 3.56898570223776*^9, 3.5689857046501627`*^9}, {3.5689858624887123`*^9, 3.568985950955102*^9}, {3.56898842938822*^9, 3.568988435185371*^9}, { 3.57076585065133*^9, 3.570766063189213*^9}, {3.570766252090571*^9, 3.570766321263784*^9}, {3.570766372548101*^9, 3.570766477343383*^9}, { 3.5707665085210733`*^9, 3.570766512317471*^9}, {3.570766565508958*^9, 3.570766638305806*^9}, {3.5707666698493357`*^9, 3.570766873172969*^9}, { 3.570774678935397*^9, 3.5707748292182302`*^9}, {3.5721106285315228`*^9, 3.572110762632154*^9}, {3.572110995677774*^9, 3.5721110480477552`*^9}, { 3.572111293947323*^9, 3.5721113085787287`*^9}, {3.572111348250217*^9, 3.57211136954617*^9}, {3.572111745312642*^9, 3.572111750145627*^9}, { 3.572111792498909*^9, 3.5721118025833*^9}, {3.572112249002212*^9, 3.5721122559384623`*^9}, {3.5721123397469273`*^9, 3.572112375227919*^9}, { 3.572112752288137*^9, 3.5721128776262093`*^9}, {3.572113451002879*^9, 3.572113478397334*^9}, {3.572799375298287*^9, 3.572799378225773*^9}, { 3.5728001651932364`*^9, 3.572800177001882*^9}, {3.572802430274637*^9, 3.5728024792486143`*^9}, {3.5728025278029547`*^9, 3.572802529777213*^9}, { 3.572802600380104*^9, 3.57280261780928*^9}, {3.59428656215371*^9, 3.594286562697934*^9}, {3.5942866004052067`*^9, 3.5942866296432047`*^9}, { 3.594286720904999*^9, 3.594286743368876*^9}, {3.594286789106627*^9, 3.594286802861361*^9}, {3.594709441488228*^9, 3.594709452239276*^9}, { 3.594709495909916*^9, 3.5947095012120857`*^9}, {3.601636634517371*^9, 3.6016368135837297`*^9}, {3.6016368801582327`*^9, 3.60163691055857*^9}, { 3.6016369415197163`*^9, 3.601636962061851*^9}, 3.601637066142724*^9, 3.601637214940074*^9, {3.601637272010367*^9, 3.601637272447797*^9}, 3.60163731272383*^9, {3.6016373809450197`*^9, 3.6016373862200193`*^9}, { 3.60163894978584*^9, 3.601639009716106*^9}, {3.601639049817873*^9, 3.601639334707878*^9}, {3.6016393834843893`*^9, 3.601639440016794*^9}, { 3.601639521211735*^9, 3.601639602139447*^9}, {3.601639672646776*^9, 3.601639702482667*^9}, {3.601639865368819*^9, 3.601639870642974*^9}, { 3.601639939234133*^9, 3.601639949392454*^9}, {3.601640951168519*^9, 3.601640952530534*^9}, {3.6016419227738113`*^9, 3.601641925890484*^9}, { 3.6016421042887297`*^9, 3.60164210625915*^9}, {3.601741596762587*^9, 3.601741624091941*^9}, {3.601741687070318*^9, 3.601741698646474*^9}, { 3.601741767636992*^9, 3.6017418077277117`*^9}, {3.601742182948407*^9, 3.601742192813527*^9}, {3.601742474166319*^9, 3.601742501682212*^9}, { 3.601742677583557*^9, 3.601742681621695*^9}, {3.601742722486541*^9, 3.601742730899766*^9}, {3.601742770117742*^9, 3.6017427832591352`*^9}, { 3.601796111719041*^9, 3.601796112129637*^9}, {3.605433627539708*^9, 3.605433724120199*^9}, {3.605433758040802*^9, 3.605433774722142*^9}, { 3.6054338540079937`*^9, 3.6054338722243557`*^9}, {3.605433910143314*^9, 3.605433918445333*^9}, {3.6054340074992332`*^9, 3.605434033979087*^9}, 3.605434227391378*^9, {3.6054344332244797`*^9, 3.6054344634683867`*^9}, { 3.605434516419979*^9, 3.605434520688509*^9}, {3.605434668434888*^9, 3.605434700673314*^9}, {3.605434883621396*^9, 3.6054348882376413`*^9}, { 3.6054349330278883`*^9, 3.6054349497954903`*^9}, {3.605435293386023*^9, 3.605435296666692*^9}, 3.605435718209049*^9, {3.6054357771659203`*^9, 3.605435783278756*^9}, {3.605436070332905*^9, 3.60543607813916*^9}, { 3.6054361213085403`*^9, 3.605436139966164*^9}, {3.60543709624083*^9, 3.6054371004777412`*^9}, {3.609526269482215*^9, 3.60952627779217*^9}, { 3.609526485997842*^9, 3.609526491923544*^9}, {3.6097374321534758`*^9, 3.609737434847542*^9}, {3.609737517522478*^9, 3.609737529583088*^9}, { 3.6097385073938417`*^9, 3.6097385078741837`*^9}, {3.609738606477717*^9, 3.609738606954048*^9}, {3.609739189999485*^9, 3.609739190436368*^9}, { 3.609739688392905*^9, 3.609739691485484*^9}, {3.60973973918451*^9, 3.6097397559857407`*^9}, 3.609739787839322*^9, {3.6097398919190073`*^9, 3.609739902595244*^9}, {3.609739992136403*^9, 3.6097399923472*^9}, { 3.6097400423984613`*^9, 3.609740048299677*^9}, {3.609740120998076*^9, 3.60974014895411*^9}, {3.6097447539107924`*^9, 3.6097447582399273`*^9}, { 3.609744857661352*^9, 3.609744863055546*^9}, {3.609939693157559*^9, 3.6099397084436502`*^9}, {3.610266904228853*^9, 3.610266926714859*^9}, { 3.627033711590027*^9, 3.627033712421447*^9}, {3.627034613250502*^9, 3.6270348814396057`*^9}, {3.627034948949397*^9, 3.627035046053722*^9}, { 3.6270354822293262`*^9, 3.627035550570327*^9}, {3.627035764388229*^9, 3.627035884002575*^9}, {3.627035984640954*^9, 3.627035986191017*^9}, { 3.627036036582644*^9, 3.627036161936907*^9}, {3.627036423142729*^9, 3.627036423781404*^9}, 3.627036510311795*^9, {3.630059804825591*^9, 3.63005981458639*^9}, {3.630998755044944*^9, 3.6309989128106813`*^9}, { 3.630998985307619*^9, 3.6309990120753527`*^9}, {3.631504728205451*^9, 3.63150474060151*^9}, {3.631505360396502*^9, 3.631505372892241*^9}, { 3.631505428885584*^9, 3.631505429866392*^9}, {3.6318485274856253`*^9, 3.631848632489789*^9}, {3.6318752100201473`*^9, 3.631875218278041*^9}, { 3.631875392972094*^9, 3.6318754023215237`*^9}, {3.631875451833393*^9, 3.6318754926040297`*^9}, {3.631941963000626*^9, 3.63194202979186*^9}, { 3.631942074847436*^9, 3.6319420971138687`*^9}, {3.631942139730044*^9, 3.631942148909376*^9}, {3.6360484273940077`*^9, 3.636048429094503*^9}, { 3.636049622391151*^9, 3.636049695392088*^9}, {3.63604993760434*^9, 3.63604997246922*^9}, {3.6361350051831017`*^9, 3.636135022793974*^9}, { 3.6361350899995203`*^9, 3.636135240277657*^9}, {3.636135281061183*^9, 3.636135295199416*^9}, {3.636135339206472*^9, 3.6361353406620483`*^9}, { 3.636135516417862*^9, 3.636135606370418*^9}, {3.6364542273959217`*^9, 3.636454260600945*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{"ACCGOAL", "=", "6"}], ";"}], RowBox[{"(*", RowBox[{ "AccuracyGoal", " ", "for", " ", "the", " ", "FndMaximum", " ", "function"}], "*)"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{"MAXIT", "=", "1000"}], ";", " ", RowBox[{"(*", RowBox[{ "MaxIteration", " ", "for", " ", "the", " ", "FndMaximum", " ", "function"}], "*)"}], "\[IndentingNewLine]", RowBox[{"imax", "=", RowBox[{ RowBox[{"Length", "[", "data", "]"}], "/", "3"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"tabres", "=", RowBox[{"Table", "[", RowBox[{"a", ",", RowBox[{"{", RowBox[{"i", ",", "1", ",", RowBox[{"imax", "+", "1"}]}], "}"}]}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"tabres", "[", RowBox[{"[", "1", "]"}], "]"}], "=", RowBox[{"{", RowBox[{ "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\"", ",", "\"\\""}], "}"}]}], ";"}]}], "Input", CellChangeTimes->{{3.564598660684298*^9, 3.564598681109062*^9}, { 3.5646033969725237`*^9, 3.564603544193191*^9}, {3.564603626032721*^9, 3.5646036368680687`*^9}, {3.56460408811275*^9, 3.5646040934938*^9}, { 3.564605755021192*^9, 3.564605755634467*^9}, {3.5647227158650513`*^9, 3.564722717312138*^9}, {3.564724955442636*^9, 3.56472495576687*^9}, { 3.56472514105916*^9, 3.564725147591189*^9}, {3.56472524797587*^9, 3.564725267654777*^9}, {3.565004831391509*^9, 3.565004835121592*^9}, { 3.5650284010731487`*^9, 3.565028401312364*^9}, {3.5665784206672363`*^9, 3.566578420728271*^9}, {3.566578452692444*^9, 3.5665784631477423`*^9}, { 3.5665785291952333`*^9, 3.56657863095895*^9}, {3.5665798816299562`*^9, 3.566579881961372*^9}, {3.566672096880196*^9, 3.566672097162891*^9}, { 3.567158290408122*^9, 3.5671582907438498`*^9}, {3.567787809912031*^9, 3.5677879912718973`*^9}, {3.567795183911495*^9, 3.5677951841057463`*^9}, { 3.567795984283964*^9, 3.5677959935474157`*^9}, {3.567796533441386*^9, 3.567796535267167*^9}, {3.567797021747059*^9, 3.5677970220993433`*^9}, { 3.567858882490768*^9, 3.5678588921751757`*^9}, {3.5689729023302794`*^9, 3.5689729059646597`*^9}, {3.568972951406474*^9, 3.568973106204705*^9}, { 3.568973419607951*^9, 3.568973420017661*^9}, {3.568973451872979*^9, 3.568973460813385*^9}, {3.5689743183318043`*^9, 3.568974318746006*^9}, { 3.568975778370386*^9, 3.568975782142419*^9}, {3.568989293875523*^9, 3.568989294088269*^9}, {3.568995276154545*^9, 3.568995286343932*^9}, { 3.569002603302622*^9, 3.569002604508559*^9}, {3.569007777762506*^9, 3.569007778469676*^9}, {3.569037167535789*^9, 3.569037168781053*^9}, { 3.5721106343381557`*^9, 3.572110644339747*^9}, {3.57211106566327*^9, 3.572111066922658*^9}, {3.572111107692614*^9, 3.5721111105861464`*^9}, { 3.572111194195798*^9, 3.5721112668620768`*^9}, 3.572111322357814*^9, { 3.5721116385356073`*^9, 3.572111734623129*^9}, {3.5721128920753813`*^9, 3.5721129183703127`*^9}, {3.5727998281185102`*^9, 3.572799838464826*^9}, { 3.572802710582664*^9, 3.572802710849146*^9}, {3.594286823986332*^9, 3.59428684067008*^9}, {3.594286967553355*^9, 3.594286970873584*^9}, { 3.5942870297978697`*^9, 3.594287030084433*^9}, {3.594300374749929*^9, 3.5943003882995443`*^9}, {3.594450462921728*^9, 3.5944504676014147`*^9}, { 3.594451380133748*^9, 3.594451381377425*^9}, {3.594542866968452*^9, 3.594542867350051*^9}, {3.6016420915132236`*^9, 3.6016421408193197`*^9}, { 3.601642200885611*^9, 3.601642356013233*^9}, {3.60174171494487*^9, 3.6017417281428843`*^9}, {3.601741825793831*^9, 3.6017418440928717`*^9}, 3.604659877613944*^9, {3.6054357306025047`*^9, 3.6054357568711853`*^9}, { 3.6097375460781918`*^9, 3.609737563242716*^9}, {3.609738261096325*^9, 3.60973826382964*^9}, {3.609738345542768*^9, 3.609738345887702*^9}, { 3.609738654120489*^9, 3.609738654386595*^9}, {3.6097401786584578`*^9, 3.609740178994885*^9}, {3.6110229551438932`*^9, 3.6110229630614433`*^9}, { 3.627035926990191*^9, 3.627035970842988*^9}, {3.6270361709997*^9, 3.627036187669598*^9}, {3.627036223284155*^9, 3.627036369761675*^9}, { 3.6270383736584597`*^9, 3.627038437123857*^9}, {3.6300598852481937`*^9, 3.630059916399706*^9}, {3.630999045151267*^9, 3.6309990620934*^9}, 3.631848654775374*^9, {3.631942173867879*^9, 3.6319421774327*^9}, { 3.63613594621568*^9, 3.6361359681433067`*^9}}], Cell[BoxData[{ RowBox[{ RowBox[{ RowBox[{ "SetDirectory", "[", "\"\\"", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Replace", " ", "by", " ", "your", " ", "path"}], "*)"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ RowBox[{"writefile", ":=", RowBox[{"Export", "[", RowBox[{ RowBox[{"filename", "<>", "\"\<.estim\>\""}], ",", RowBox[{"N", "[", "tabres", "]"}], ",", "\"\\""}], "]"}]}], ";"}], "\[IndentingNewLine]"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"For", "[", RowBox[{ RowBox[{"i", "=", "1"}], ",", RowBox[{"i", "\[LessEqual]", "imax"}], ",", "\[IndentingNewLine]", RowBox[{ RowBox[{"{", RowBox[{ RowBox[{ RowBox[{"initdata", "[", "i", "]"}], ";", "\[IndentingNewLine]", "estim", ";", RowBox[{ RowBox[{"tabres", "[", RowBox[{"[", RowBox[{"i", "+", "1"}], "]"}], "]"}], "=", "results"}], ";", RowBox[{"Print", "[", "i", "]"}]}], ",", RowBox[{"If", "[", RowBox[{ RowBox[{"Divisible", "[", RowBox[{"i", ",", "10"}], "]"}], ",", "writefile"}], "]"}]}], "}"}], ";", RowBox[{"i", "++"}]}]}], "]"}], " ", RowBox[{"(*", RowBox[{ "The", " ", "ouput", " ", "file", " ", "is", " ", "regularly", " ", "written"}], "*)"}], "\[IndentingNewLine]", "\[IndentingNewLine]", RowBox[{"(*", RowBox[{"Final", " ", "writing"}], "*)"}]}], "\[IndentingNewLine]", RowBox[{ RowBox[{ "SetDirectory", "[", "\"\\"", "]"}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"Export", "[", RowBox[{ RowBox[{"filename", "<>", "\"\<.estim\>\""}], ",", RowBox[{"N", "[", "tabres", "]"}], ",", "\"\\""}], "]"}], ";"}]}], "Input", CellChangeTimes->{{3.6103425466127462`*^9, 3.610342553860087*^9}, { 3.610375102277451*^9, 3.610375103075405*^9}, {3.610387558242552*^9, 3.610387566287966*^9}, 3.610897421974165*^9, {3.610936406833065*^9, 3.6109364078253937`*^9}, {3.610956120356894*^9, 3.6109561207824917`*^9}, { 3.610987449809805*^9, 3.6109874515505466`*^9}, {3.611022979668317*^9, 3.611022982048436*^9}, {3.611054520102476*^9, 3.61105452228979*^9}, { 3.6110769207836123`*^9, 3.6110769237460203`*^9}, {3.611108449026595*^9, 3.611108451234231*^9}, {3.611124495545294*^9, 3.611124496838892*^9}, { 3.6111247175024347`*^9, 3.611124718628978*^9}, {3.6111324959430943`*^9, 3.611132504164523*^9}, {3.627035106271397*^9, 3.627035107236197*^9}, { 3.6270369092119293`*^9, 3.627036910380525*^9}, 3.627038443427248*^9, { 3.627041765318318*^9, 3.627041765897066*^9}, 3.6273763421287537`*^9, { 3.627377315234518*^9, 3.627377316145194*^9}, {3.6318486959378*^9, 3.6318487296649017`*^9}, 3.631875293856555*^9, {3.631875509423883*^9, 3.631875510627761*^9}, {3.636135359830274*^9, 3.6361353940122337`*^9}, { 3.636135432488714*^9, 3.6361354864810467`*^9}, 3.636135980399661*^9, { 3.6361360379263887`*^9, 3.636136094291635*^9}, {3.636136129467107*^9, 3.6361361297056293`*^9}, {3.636137669623603*^9, 3.6361376736570597`*^9}}] }, Open ]] }, Open ]] }, Open ]] }, Evaluator->"Second", WindowSize->{1280, 700}, WindowMargins->{{0, Automatic}, {Automatic, 0}}, Magnification->1.25, FrontEndVersion->"8.0 for Mac OS X x86 (32-bit, 64-bit Kernel) (November 6, \ 2010)", StyleDefinitions->FrontEnd`FileName[{"Report"}, "StandardReport.nb", CharacterEncoding -> "UTF-8"] ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[567, 22, 339, 7, 152, "Title"], Cell[909, 31, 368, 6, 54, "Subsubtitle"], Cell[1280, 39, 85, 2, 45, "Input"], Cell[CellGroupData[{ Cell[1390, 45, 210, 3, 86, "Section"], Cell[CellGroupData[{ Cell[1625, 52, 147, 2, 41, "Subsection"], Cell[1775, 56, 8946, 227, 533, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[10758, 288, 144, 2, 41, "Subsection"], Cell[10905, 292, 1401, 33, 131, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[12343, 330, 498, 9, 41, "Subsection"], Cell[12844, 341, 2844, 79, 250, "Input"], Cell[15691, 422, 6323, 166, 457, "Input"] }, Open ]], Cell[CellGroupData[{ Cell[22051, 593, 349, 5, 41, "Subsection"], Cell[22403, 600, 4407, 105, 250, "Input"], Cell[26813, 707, 13325, 310, 783, "Input"] }, Open ]] }, Closed]], Cell[CellGroupData[{ Cell[40187, 1023, 259, 5, 47, "Section"], Cell[CellGroupData[{ Cell[40471, 1032, 154, 2, 27, "Subsection"], Cell[40628, 1036, 4222, 69, 571, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[44887, 1110, 164, 2, 26, "Subsection"], Cell[45054, 1114, 3050, 83, 368, "Input"] }, Closed]], Cell[CellGroupData[{ Cell[48141, 1202, 125, 2, 26, "Subsection"], Cell[48269, 1206, 125, 2, 62, "Text"], Cell[CellGroupData[{ Cell[48419, 1212, 466, 8, 87, "Input"], Cell[48888, 1222, 373, 6, 87, "Output"] }, Open ]], Cell[49276, 1231, 112, 2, 62, "Text"], Cell[CellGroupData[{ Cell[49413, 1237, 3203, 72, 163, "Input"], Cell[52619, 1311, 9108, 209, 533, "Output"] }, Open ]], Cell[61742, 1523, 112, 2, 62, "Text"], Cell[CellGroupData[{ Cell[61879, 1529, 4044, 89, 200, "Input"], Cell[65926, 1620, 9142, 210, 533, "Output"] }, Open ]], Cell[75083, 1833, 113, 2, 62, "Text"], Cell[CellGroupData[{ Cell[75221, 1839, 4593, 96, 163, "Input"], Cell[79817, 1937, 9126, 210, 533, "Output"] }, Open ]], Cell[88958, 2150, 157, 2, 62, "Text"], Cell[CellGroupData[{ Cell[89140, 2156, 4661, 101, 237, "Input"], Cell[93804, 2259, 9980, 222, 562, "Output"] }, Open ]], Cell[103799, 2484, 209, 3, 62, "Text"], Cell[CellGroupData[{ Cell[104033, 2491, 6663, 135, 237, "Input"], Cell[110699, 2628, 9174, 209, 571, "Output"] }, Open ]], Cell[119888, 2840, 262, 4, 62, "Text"], Cell[CellGroupData[{ Cell[120175, 2848, 6358, 132, 275, "Input"], Cell[126536, 2982, 9286, 212, 597, "Output"] }, Open ]], Cell[135837, 3197, 133, 2, 62, "Text"], Cell[CellGroupData[{ Cell[135995, 3203, 6803, 143, 312, "Input"], Cell[142801, 3348, 9375, 214, 597, "Output"] }, Open ]] }, Closed]] }, Open ]], Cell[CellGroupData[{ Cell[152237, 3569, 280, 5, 86, "Section"], Cell[CellGroupData[{ Cell[152542, 3578, 102, 1, 27, "Subsection"], Cell[CellGroupData[{ Cell[152669, 3583, 5692, 105, 217, "Input"], Cell[158364, 3690, 4599, 74, 274, "Output"] }, Open ]], Cell[162978, 3767, 16477, 439, 692, "Input"], Cell[179458, 4208, 46323, 1081, 2082, "Input"], Cell[225784, 5291, 5836, 100, 236, "Input"], Cell[231623, 5393, 3336, 76, 236, "Input"] }, Open ]] }, Open ]] }, Open ]] } ] *) (* End of internal cache information *)