Step, we're going to look at repair moisturizing and model when a straightforward para militarization does not work well with the sampling. So, for example, when there is insufficient data, as we might in a hierarchical model, the variables being in for it end up having correlation effects, thereby making it fairly difficult to sample. One obvious solution is to obtain more data, but this isn't always possible, and in this case we were sort of repair amortization by creating a non centered model from a centered model. So now let's take a look at what this means. So we'll look at a fairly simple example of a centered model first. So we're sampling from a normal distribution with a mean and standard deviation given by mu and sigma. So here mu is drawn from a normal distribution center around zero and a standard deviation of one. And sigma is drawn from half normal distribution with the standard deviation of one, and we try to fit these two parameters from mu and sigma directly, so this is called a centered model. However, the following is a non centered parameterization since the scale from a unit normal and shifted. So let's take a look at what that means. So we have mu and sigma that are drawn from a normal and have normal respectively. However, what changes is, now we have a y unit that's being drawn from a unit normal. And then we're using these parameters that we just drew for mu and sigma and then scaling using white unit to get our original. We have two functions here to compute the centered model and a non centered model. In the center of model we have mu and sigma being drawn from a normal and half normal distribution. And then we're computing y, or drawing for y, directly from a normal distribution pyramid tries by this mu and sigma. And in our non centric model, similarly, we had mu and sigma being drawn from a normal and half normal distributions. However, we have yt now being drawn from a unit normal distribution. And then y is computed using this yt and using the parameters for a mu and sigma that we've shown here. So now we will go out and run the centered model, followed by the non centered model. So we're going to sample for about,10,000 iterations or were drawing 10,000 samples, and 1000 of those samples were used for tuning. So we would notice here in the output that there are a number of messages indicating that there could be problems in our sampling process. So here we see a sizable number of divergences in our sampling. So compared to the total number of draws, we see that there are fairly large number of divergences in each one of these chains. We also see this message indicating that our acceptance probability is fairly low, and maybe we should repair mattress or increase the target except parameter. So there's more indication here is that something could be going wrong. So they are have statistic indicates that it's larger than 1.5 for some parameters. Also, the estimated number of effective samples is smaller than 200. So if you contrast that with the fact that we're drawing about 10,000 samples, 200 effective samples seems fairly low. So let's see what's happening here. So we have some scatter plots are for parameters here. The ones of interests here are to the right hand side and red, so these are the scatter plots are for parameters mu and sigma against our white samples. And if you pay attention to the last one, here are the bottom one here, where we have sigma samples drawn against white samples. So you noticed that as sigma gets smaller and smaller, we have fewer samples that are being drawn from, for y, corresponding to small values of sigma. So this is one of the issues that we're trying to address with a non centered pyramidization. The first we run our non centered parliamentarization model and we notice immediately that the far fewer divergences in this case compared to our centered model. So if we look at the plot at the bottom here for sigma samples versus ry samples, we would notice that for very small values of sigma corresponding to the bottom of this y axis, we still have a lot of white samples. So that was not the case earlier for really small values of sigma, as indicated here, you notice that there are very few samples on for y so why does this happen? So one explanation for this is that when sigma or the standard deviation is small here. The range of values that why can take is fairly small. So most of the density will be centered around mu here with far fewer values coming away from mu. And because sigma is small, that range of values that it can draw from away from mu is also substantially smaller. So if we look at the graph for sigma samples in our centered model, we would notice that it has this funnel shape at the bottom here. So this is because of the fact that for low values of sigma, most of these y samples are coming from close to the mean, which in this case is zero. So we have very few samples away from our mean or zero for very small values of sigma. So in a non centered model were re promote, rising to be a shifted and scaled model as shown here. So since why is now drawn from this normal distribution and sigma is drawn from this half an old distribution, these terms are not a couple. So even though we have small sample values for sigma, we will still have sample values for a while because of the contribution from this term