I fit a lognormal model on some data points using both frequentist and Bayesian (using a non-informative prior) approaches. However, I got different results. Here are my codes and outputs:
Frequentist:
> data1 = c(0.32618457, 0.29166954, 0.27427996, 0.23844847, 0.25148180)
> n=length(data1)
>
> lln1 = function(par){ if(par[2]>0) return( -
> sum(log(dlnorm(exp(data1),par[1],par[2]))) ) else return(Inf) }
> optim(c(0,0.1),lln1)
>
> mu sigma
[1] 0.27641155 0.03091169
Bayesian with 20,000 MCMC and 4000 burn:
model
{
for( i in 1 : N )
{
x[i] ~ dlnorm(mu, tau)
}
mu ~ dunif(0, 1)
tau ~ dunif(0, 1)
sigma <- 1/tau
}
list(N = 5, x = c(0.32618457, 0.29166954, 0.27427996, 0.23844847, 0.25148180))
Node mean sd MC error 2.5% median 97.5% start sample
mu 0.2417 0.2182 0.001976 0.006612 0.1759 0.8226 4000 16001
sigma 2.625 2.22 0.01899 1.049 2.015 7.755 4000 16001
Since I'm using a non-informative prior, I was wondering why the estimates of mu and sigma are different.