<p><div><div><div><div data-show-faces="false" data-height="21" data-width="100" data-layout="button_count" data-send="true" data-href="https://www.r-bloggers.com/likelihood-calculation-for-the-g-and-k-distribution/"></div></div><div></div></div><div></div></div>
<div>
(This article was first published on <strong><a href="https://statisfaction.wordpress.com/2017/06/11/likelihood-calculation-for-the-g-and-k-distribution/"> R – Statisfaction</a></strong>, and kindly contributed to <a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers)</a> </div>
<p> </p>
<div data-shortcode="caption" class="wp-caption"><img data-orig-file="https://statisfaction.files.wordpress.com/2017/06/gandkhistogram.png" data-orig-size="800,709" data-medium-file="https://statisfaction.files.wordpress.com/2017/06/gandkhistogram.png?w=400" data-attachment-id="5052" data-image-meta="{" data-image-description="" src="https://statisfaction.files.wordpress.com/2017/06/gandkhistogram.png?w=400&h=355&fit=450%2C600" data-permalink="https://statisfaction.wordpress.com/2017/06/11/likelihood-calculation-for-the-g-and-k-distribution/gandkhistogram/" data-large-file="https://statisfaction.files.wordpress.com/2017/06/gandkhistogram.png?w=720" alt="gandkhistogram" data-image-title="gandkhistogram" sizes="(max-width: 400px) 100vw, 400px" data-comments-opened="1" class="wp-image-5052" data-recalc-dims="1">
<p class="wp-caption-text">Histogram of 1e5 samples from the g-and-k distribution, and overlaid probability density function</p>
</div>
<p> </p>
<p>Hello,</p>
<p>An example often used in the ABC literature is the g-and-k distribution (e.g. reference [1] below), which is defined through the inverse of its cumulative distribution function (cdf). It is easy to simulate from such distributions by drawing uniform variables and applying the inverse cdf to them. However, since there is no closed-form formula for the probability density function (pdf) of the g-and-k distribution, the likelihood is often considered intractable. It has been noted in [2] that one can still numerically compute the pdf, by 1) numerically inverting the quantile function to get the cdf, and 2)  numerically differentiating the cdf, using finite differences, for instance. As it happens, this is very easy to implement, and I coded up an R tutorial at:</p>
<p><a rel="nofollow" href="https://github.com/pierrejacob/winference/blob/master/inst/tutorials/tutorial_gandk.pdf" target="_blank">github.com/pierrejacob/winference/blob/master/inst/tutorials/tutorial_gandk.pdf</a></p>
<p>for anyone interested. This is part of the <a rel="nofollow" href="https://github.com/pierrejacob/winference" target="_blank">winference</a> package that goes with our tech report on <a rel="nofollow" href="https://arxiv.org/abs/1701.05146" target="_blank">ABC with the Wasserstein distance</a>  (<a rel="nofollow" href="https://statisfaction.wordpress.com/2017/01/27/statistical-inference-with-the-wasserstein-distance/" target="_blank">joint work with Espen Bernton, Mathieu Gerber and Christian Robert</a>, to be updated very soon!). This enables standard MCMC algorithms for the g-and-k example. It is also very easy to compute the likelihood for the multivariate extension of [3], since it only involves a fixed number of one-dimensional numerical inversions and differentiations (as opposed to a multivariate inversion).</p>
<p>Surprisingly, most of the papers that present the g-and-k example do not compare their ABC approximations to the posterior; instead, they typically compare the proposed ABC approach to existing ones. Similarly, the so-called Ricker model is commonly used in the ABC literature, and its posterior can be tackled efficiently using particle MCMC methods; as well as the M/G/1 model, which can be tackled either with particle MCMC methods or with tailor-made MCMC approaches such as [4].</p>
<p>These examples can still have great pedagogical value in ABC papers, but it would perhaps be nice to see more comparisons to the ground truth when it’s available; ground truth here being the actual posterior distribution.</p>
<ol>
<li>Fearnhead, P. and Prangle, D. (2012) Constructing summary statistics for approximate Bayesian computation: semi-automatic approximate Bayesian computation. Journal of the Royal Statistical Society: Series B, 74, 419–474.</li>
<li>Rayner, G. D. and MacGillivray, H. L. (2002) Numerical maximum likelihood estimation for the g-and-k and generalized g-and-h distributions. Statistics and Computing, 12, 57–75.</li>
<li>Drovandi, C. C. and Pettitt, A. N. (2011) Likelihood-free Bayesian estimation of multivari- ate quantile distributions. Computational Statistics &amp; Data Analysis, 55, 2541–2556.</li>
<li>Shestopaloff, A. Y. and Neal, R. M. (2014) On Bayesian inference for the M/G/1 queue with efficient MCMC sampling. arXiv preprint arXiv:1401.5548.</li>
</ol>
<p> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/statisfaction.wordpress.com/4993/" target="_blank"><img border="0" alt="" src="http://feeds.wordpress.com/1.0/comments/statisfaction.wordpress.com/4993/"></a> <img border="0" alt="" src="https://i1.wp.com/pixel.wp.com/b.gif?resize=1%2C1&ssl=1" data-recalc-dims="1"></p>
	<p>
<div>
<div>To <strong>leave a comment</strong> for the author, please follow the link and comment on their blog: <strong><a href="https://statisfaction.wordpress.com/2017/06/11/likelihood-calculation-for-the-g-and-k-distribution/"> R – Statisfaction</a></strong>.</div>
<hr>
<a rel="nofollow" href="https://www.r-bloggers.com/">R-bloggers.com</a> offers <strong><a rel="nofollow" href="https://feedburner.google.com/fb/a/mailverify?uri=RBloggers">daily e-mail updates</a></strong> about <a rel="nofollow" href="https://www.r-project.org/" title="The R Project for Statistical Computing">R</a> news and <a rel="nofollow" href="https://www.r-bloggers.com/search/tutorial" title="R tutorials">tutorials</a> on topics such as: <a rel="nofollow" href="https://www.r-bloggers.com/search/data%20science" title="Data science">Data science</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Big%20Data" title="Big Data">Big Data, <a rel="nofollow" href="https://www.r-users.com/" title="R jobs">R jobs</a>, visualization (<a rel="nofollow" href="https://www.r-bloggers.com/search/ggplot2" title="ggplot and ggplot2 tutorials">ggplot2</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/boxplot" title="Boxplots using lattice and ggplot2 tutorials">Boxplots</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/map" title="Maps and gis">maps</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/animation" title="Animation in R">animation</a>), programming (<a rel="nofollow" href="https://www.r-bloggers.com/search/RStudio" title="RStudio IDE for R">RStudio</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/sweave" title="Sweave and literate programming">Sweave</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/LaTeX" title="LaTeX in R">LaTeX</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/SQL" title="SQL and databases">SQL</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/eclipse" title="Eclipse IDE for R">Eclipse</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/git" title="git and github, Version Control System">git</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/hadoop" title="Large data in R using Hadoop">hadoop</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/Web+Scraping" title="Web Scraping of google, facebook, yahoo, twitter and more using R">Web Scraping</a>) statistics (<a rel="nofollow" href="https://www.r-bloggers.com/search/regression" title="Regressions and ANOVA analysis tutorials">regression</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/PCA" title="principal component analysis tutorial">PCA</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/time+series" title="Time series">time series</a>, <a rel="nofollow" href="https://www.r-bloggers.com/search/trading" title="finance trading">trading</a>) and more...

	<img alt="" width="1" src="http://feeds.feedburner.com/~r/RBloggers/~4/RGdDzyMgSqw" height="1"></a></div>