Challenge!!
The shortest Bayesian estimation in the world(?)
世界一短いベイズ推定への挑戦。

Mac OS Sierra 10.12.1; R version3.3.1
 

The shortest(2017/05/19 16:14)

hojo.png
2017/05/19 16:14 Daiki Hojo(@dastatis)
“Thanks to all contributors. Improper? Never mind!”

library(rstan)
stan_hist(stan(,,"parameters{real p;}"))

dastatis2.png

The shortest proper sampling

2017/05/19 16:10 Kentaro Matsuura(@berobero11) “It does not need the model{} block, in the recent version!”

library(rstan)
stan_hist(stan(,,"parameters{simplex[2] p;}"))

berobero11.png


2017/05/19 14:20 Mr.Unadon(@MrUnadon) “Thanks to all contributors below. Now that this is the shortest stan code, I think.”

library(rstan)
stan_hist(stan(,,"parameters{simplex[2] p;}model{}"))

Advised3.png

Excelent! graphics code!

2017/05/19 12:00 Daiki Hojo(@dastatis)

“In the case of focusing the graphic expression, this may be the shortest.”

library(rstan)
stan_hist(stan(,,"parameters{real p;}model{p~gamma(9,1);}"))

dastatisStanHist.jpg

Excelent! sampling from the data!

2017/05/19 09:20 Hiroshi Shimizu(@simizu706) “In the case of estimation from data, this code will be the shortest.” (reported only stan code)

library(rstan)
#stan model code
"parameters{real p;}model{9 ~ poisson_log(p);}"

shimizuPoisson.png


2017/05/19 09:00 Hiroshi Shimizu(@simizu706)

“This will be the shortest stan code. Warning? Never mind.” (reported only stan code)

library(rstan)
#stan model code
"parameters{real p;}model{p~beta(9,9);}"

shimizuBeta.png


2017/05/19 00:20 Mr.Unadon(@MrUnadon)

library(rstan)
hist(extract(stan(,,"parameters{real p;}model{p~gamma(9,1);}"))$p)

Revised2.png


2017/05/19 00:00 Thanks to Mr.kos59125(He gave me an excellent advice), and revised by…

Mr.Unadon(@MrUnadon)
library(rstan)
hist(extract(stan(,,"parameters{simplex[2]p;}model{1~bernoulli(p[1]);}"))$p[,1])

Revised1.png

Excelent! Theoretical expression!

2017/05/18 22:40 Reported and Advised by…

kos59125(@kos59125)
library(rstan)
hist(extract(stan(model_code="parameters{simplex[2]p;}model{1~bernoulli(p[1]);}"))$p[,1])

Advised1.png


2017/05/18 21:40 First Report

Mr.Unadon(@MrUnadon)
library(rstan)
hist(extract(stan(model_code="parameters{real<lower=0,upper=1>p;}model{int N;N=1;N~bernoulli(p);}"))$p)

shortestStanPlot.png


Enjoy!!

Written on May 18, 2017