# bayesian question: why prior = mu * sigma?

I'm doing a course of Fundamental of Bayesian Analysis in Datacamp and these codes were presented. What is the rationale of prior being mu * sigma ?

code:

temp <- c(19,23,20,17,23)
mu <- seq(8,30, by = 0.5)
sigma <- seq(0.1,10, by=0.3)
pars <- expand.grid(mu = mu, sigma = sigma)
pars$mu_prior <- dnorm(pars$mu, mean = 18, sd= 5)
pars$sigma_prior <- dunif(pars$sigma, min = 0, max = 10)

# this code in question ---
pars$prior <- pars$mu_prior * pars$sigma_prior # end of code question ---- for (i in 1:nrow(pars)) { likelihood <- dnorm(temp, pars$mu[i], pars$sigma[i]) pars$likelihood[i] <- prod(likelihoods)
}

pars$probability <- pars$likelihood * pars$prior pars$probability <- pars$probability / sum(pars$probability)

• we are interested in the posterior which is proportional to likelihood*prior. If the prior for mu and sigma are assumed independent we have posterior proportional to likelihood * prior(mu) * prior(sigma). ps you really should be calculating these on the log scale – user20650 Jun 3 at 22:53