{"id":381825,"date":"2024-02-01T17:24:31","date_gmt":"2024-02-01T23:24:31","guid":{"rendered":"http:\/\/xianblog.wordpress.com\/?p=55064"},"modified":"2024-02-01T17:24:31","modified_gmt":"2024-02-01T23:24:31","slug":"simulating-signed-mixtures","status":"publish","type":"post","link":"https:\/\/www.r-bloggers.com\/2024\/02\/simulating-signed-mixtures\/","title":{"rendered":"simulating signed mixtures"},"content":{"rendered":"<!-- \r\n<div style=\"min-height: 30px;\">\r\n[social4i size=\"small\" align=\"align-left\"]\r\n<\/div>\r\n-->\r\n\r\n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 12px;\">\r\n[This article was first published on  <strong><a href=\"https:\/\/xianblog.wordpress.com\/2024\/02\/02\/simulating-signed-mixtures\/\"> R \u2013 Xi&#039;an&#039;s Og<\/a><\/strong>, and kindly contributed to <a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers<\/a>].  (You can report issue about the content on this page <a href=\"https:\/\/www.r-bloggers.com\/contact-us\/\">here<\/a>)\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>\n<p><a href=\"https:\/\/arxiv.org\/abs\/2401.16828\" rel=\"nofollow\" target=\"_blank\"><img loading=\"lazy\" data-attachment-id=\"55065\" data-permalink=\"https:\/\/xianblog.wordpress.com\/2024\/02\/02\/simulating-signed-mixtures\/output-1\/\" data-orig-file=\"https:\/\/xianblog.files.wordpress.com\/2024\/01\/output-1.jpg\" data-orig-size=\"2100,1555\" data-comments-opened=\"1\" data-image-meta=\"{\"aperture\":\"0\",\"credit\":\"\",\"camera\":\"\",\"caption\":\"\",\"created_timestamp\":\"0\",\"copyright\":\"\",\"focal_length\":\"0\",\"iso\":\"0\",\"shutter_speed\":\"0\",\"title\":\"\",\"orientation\":\"0\"}\" data-image-title=\"output-1\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/xianblog.files.wordpress.com\/2024\/01\/output-1.jpg?w=300\" data-large-file=\"https:\/\/xianblog.files.wordpress.com\/2024\/01\/output-1.jpg?w=450\" class=\"aligncenter wp-image-55065\" src=\"https:\/\/xianblog.files.wordpress.com\/2024\/01\/output-1.jpg?w=447&#038;resize=447%2C331#038;h=331\" alt=\"\" width=\"447\" height=\"331\" srcset_temp=\"https:\/\/xianblog.files.wordpress.com\/2024\/01\/output-1.jpg?w=447&#038;resize=447%2C331#038;h=331 447w, https:\/\/xianblog.files.wordpress.com\/2024\/01\/output-1.jpg?w=894&#038;h=662 894w, https:\/\/xianblog.files.wordpress.com\/2024\/01\/output-1.jpg?w=128&#038;h=96 128w, https:\/\/xianblog.files.wordpress.com\/2024\/01\/output-1.jpg?w=300&#038;h=222 300w, https:\/\/xianblog.files.wordpress.com\/2024\/01\/output-1.jpg?w=768&#038;h=569 768w\" sizes=\"(max-width: 447px) 100vw, 447px\" data-recalc-dims=\"1\" \/><\/a><\/p>\n<p style=\"text-align: justify\"><strong>W<\/strong>hile simulating from a mixture of standard densities is relatively straightforward, when the component densities are easily simulated, to the point that <a href=\"https:\/\/amzn.to\/3Slca6D\" rel=\"nofollow\" target=\"_blank\">many simulation methods<\/a> exploit an intermediary mixture construction to speed up the production of pseudo-random samples from more challenging distributions (see <a href=\"https:\/\/amzn.to\/3Slca6D\" rel=\"nofollow\" target=\"_blank\">Devroye<\/a>, 1986), things get surprisingly more complicated when the mixture weights can take negative values. For instance, the na\u00efve solution consisting in first simulating from the associated mixture of positive weight components<br \/>\nand then using an <a href=\"https:\/\/amzn.to\/3Slca6D\" rel=\"nofollow\" target=\"_blank\">accept-reject step<\/a> may prove highly inefficient since the overall probability of acceptance<\/p>\n<p style=\"text-align: center\"><img src=\"https:\/\/s0.wp.com\/latex.php?latex=%7B%5Cdisplaystyle+1%7D%5CBig%2F%7B%5Cdisplaystyle+%5Csum_%7Bk%3D1%7D%5E%7BP%7D+%5Comega_k%5E%2B%7D&#038;bg=000000&#038;%23038;fg=B0B0B0&#038;%23038;s=0&#038;%23038;c=20201002\" srcset_temp=\"https:\/\/s0.wp.com\/latex.php?latex=%7B%5Cdisplaystyle+1%7D%5CBig%2F%7B%5Cdisplaystyle+%5Csum_%7Bk%3D1%7D%5E%7BP%7D+%5Comega_k%5E%2B%7D&#038;bg=000000&#038;fg=B0B0B0&#038;s=0&#038;c=20201002 1x, https:\/\/s0.wp.com\/latex.php?latex=%7B%5Cdisplaystyle+1%7D%5CBig%2F%7B%5Cdisplaystyle+%5Csum_%7Bk%3D1%7D%5E%7BP%7D+%5Comega_k%5E%2B%7D&#038;bg=000000&#038;fg=B0B0B0&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x\" alt=\"{\\displaystyle 1}\\Big\/{\\displaystyle \\sum_{k=1}^{P} \\omega_k^+}\" class=\"latex\" \/><\/p>\n<p style=\"text-align: justify\">is the inverse of the sum of the positive weights and hence can be arbitrarily close to zero. The intuition for such inefficiency is that simulating from the positive weight components need not produce values within regions of high probability for the actual distribution<\/p>\n<p style=\"text-align: center\"><img src=\"https:\/\/s0.wp.com\/latex.php?latex=m+%3D+%5Csum_%7Bk%3D1%7D%5EP+%5Comega_k%5E%2B+f_k+-+%5Csum_%7Bk%3D1%7D%5EN+%5Comega_k%5E-+g_k&#038;bg=000000&#038;%23038;fg=B0B0B0&#038;%23038;s=0&#038;%23038;c=20201002\" srcset_temp=\"https:\/\/s0.wp.com\/latex.php?latex=m+%3D+%5Csum_%7Bk%3D1%7D%5EP+%5Comega_k%5E%2B+f_k+-+%5Csum_%7Bk%3D1%7D%5EN+%5Comega_k%5E-+g_k&#038;bg=000000&#038;fg=B0B0B0&#038;s=0&#038;c=20201002 1x, https:\/\/s0.wp.com\/latex.php?latex=m+%3D+%5Csum_%7Bk%3D1%7D%5EP+%5Comega_k%5E%2B+f_k+-+%5Csum_%7Bk%3D1%7D%5EN+%5Comega_k%5E-+g_k&#038;bg=000000&#038;fg=B0B0B0&#038;s=0&#038;c=20201002&#038;zoom=4.5 4x\" alt=\"m = \\sum_{k=1}^P \\omega_k^+ f_k - \\sum_{k=1}^N \\omega_k^- g_k\" class=\"latex\" \/><\/p>\n<p style=\"text-align: justify\">since its negative weight components may remove most of the mass under the positive weight components. In other words, the negative weight components do not have a natural latent variable interpretation and the resulting mixture can be anything, as the above graph testifies.<\/p>\n<p style=\"text-align: justify\"><a href=\"https:\/\/arxiv.org\/abs\/2401.16828\" rel=\"nofollow\" target=\"_blank\"><img loading=\"lazy\" data-attachment-id=\"55074\" data-permalink=\"https:\/\/xianblog.wordpress.com\/2024\/02\/02\/simulating-signed-mixtures\/fig4-2\/\" data-orig-file=\"https:\/\/xianblog.files.wordpress.com\/2024\/01\/fig4.png\" data-orig-size=\"1109,990\" data-comments-opened=\"1\" data-image-meta=\"{\"aperture\":\"0\",\"credit\":\"\",\"camera\":\"\",\"caption\":\"\",\"created_timestamp\":\"0\",\"copyright\":\"\",\"focal_length\":\"0\",\"iso\":\"0\",\"shutter_speed\":\"0\",\"title\":\"\",\"orientation\":\"0\"}\" data-image-title=\"Fig4\" data-image-description=\"\" data-image-caption=\"\" data-medium-file=\"https:\/\/xianblog.files.wordpress.com\/2024\/01\/fig4.png?w=300\" data-large-file=\"https:\/\/xianblog.files.wordpress.com\/2024\/01\/fig4.png?w=450\" class=\"aligncenter wp-image-55074\" src=\"https:\/\/xianblog.files.wordpress.com\/2024\/01\/fig4.png?w=450#038;h=504\" alt=\"\" srcset_temp=\"https:\/\/xianblog.files.wordpress.com\/2024\/01\/fig4.png?w=450#038;h=504 564w, https:\/\/xianblog.files.wordpress.com\/2024\/01\/fig4.png?w=108&#038;h=96 108w, https:\/\/xianblog.files.wordpress.com\/2024\/01\/fig4.png?w=300&#038;h=268 300w, https:\/\/xianblog.files.wordpress.com\/2024\/01\/fig4.png?w=768&#038;h=686 768w, https:\/\/xianblog.files.wordpress.com\/2024\/01\/fig4.png 1109w\" sizes=\"(max-width: 564px) 100vw, 564px\" data-recalc-dims=\"1\" \/><\/a>Julien Stoehr (Paris Dauphine) and I started investigating this interesting challenge when the Master students who had been exposed to said challenge could not dent it in any meaningful way. We have now <a href=\"https:\/\/arxiv.org\/abs\/2401.16828\" rel=\"nofollow\" target=\"_blank\">arXived<\/a> a specific algorithm that proves superior to the na\u00efve <a href=\"https:\/\/amzn.to\/3Slca6D\" rel=\"nofollow\" target=\"_blank\">accept-reject <\/a> algorithm, but also to the numerical cdf inversion (which happens to be available in this setting). Compared with the na\u00efve version, we construct an <a href=\"https:\/\/arxiv.org\/abs\/2401.16828\" rel=\"nofollow\" target=\"_blank\">alternative accept-reject scheme<\/a> based on pairing positive and negative components as well as possible, partitioning the real line, and finding tighter upper and lower bounds on positive and negative components, respectively, towards yielding a <a href=\"https:\/\/hal.science\/hal-04423887\" rel=\"nofollow\" target=\"_blank\">higher acceptance rate<\/a> on average. Designing a random generator of signed mixtures with enough variability and representativity proved a challenge in itself!<\/p>\n\n<div style=\"border: 1px solid; background: none repeat scroll 0 0 #EDEDED; margin: 1px; font-size: 13px;\">\r\n<div style=\"text-align: center;\">To <strong>leave a comment<\/strong> for the author, please follow the link and comment on their blog: <strong><a href=\"https:\/\/xianblog.wordpress.com\/2024\/02\/02\/simulating-signed-mixtures\/\"> R \u2013 Xi&#039;an&#039;s Og<\/a><\/strong>.<\/div>\r\n<hr \/>\r\n<a href=\"https:\/\/www.r-bloggers.com\/\" rel=\"nofollow\">R-bloggers.com<\/a> offers <strong><a href=\"https:\/\/feedburner.google.com\/fb\/a\/mailverify?uri=RBloggers\" rel=\"nofollow\">daily e-mail updates<\/a><\/strong> about <a title=\"The R Project for Statistical Computing\" href=\"https:\/\/www.r-project.org\/\" rel=\"nofollow\">R<\/a> news and tutorials about <a title=\"R tutorials\" href=\"https:\/\/www.r-bloggers.com\/how-to-learn-r-2\/\" rel=\"nofollow\">learning R<\/a> and many other topics. <a title=\"Data science jobs\" href=\"https:\/\/www.r-users.com\/\" rel=\"nofollow\">Click here if you're looking to post or find an R\/data-science job<\/a>.\r\n\r\n<hr>Want to share your content on R-bloggers?<a href=\"https:\/\/www.r-bloggers.com\/add-your-blog\/\" rel=\"nofollow\"> click here<\/a> if you have a blog, or <a href=\"http:\/\/r-posts.com\/\" rel=\"nofollow\"> here<\/a> if you don't.\r\n<\/div>","protected":false},"excerpt":{"rendered":"<div style = \"width:60%; display: inline-block; float:left; \"> While simulating from a mixture of standard densities is relatively straightforward, when the component densities are easily simulated, to the point that many simulation methods exploit an intermediary mixture construction to speed up the production of pseudo-random samples from more challenging distributions (see Devroye, 1986), things get surprisingly more complicated when &#8230;<\/div>\n<div style = \"width: 40%; display: inline-block; float:right;\"><\/div>\n<div style=\"clear: both;\"><\/div>\n","protected":false},"author":56,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[4],"tags":[],"aioseo_notices":[],"jetpack-related-posts":[],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/381825"}],"collection":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/users\/56"}],"replies":[{"embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/comments?post=381825"}],"version-history":[{"count":6,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/381825\/revisions"}],"predecessor-version":[{"id":388597,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/posts\/381825\/revisions\/388597"}],"wp:attachment":[{"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/media?parent=381825"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/categories?post=381825"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.r-bloggers.com\/wp-json\/wp\/v2\/tags?post=381825"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}