{"id":77,"date":"2024-12-17T18:17:51","date_gmt":"2024-12-17T18:17:51","guid":{"rendered":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/?p=77"},"modified":"2026-03-22T17:35:27","modified_gmt":"2026-03-22T17:35:27","slug":"a-multi-modal-distribution","status":"publish","type":"post","link":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/2024\/12\/17\/a-multi-modal-distribution\/","title":{"rendered":"A multi-modal distribution."},"content":{"rendered":"\n<p>I created a simple bivariate distribution which I will describe in this post. This is a toy example of a multi-modal distribution which I used to test different MCMC methods including parallel tempering and HMC for one of the first reports I wrote for the MRes. <\/p>\n\n\n\n<p>The distribution is a mixture of bivariate normal distributions, with means at the vertices of a regular polygon in the plane.<\/p>\n\n\n\n<p>That is for some <span class=\"wp-katex-eq\" data-display=\"false\">n<\/span>-gon, we place our modes <span class=\"wp-katex-eq\" data-display=\"false\">\\mu_k<\/span> the vertices are at the points<\/p>\n\n\n<span class=\"wp-katex-eq\" data-display=\"false\">\\mu_k = R ( \\cos \\left( \\frac{2\\pi k}{n}\\right), \\sin\\left( \\frac{2\\pi k}{n}\\right))^t, \\ \\text{ for } k = 1,2,\\ldots, n. <\/span>\n\n\n\n<p>The mixture target distribution is a weighted sum of multivariate normal distributions,<\/p>\n\n\n<span class=\"wp-katex-eq\" data-display=\"false\">\\pi(x) = \\sum_{k=1}^n w_k N(\\mu_k,\\Sigma_k).<\/span>\n\n\n\n<p>The weights are such that <span class=\"wp-katex-eq\" data-display=\"false\">\\sum_{k=1}^n w_k =1<\/span>. For example, one can take <span class=\"wp-katex-eq\" data-display=\"false\">w_k = \\frac{1}{n}<\/span>. Now I would like each of the covariance matrices to be oriented such that the principal eigenvector points towards the origin. We can achieve this by means of a change of basis,<\/p>\n\n\n<span class=\"wp-katex-eq\" data-display=\"false\">\\Sigma_k = \\begin{pmatrix}\\cos \\left( \\frac{2\\pi k}{n}\\right) &amp; -\\sin \\left( \\frac{2\\pi k}{n}\\right) \\\\ \\sin \\left( \\frac{2\\pi k}{n}\\right) &amp; \\cos \\left( \\frac{2\\pi k}{n}\\right)\\end{pmatrix}\\begin{pmatrix} \\sigma_1^2 &amp; 0 \\\\ 0 &amp; \\sigma_2^2 \\end{pmatrix}\\begin{pmatrix}\\cos \\left( \\frac{2\\pi k}{n}\\right) &amp; -\\sin \\left( \\frac{2\\pi k}{n}\\right) \\\\ \\sin \\left( \\frac{2\\pi k}{n}\\right) &amp; \\cos \\left( \\frac{2\\pi k}{n}\\right)\\end{pmatrix}^{-1}.<\/span>\n\n\n\n<p>Here&#8217;s an example:<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" width=\"1024\" height=\"688\" src=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-content\/uploads\/sites\/64\/2024\/12\/Rplot02-1024x688.png\" alt=\"\" class=\"wp-image-159\" srcset=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-content\/uploads\/sites\/64\/2024\/12\/Rplot02-1024x688.png 1024w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-content\/uploads\/sites\/64\/2024\/12\/Rplot02-300x201.png 300w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-content\/uploads\/sites\/64\/2024\/12\/Rplot02-768x516.png 768w, https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-content\/uploads\/sites\/64\/2024\/12\/Rplot02.png 1029w\" sizes=\"auto, (max-width: 1024px) 100vw, 1024px\" \/><\/figure>\n\n\n\n<p>I used this distribution to study the effectiveness of different MCMC tempering methods with multi-modal target distributions, which I wrote up as a short report in my first term at STOR-i. See below for the report, and I hope you find it as interesting as I did exploring these methods. <\/p>\n\n\n\n<div data-wp-interactive=\"core\/file\" class=\"wp-block-file\"><object data-wp-bind--hidden=\"!state.hasPdfPreview\" hidden class=\"wp-block-file__embed\" data=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-content\/uploads\/sites\/64\/2024\/12\/STOR608_Sprint_3_report_Malcolm_Connolly.pdf\" type=\"application\/pdf\" style=\"width:100%;height:600px\" aria-label=\"Embed of STOR608_Sprint_3_report_Malcolm_Connolly.\"><\/object><a id=\"wp-block-file--media-a3f96844-0350-4195-8f4a-2aa3ef1261bc\" href=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-content\/uploads\/sites\/64\/2024\/12\/STOR608_Sprint_3_report_Malcolm_Connolly.pdf\">STOR608_Sprint_3_report_Malcolm_Connolly<\/a><a href=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-content\/uploads\/sites\/64\/2024\/12\/STOR608_Sprint_3_report_Malcolm_Connolly.pdf\" class=\"wp-block-file__button wp-element-button\" download aria-describedby=\"wp-block-file--media-a3f96844-0350-4195-8f4a-2aa3ef1261bc\">Download<\/a><\/div>\n","protected":false},"excerpt":{"rendered":"<p>I created a simple bivariate distribution which I will describe in this post. This is a toy example of a multi-modal distribution which I used to test different MCMC methods including parallel tempering and HMC for one of the first &hellip; <a href=\"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/2024\/12\/17\/a-multi-modal-distribution\/\">Continue reading <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":84,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8],"tags":[14,13,15],"class_list":["post-77","post","type-post","status-publish","format-standard","hentry","category-probability","tag-bivariate","tag-distribution","tag-mixture"],"_links":{"self":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-json\/wp\/v2\/posts\/77","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-json\/wp\/v2\/users\/84"}],"replies":[{"embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-json\/wp\/v2\/comments?post=77"}],"version-history":[{"count":24,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-json\/wp\/v2\/posts\/77\/revisions"}],"predecessor-version":[{"id":213,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-json\/wp\/v2\/posts\/77\/revisions\/213"}],"wp:attachment":[{"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-json\/wp\/v2\/media?parent=77"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-json\/wp\/v2\/categories?post=77"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.lancaster.ac.uk\/stor-i-student-sites\/malcolm-connolly\/wp-json\/wp\/v2\/tags?post=77"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}