Publications by xi'an
a common confusion between sample and population moments
Related To leave a comment for the author, please follow the link and comment on their blog: R – Xi'an's Og. R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job. Want to share your content on R-bloggers? click here i...
397 sym 2 img
one-way random walks
A rather puzzling riddle from The Riddler on an 3×3 directed grid and the probability to get from the North-West to the South-East nodes following the arrows. Puzzling because while the solution could be reasonably computed with an R code like sucz=0 for(i in 1:2^12){ path=intToBits(i)[1:12] sol=0 for(j in 1:12)sol=max(sol, pr...
976 sym R (205 sym/1 pcs) 2 img
warped Cauchys
A somewhat surprising request on X validated about the inverse cdf representation of a warped Cauchy distribution. I had not come across this distribution, but its density being means that it is the superposition of shifted Cauchys on the unit circle (with nice complex representations). As such, it is easily simulated by re-shifting a Cauchy bac...
791 sym 6 img
unbalanced sampling
A question from X validated on sampling from an unknown density f when given both a sample from the density f restricted to a (known) interval A , f¹ say, and a sample from f restricted to the complement of A, f² say. Or at least on producing an estimate of the mass of A under f, p(A)… The problem sounds impossible to solve without an ability...
1637 sym 4 img
R rexp()
Following a question on X validated about the reasons for coding rexp() following Ahrens & Dieter (1972) version, I re-read Luc Devroye’s explanations. Which boils down to an optimised implementation of von Neumann’s Exponential generator. The central result is that, for any μ>0, M a Geometric variate with failure probability exp(-μ) and Z ...
1409 sym R (420 sym/1 pcs)
bean bag win
A quick riddle from The Riddler, where a multiple step game sees a probability of a 3 point increase of .4 and a probability of a 1 point increase of .3 with a first strategy (A), versus a probability of a 3 point increase of .4 and a probability of a 1 point increase of .3 with a second strategy (B), and a sure miss third strategy (C). The goal...
1003 sym R (215 sym/1 pcs) 2 img
more air for MCMC
Aki Vehtari, Andrew Gelman, Dan Simpson, Bob Carpenter, and Paul-Christian Bürkner have just published a Bayesian Analysis paper about using an improved R factor for MCMC convergence assessment. From the early days of MCMC, convergence assessment has been a recurring (and recurrent!) question in the community. First leading to a flurry of propos...
3111 sym 2 img
scale matters [maths as well]
A question from X validated on why an independent Metropolis sampler of a three component Normal mixture based on a single Normal proposal was failing to recover the said mixture… When looking at the OP’s R code, I did not notice anything amiss at first glance (I was about to drive back from Annecy, hence did not look too closely) and reran t...
1422 sym 4 img
on approximations of Φ and Φ⁻¹
As I was working on a research project with graduate students, I became interested in fast and not necessarily very accurate approximations to the normal cdf Φ and its inverse. Reading through this 2010 paper of Richards et al., using for instance (with another version replacing 2/π with the squared root of π/8) and $latex F_2(x)=1/1+exp(-1.5...
1020 sym R (372 sym/2 pcs) 4 img
inf R ! [book review]
Thanks to my answering a (basic) question on X validated involving an R code, R mistakes and some misunderstanding about Bayesian hierarchical modelling, I got pointed out to Patrick Burns’ The R inferno. This is not a recent book as the second edition is of 2012, with a 2011 version still available on-line. Which is the version I read. As hint...
3169 sym 2 img