Archive for bug
no [Google] play
Posted in Travel with tags British Columbia, bug, cellphone, Golden, Google, Google Play, vacations on September 14, 2023 by xi'angolden bug [jatp]
Posted in pictures, Travel with tags bug, garden, jatp, scarab beetle, summer on August 11, 2021 by xi'angenuine Latinsquare rectangle
Posted in Books, pictures, Statistics, Travel, University life with tags art restoration, bioweapon, bug, Choi Seok-jeong, Firenze, Florence, Italia, latin square, Leonhard Euler, Medicis, NYT, sacrophagus, Serratia ficaria SH7 on June 9, 2021 by xi'an
the strange occurrence of the one bump
Posted in Books, Kids, R, Statistics with tags accept-reject algorithm, bug, code golf, cross validated, debugging, Gamma generator, mixture of distributions, R, sample on June 8, 2020 by xi'anWhen answering an X validated question on running an accept-reject algorithm for the Gamma distribution by using a mixture of Beta and drifted (bt 1) Exponential distributions, I came across the above glitch in the fit of my 10⁷ simulated sample to the target, apparently displaying a wrong proportion of simulations above (or below) one.
a=.9 g<-function(T){ x=rexp(T) v=rt(T,1)<0 x=c(1+x[v],exp(-x/a)[!v]) x[runif(T)<x^a/x/exp(x)/((x>1)*exp(1-x)+a*(x<1)*x^a/x)*a]}
It took me a while to spot the issue, namely that the output of
z=g(T) while(sum(!!z)<T)z=c(z,g(T)) z[1:T]
was favouring simulations from the drifted exponential by truncating. Permuting the elements of z before returning solved the issue (as shown below for a=½)!