Fit a univariate normal (Gaussian) distribution to the observed data.

Share:

Description

Fit a univariate normal (Gaussian) distribution to the observed data.

Usage

1
gibbsNorm(y, niter = 1000, priors = NULL)

Arguments

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.

Value

A list containing MCMC samples for the mean and standard deviation.

Examples

1
2
3
4
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])
summary(res.norm$sigma[501:1000])