Fit a univariate normal (Gaussian) distribution to the observed data.
gibbsNorm(y, niter = 1000, priors = NULL)
y | A vector of observed pixel data. |
---|---|
niter | The number of iterations of the algorithm to perform. |
priors | A list of priors for the parameters of the model. |
A list containing MCMC samples for the mean and standard deviation.
y <- rnorm(100,mean=5,sd=2) res.norm <- gibbsNorm(y, priors=list(mu=0, mu.sd=1e6, sigma=1e-3, sigma.nu=1e-3)) summary(res.norm$mu[501:1000])#> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 4.548 5.015 5.158 5.154 5.289 5.794summary(res.norm$sigma[501:1000])#> Min. 1st Qu. Median Mean 3rd Qu. Max. #> 1.778 2.013 2.117 2.121 2.208 2.808