{"id":50,"date":"2013-05-29T21:12:27","date_gmt":"2013-05-29T21:12:27","guid":{"rendered":"http:\/\/homepages.se.edu\/cmoretti\/?page_id=50"},"modified":"2019-10-28T15:42:41","modified_gmt":"2019-10-28T15:42:41","slug":"mathematica-notebooks-probabilitystatistics","status":"publish","type":"page","link":"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/","title":{"rendered":"Dr Moretti&#8217;s Mathematica Notebooks &#8211; Probability\/Statistics"},"content":{"rendered":"<h1 style=\"text-align: center\">Mathematica Notebooks for Probability and Statistics<\/h1>\n<p><span style=\"text-decoration: underline\">Important Note:<\/span>\u00a0The links for the notebooks open a new window or tab with a Google Drive page &#8211; the current settings for our homepages won&#8217;t allow me to host mathematica notebooks locally.<\/p>\n<h2>Measures of Central Tendency<\/h2>\n<p>This notebook contains an animation which explores 4 different measures of central tendency &#8211; the mean, median, geometric mean, and harmonic mean. \u00a0You can add additional data points to the number line by command-clicking on the line, and each point can be slid up and down the line with the measures of central tendency automatically updating (which is useful for demonstrating how differently measures like the mean and median react to changing a single value).<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means.jpg\"><img fetchpriority=\"high\" decoding=\"async\" class=\"aligncenter  wp-image-163\" alt=\"means\" src=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means.jpg\" width=\"385\" height=\"214\" srcset=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means.jpg 1540w, https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means-300x167.jpg 300w, https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means-768x427.jpg 768w, https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means-1024x569.jpg 1024w\" sizes=\"(max-width: 385px) 100vw, 385px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/drive.google.com\/folderview?id=0BxSwUt0i0mImaEtDZ0hlMEdTWms&amp;usp=sharing\" target=\"_blank\" rel=\"noopener noreferrer\">Download this or other of my Probability\/Statistics notebooks from Google Drive<\/a><\/p>\n<h2>Linear Regression<\/h2>\n<p>This notebook contains a command called RegressionAnalysis. \u00a0Given a list of data points <em>data,<\/em>\u00a0RegressionAnalysis[ <em>data<\/em>,\u00a0<em>x<\/em> ] creates a manipulation which lets you explore common linear and non-linear regressions, view the adjusted R^2 values for them, and interpolate values. \u00a0I wrote this as a first attempt at duplicating some of the functionality of the stat package JMP within Mathematica; we&#8217;ve since moved from JMP to Mathematica for doing basic statistics in our Algebra for the Sciences course (using the LinearModelFit command rather than this code).<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/regress4.jpg\"><img decoding=\"async\" class=\"aligncenter size-full wp-image-168\" alt=\"regress4\" src=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/regress4.jpg\" width=\"450\" height=\"548\" srcset=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/regress4.jpg 450w, https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/regress4-246x300.jpg 246w\" sizes=\"(max-width: 450px) 100vw, 450px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/drive.google.com\/folderview?id=0BxSwUt0i0mImaEtDZ0hlMEdTWms&amp;usp=sharing\" target=\"_blank\" rel=\"noopener noreferrer\">Download this or other of my Probability\/Statistics notebooks from Google Drive<\/a><\/p>\n<h2>The Central Limit Theorem<\/h2>\n<p>This notebook lets you explore the Central Limit Theorem from probability &#8211; the theorem that says no matter what distribution you draw from, if you take averages of measurements the averages tend to be normally distributed (the larger the number of points being averaged, the closer you should get to the normal distribution). \u00a0The manipulation lets you select the initial distribution the data will come from, the number of data points per group for the average, and the number of groups to compute an average for. \u00a0For example in the picture below the 1000 data points are drawn from the highly non-normal exponential distribution; below that is the distribution of 100 averages (each average being of 10 points) from the same distribution. \u00a0Even though the original distribution doesn&#8217;t come close to a bell curve and 10 isn&#8217;t a large number of values to average, the distribution of the averages looks a lot more like a bell curve (typically you want to average 30 or more points to really get close to the bell curve).<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/centrallimit.jpg\"><img decoding=\"async\" class=\"aligncenter  wp-image-165\" alt=\"centrallimit\" src=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/centrallimit.jpg\" width=\"376\" height=\"666\" srcset=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/centrallimit.jpg 752w, https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/centrallimit-169x300.jpg 169w, https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/centrallimit-578x1024.jpg 578w\" sizes=\"(max-width: 376px) 100vw, 376px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/drive.google.com\/folderview?id=0BxSwUt0i0mImaEtDZ0hlMEdTWms&amp;usp=sharing\" target=\"_blank\" rel=\"noopener noreferrer\">Download this or other of my Probability\/Statistics notebooks from Google Drive<\/a><\/p>\n<h2>Longest Run in a Sequence<\/h2>\n<p>This notebook contains code I worked on with my Technology 2 class worked on for fun. \u00a0The idea was to have some experiment repeated over and over (like a coin flip or a die roll) and then take a look at the lengths of the runs in a sequence (both as a distribution in its own right and in terms of how long the longest run is). \u00a0This came from an old problem one of my coworkers would give to his classes: flip a coin 100 times and write the string of heads and tails. \u00a0Some people might be tempted to just make up the string of H&#8217;s and T&#8217;s, but most of those who would do so underestimate how long the runs of H&#8217;s or T&#8217;s would be. \u00a0The code accepts any list of objects (so you could just as easily look at runs when rolling a 10 sided die or a biased coin flip). \u00a0The two main commands defined are RunsInList (which gives you a list of the lengths of every run, so RunsInList[ {1,1,2,3,4}] would give you {2,1,1,1}) and LongestRunInList (which just gives the length of the longest run, so LongestRunInList[ {1,1,2,3,4}] would result in 2).<\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/longestruns2.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"aligncenter  wp-image-169\" style=\"border: 1px solid black\" alt=\"longestruns2\" src=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/longestruns2.jpg\" width=\"480\" height=\"350\" srcset=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/longestruns2.jpg 960w, https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/longestruns2-300x219.jpg 300w, https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/longestruns2-768x560.jpg 768w\" sizes=\"(max-width: 480px) 100vw, 480px\" \/><\/a><\/p>\n<p style=\"text-align: center\"><a href=\"https:\/\/drive.google.com\/folderview?id=0BxSwUt0i0mImaEtDZ0hlMEdTWms&amp;usp=sharing\" target=\"_blank\" rel=\"noopener noreferrer\">Download this or other of my Probability\/Statistics notebooks from Google Drive<\/a><\/p>\n<p><a title=\"Mathematica Notebook Library\" href=\"http:\/\/homepages.se.edu\/cmoretti\/main\/mathematicalibrarymain\/\">Back to my Mathematica Library<\/a><\/p>\n<p><a title=\"Dr. Christopher Moretti\u2019s Homepage\" href=\"http:\/\/homepages.se.edu\/cmoretti\/\">Back to my homepage<\/a><\/p>\n<p><a title=\"Southeastern main page\" href=\"http:\/\/www.se.edu\">Back to the Southeastern Main Page<\/a>\t\t<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Mathematica Notebooks for Probability and Statistics Important Note:\u00a0The links for the notebooks open a new window or tab with a Google Drive page &#8211; the current settings for our homepages [&hellip;]<\/p>\n","protected":false},"author":24,"featured_media":0,"parent":19,"menu_order":0,"comment_status":"open","ping_status":"open","template":"page-templates\/page-with-sidebar.php","meta":{"footnotes":""},"class_list":["post-50","page","type-page","status-publish","hentry"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v25.9 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Dr Moretti&#039;s Mathematica Notebooks - Probability\/Statistics -<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Dr Moretti&#039;s Mathematica Notebooks - Probability\/Statistics -\" \/>\n<meta property=\"og:description\" content=\"Mathematica Notebooks for Probability and Statistics Important Note:\u00a0The links for the notebooks open a new window or tab with a Google Drive page &#8211; the current settings for our homepages [&hellip;]\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/\" \/>\n<meta property=\"article:modified_time\" content=\"2019-10-28T15:42:41+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means.jpg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/\",\"url\":\"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/\",\"name\":\"Dr Moretti's Mathematica Notebooks - Probability\/Statistics -\",\"isPartOf\":{\"@id\":\"https:\/\/www.se.edu\/cmoretti\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means.jpg\",\"datePublished\":\"2013-05-29T21:12:27+00:00\",\"dateModified\":\"2019-10-28T15:42:41+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/#primaryimage\",\"url\":\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means.jpg\",\"contentUrl\":\"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means.jpg\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/www.se.edu\/cmoretti\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Dr. Moretti&#8217;s Mathematica Notebook Library\",\"item\":\"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/\"},{\"@type\":\"ListItem\",\"position\":3,\"name\":\"Dr Moretti&#8217;s Mathematica Notebooks &#8211; Probability\/Statistics\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/www.se.edu\/cmoretti\/#website\",\"url\":\"https:\/\/www.se.edu\/cmoretti\/\",\"name\":\"\",\"description\":\"Just another Southeastern Oklahoma State Sites site\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/www.se.edu\/cmoretti\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Dr Moretti's Mathematica Notebooks - Probability\/Statistics -","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/","og_locale":"en_US","og_type":"article","og_title":"Dr Moretti's Mathematica Notebooks - Probability\/Statistics -","og_description":"Mathematica Notebooks for Probability and Statistics Important Note:\u00a0The links for the notebooks open a new window or tab with a Google Drive page &#8211; the current settings for our homepages [&hellip;]","og_url":"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/","article_modified_time":"2019-10-28T15:42:41+00:00","og_image":[{"url":"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means.jpg","type":"","width":"","height":""}],"twitter_card":"summary_large_image","twitter_misc":{"Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/","url":"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/","name":"Dr Moretti's Mathematica Notebooks - Probability\/Statistics -","isPartOf":{"@id":"https:\/\/www.se.edu\/cmoretti\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/#primaryimage"},"image":{"@id":"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/#primaryimage"},"thumbnailUrl":"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means.jpg","datePublished":"2013-05-29T21:12:27+00:00","dateModified":"2019-10-28T15:42:41+00:00","breadcrumb":{"@id":"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/#primaryimage","url":"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means.jpg","contentUrl":"https:\/\/www.se.edu\/cmoretti\/wp-content\/uploads\/sites\/81\/2013\/05\/means.jpg"},{"@type":"BreadcrumbList","@id":"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/mathematica-notebooks-probabilitystatistics\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.se.edu\/cmoretti\/"},{"@type":"ListItem","position":2,"name":"Dr. Moretti&#8217;s Mathematica Notebook Library","item":"https:\/\/www.se.edu\/cmoretti\/main\/mathematicalibrarymain\/"},{"@type":"ListItem","position":3,"name":"Dr Moretti&#8217;s Mathematica Notebooks &#8211; Probability\/Statistics"}]},{"@type":"WebSite","@id":"https:\/\/www.se.edu\/cmoretti\/#website","url":"https:\/\/www.se.edu\/cmoretti\/","name":"","description":"Just another Southeastern Oklahoma State Sites site","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.se.edu\/cmoretti\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"}]}},"_links":{"self":[{"href":"https:\/\/www.se.edu\/cmoretti\/wp-json\/wp\/v2\/pages\/50","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.se.edu\/cmoretti\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/www.se.edu\/cmoretti\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/www.se.edu\/cmoretti\/wp-json\/wp\/v2\/users\/24"}],"replies":[{"embeddable":true,"href":"https:\/\/www.se.edu\/cmoretti\/wp-json\/wp\/v2\/comments?post=50"}],"version-history":[{"count":1,"href":"https:\/\/www.se.edu\/cmoretti\/wp-json\/wp\/v2\/pages\/50\/revisions"}],"predecessor-version":[{"id":457,"href":"https:\/\/www.se.edu\/cmoretti\/wp-json\/wp\/v2\/pages\/50\/revisions\/457"}],"up":[{"embeddable":true,"href":"https:\/\/www.se.edu\/cmoretti\/wp-json\/wp\/v2\/pages\/19"}],"wp:attachment":[{"href":"https:\/\/www.se.edu\/cmoretti\/wp-json\/wp\/v2\/media?parent=50"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}