So now, the whole point of this bootstrapping section was to show how we can use a very simple method for computing, say, the standard error on a more complicated statistic like value at risk. So if we estimate our five percent value of risk, our estimate is, is e to the five percent quantile minus one times my initial wealth, okay? Now, we are going to use the bootstrap to compute a standard error for this value of risk estimate, and then we will see how accurate is our estimate value of risk, alright? So, we have to write a function that will evaluate value at risk on our observed data. So, this function is slightly more complicated than the other ones. It has two lines, three lines of code instead of two lines of code. This function takes in data or randomly commuted indices and there are two additional arguments, the probability level for your value at risk and your initial wealth, right? So, how do you compute value at risk? This is my return data. So, the first thing I do is I compute the quantile for the continuously compounded return, which is the mean evaluated at my randomly permuted data plus the standard deviation on the randomly permuted data times the quantile of a standard normal based on the probability. Then, my value at risk is e to the quantile minus one times my initial wealth. And then, I return the result, okay? So, I run the boot function and here's the output. So, my estimate for variant risk is -13,769, right? The bootstrap estimate of bias is 210. So, this is saying that, I over-predict my value at risk by $210 on average, okay? So, there's you know, again, the, is this a large bias? Well, again, this is an estimate of loss of $13,000 and I have a bias of $200. So, the bias from a, from a economic perspective is not very big. What about the standard error of my estimate? The standard error of the estimate is $1,800. So, you think of the help, so the standard error is about, you know, a little less than one, a little more than one-tenth of the size of the value at risk number. So, there's a little bit of uncertainty. And then, you would like to compute a 95 percent confidence interval, then we can either do estimate plus or minus two times the standard error or, or look at the quantiles. So, here's the bootstrap distribution of value at risk and we can see that it's a little asymmetric, right? So, it's dipping down a little bit in the q, q plot but, so this isn't quite normal. So, the percentile confidence interval is probably more accurate than the estimate plus or minus two times the standard error. So, we're going to run the boot CI function, we'll compute the two confidence intervals like we did before and so here's the normal confidence intervals. So, this is estimate plus or minus two times the bootstrap standard error. So, on the low end, we loose $17,000 and on the upper of the confidence interval, we loose $10,000. So, with 95 percent confidence, we think our true loss is somewhere between 17,000 and 10,000. Now, that's a difference of $7,000. That's, that's actually pretty big. The percentile method is similar on the low end, we lose $17,000 and on the high end, we lose $10,000. You know, again, the range of values here is about $7,000 and again, that's a pretty wide confidence interval. So how, how well do we estimate value at risk at the five percent level? Okay, I mean the confidence interval is reasonably wide. Now, one of the things that you will learn as, as you go out in the real world, is nobody when they, when you see s value at risk report and practice, you never see confidence intervals on these reports. And you know, and that could be quiet dangerous particularly, because, you know, we see there is a, a fair bit of uncertainty here. So, your risk manager is saying, you know, my best guess is, you know, in the middle of the confidence interval, right? But they are not saying, well, this guess could be off by a certain amount. And, and that's important to know. So anyway, its just a, it's just a fact of life that you often, don't often see these things. And one of the things that you should take away from this lecture is there's no reason why you shouldn't report a confidence interval, right? It was three lines of code to compute the standard error on value at risk. It was extremely simple to do. And because it's so easy to do, it should be done routinely. And, and, and you, and you do get much more information that way. When you read about the bootstrap, most, you often see this quotation that the bootstrap gets its name from this phrase, picking yourself up from your bootstraps. And, and so literally, a bootstrap is a strap on a boot, right? And so, the idea is, you know, maybe it's the idea is you're, you're kind of starting from the ground up. I don't know, that's sort of my interpretation. So, I mean, that's the origin of the phrase bootstrapping. The origin of this word for the technique comes from picking yourself up from your bootstraps. And you know, how you're supposed to interpret that. I sort of, kind of, interpret that as you know, kind of you know, you're doing a calculation that, you know, starting from the original sample. And then, you know, you know, coming up from there or something like that I guess. It's a little bit of an unusual word. Sometimes you will hear the bootstrap referred to as a re-sampling algorithm. And that is very descriptive because that's exactly what you are doing. When you are bootstrapping, you are just re-sampling from your observed data and, and doing a computation. You want to re-sample from the data object that you are computing your statistics from. So you know, I'm computing a mean of the continuously compounded returns. Well, returns are computed from prices. So, and the prices are and, and the returns are the first difference in the prices. So, if you re-sample just from the prices, then when you're computing returns it's a little bit weird because returns depend upon two adjacent observations. If you bootstrap from prices you know, you've destroyed this relationship between prices that you've seen in the day, you know, the prices are sort of going up. And if you ran, if you just bootstrap from prices then, then you kind of destroy the, the price distribution. I, I guess the answer is the return data is closer, is generally close to being covariant stationary. It's not trending, it's uncorrelated over time and so on. But the price data is nonstationary, and it's not uncorrelated over time. The price today is correlated with the price yesterday and, and so on and so forth. So, so, for the purpose of what we're doing here, it's not the same thing to boot strap from prices and then compute returns and then compute your statistics. You would not get the same distribution of returns as you would get from this bootstrapping return.