(* Content-type: application/mathematica *) (*** Wolfram Notebook File ***) (* http://www.wolfram.com/nb *) (* CreatedBy='Mathematica 7.0' *) (*CacheID: 234*) (* Internal cache information: NotebookFileLineBreakTest NotebookFileLineBreakTest NotebookDataPosition[ 145, 7] NotebookDataLength[ 7002, 207] NotebookOptionsPosition[ 6382, 181] NotebookOutlinePosition[ 6720, 196] CellTagsIndexPosition[ 6677, 193] WindowFrame->Normal*) (* Beginning of Notebook Content *) Notebook[{ Cell[CellGroupData[{ Cell[BoxData[{ StyleBox[ RowBox[{ RowBox[{ "Below", " ", "is", " ", "an", " ", "example", " ", "of", " ", "taking", " ", "various", " ", "genotypes", " ", "and", " ", "probabilities", " ", "for", " ", "certain", " ", "diseases", " ", "and", " ", "associating", " ", "the", " ", "probability", " ", "as", " ", "the", " ", "response"}], ";"}], "Text"], "\[IndentingNewLine]", RowBox[{ RowBox[{"data", " ", "=", " ", RowBox[{"{", RowBox[{ RowBox[{"{", RowBox[{"0", ",", "0", ",", "0"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"0", ",", "0", ",", "1"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"0", ",", " ", "1", ",", "0"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"1", ",", "1", ",", "0"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"0", ",", "1", ",", "1"}], "}"}], ",", " ", RowBox[{"{", RowBox[{"1", ",", "1", ",", "1"}], "}"}]}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"ys", " ", "=", " ", RowBox[{"{", RowBox[{"0", ",", "1", ",", "0", ",", " ", RowBox[{"2", "/", "3"}], ",", " ", RowBox[{"1", "/", "3"}], ",", " ", "1"}], "}"}]}], ";"}], "\[IndentingNewLine]", RowBox[{ RowBox[{"logit", " ", "=", " ", RowBox[{"LogitModelFit", "[", RowBox[{"{", RowBox[{"data", ",", " ", "ys"}], "}"}], "]"}]}], ";"}], "\[IndentingNewLine]", RowBox[{"Show", "[", RowBox[{ RowBox[{"ListPlot", "[", "data", "]"}], ",", " ", RowBox[{"Plot", "[", RowBox[{ RowBox[{"logit", "[", RowBox[{"x", ",", "0", ",", " ", "0"}], "]"}], ",", " ", RowBox[{"{", RowBox[{"x", ",", "1", ",", " ", "3"}], "}"}]}], "]"}], ",", " ", RowBox[{"PlotRange", "\[Rule]", " ", "All"}], ",", " ", RowBox[{"AxesOrigin", " ", "\[Rule]", " ", RowBox[{"{", RowBox[{".9", ",", " ", RowBox[{"-", ".1"}]}], "}"}]}]}], "]"}], "\[IndentingNewLine]"}], "Input", CellChangeTimes->{{3.470117229024857*^9, 3.470117294828643*^9}, { 3.470117389205882*^9, 3.470117389852642*^9}, {3.470117447451222*^9, 3.470117464868832*^9}, {3.470117598302362*^9, 3.470117598542451*^9}, { 3.470117667769541*^9, 3.470117692382504*^9}, {3.470117932992647*^9, 3.470118008697114*^9}, {3.470118085699355*^9, 3.470118103546727*^9}, 3.470118363651395*^9}], Cell[BoxData[ GraphicsBox[{{ {Hue[0.67, 0.6, 0.6], PointBox[{{1., 0.}, {2., 0.}, {3., 0.}}]}, {Hue[0.9060679774997897, 0.6, 0.6], PointBox[{{1., 0.}, {2., 0.}, {3., 1.}}]}, {Hue[0.1421359549995791, 0.6, 0.6], PointBox[{{1., 0.}, {2., 1.}, {3., 0.}}]}, {Hue[0.37820393249936934`, 0.6, 0.6], PointBox[{{1., 1.}, {2., 1.}, {3., 0.}}]}, {Hue[0.6142719099991583, 0.6, 0.6], PointBox[{{1., 0.}, {2., 1.}, {3., 1.}}]}, {Hue[0.8503398874989481, 0.6, 0.6], PointBox[{{1., 1.}, {2., 1.}, {3., 1.}}]}}, {{}, {}, {Hue[0.67, 0.6, 0.6], LineBox[CompressedData[" 1:eJxFygtIUwEYBeC5mVN7sEZKklBLJ7gEy4xKq3+zGBiEazhmEw0HRvZwOQ0F s4yUDGuW9JAcKDYER6SilFEtW5plTjMjl2mWoK5czcB73cst697uf+Bw+OAI 1Bp5LpvFYu1d7t/VD8W0EPoFuHTVvxwHtMV6I4XTC3CujXK7alYankyAbIDy Lnlmr7iagFMTlE2pQ/tPfibgi40yK3qJcySBhNDflCU+UY/0CglyknJwwzfr 6TESdC7Kg1D38+aWRXjooXyxrVYWVboIm5YoJwqudbT3LwLfR7mpSJLBETih mzbvNeFNL3bCVj9lzlQCOdnnhCLapEfjOLHeBQbaBucx0WONC3poy4msXG6f C8Zo21/U/Xoa6YYZ2pd1I8VarRvmaTcL7ihyzG4gab/qVG2X8T3gpN0ossrZ eR7w0i5tVGg7n6Oz3xOWZDNaHHg79mUPOuj4x6/Dbzzgo10br0xzjKCNpow4 kQ09Np4508DzMk6KUKuqc9Aa5VSvjbcErH+Zh7IdPyzrnqFvNXIudGT5GEcN X++wrvQzfqKLv3HmATqMNFbOxbDE/13FLQlUl6HLJy2jawfRiXcn7BXCAMYf orfJjpaiXWdXBxe+RX9quRdwcDOb8T6DOU1ViK7JF9qHzej6DSn9qyI4jONq Zr3leeiSaWlBVzc6lR2fFMsPZMx1qA4HqNHlJrFR34U+n96qLAhZwXinZVQa koMeDztQEfwIHSTcHS7hBjGeC7d935ONVgxt5Gtb0feV9VVr/GiT+Z04X8HF /4LuELcZzUsJNXBG0AM1lW6/H/0H/VrXvQ== "]]}}}, AspectRatio->NCache[GoldenRatio^(-1), 0.6180339887498948], Axes->True, AxesOrigin->{0.9, -0.1}, PlotRange->All, PlotRangeClipping->True]], "Output", CellChangeTimes->{ 3.4701175992330103`*^9, {3.4701176696916637`*^9, 3.470117693917212*^9}, { 3.470117963646571*^9, 3.470118009274778*^9}}] }, Open ]], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"Normal", "[", "logit", "]"}]], "Input", CellChangeTimes->{{3.470118053933001*^9, 3.470118056704824*^9}}], Cell[BoxData[ FractionBox["1", RowBox[{"1", "+", SuperscriptBox["\[ExponentialE]", RowBox[{ RowBox[{ RowBox[{"-", "20.53353805567281`"}], " ", "#1"}], "+", RowBox[{"19.84039087511291`", " ", "#2"}], "-", RowBox[{"19.147243694553`", " ", "#3"}]}]]}]]], "Output", CellChangeTimes->{3.470118057175699*^9}] }, Open ]], Cell["\<\ Below is an example of generating random data and outputting a response\ \>", "Input", CellChangeTimes->{{3.470118072928823*^9, 3.470118083848325*^9}, { 3.470118207049775*^9, 3.470118230056616*^9}, {3.470118326009009*^9, 3.470118335296803*^9}}, FormatType->"TextForm"], Cell[CellGroupData[{ Cell[BoxData[ RowBox[{"logit", "=", RowBox[{"LogitModelFit", "[", RowBox[{ RowBox[{"RandomReal", "[", RowBox[{"1", ",", "10"}], "]"}], ",", "x", ",", "x"}], "]"}]}]], "Input"], Cell[BoxData[ RowBox[{"FittedModel", "[", PanelBox[ TagBox[ FractionBox["1", RowBox[{"1", "+", SuperscriptBox["\[ExponentialE]", RowBox[{ RowBox[{"-", RowBox[{"\[LeftSkeleton]", "18", "\[RightSkeleton]"}]}], "+", RowBox[{"\[LeftSkeleton]", "1", "\[RightSkeleton]"}]}]]}]], Short], FrameMargins->5], "]"}]], "Output", CellChangeTimes->{3.470118391887691*^9}] }, Open ]], Cell["\<\ We could use something similar to generate large datasets and test our models \ in theory before implementing in python\ \>", "Input", CellChangeTimes->{{3.4701183936099358`*^9, 3.470118410816639*^9}}, FormatType->"TextForm"] }, WindowSize->{599, 795}, WindowMargins->{{4, Automatic}, {Automatic, 4}}, FrontEndVersion->"7.0 for Mac OS X x86 (32-bit) (November 10, 2008)", StyleDefinitions->"Default.nb" ] (* End of Notebook Content *) (* Internal cache information *) (*CellTagsOutline CellTagsIndex->{} *) (*CellTagsIndex CellTagsIndex->{} *) (*NotebookFileOutline Notebook[{ Cell[CellGroupData[{ Cell[567, 22, 2340, 59, 148, "Input"], Cell[2910, 83, 1762, 36, 240, "Output"] }, Open ]], Cell[CellGroupData[{ Cell[4709, 124, 129, 2, 27, "Input"], Cell[4841, 128, 339, 9, 48, "Output"] }, Open ]], Cell[5195, 140, 286, 7, 40, "Input"], Cell[CellGroupData[{ Cell[5506, 151, 193, 5, 27, "Input"], Cell[5702, 158, 424, 13, 61, "Output"] }, Open ]], Cell[6141, 174, 237, 5, 40, "Input"] } ] *) (* End of internal cache information *)