[MUSIC] Looking at our New York Stock Exchange closing data that we have, I am going to see what was the mean percentage change. At the end of the day, each stock that was listed with the New York Stock Exchange Had recorded his closing value, the net change for that day, and what percentage that represented. So I'm going to look at the mean percent changes, and to find that I will say average value of everything that I see here. This will give me a negative 1.27. So it happen to be a losing day for the stock market on that day, and as you know, there are times that they have as a whole of losing day. And sometimes a day that it gain so many points. So on that day, it lost as a whole 1.27% of its value. And I can say the standard deviation of this is 2.2 So let's go back to our portfolio. We have 127 stocks in our data. And based on this, we can find what is the mean change that we saw in our stock. So this would be an average r stocks. So the 127 stocks that we have in our portfolio. They lost as a whole 1.33 percent of their value. Their standard deviation was STDEV.S. I pick the 120 stocks that I have. Control shift down. Close the parenthesis. And go back up, sample size hound, how many stocks I have in my portfolio and close the parenthesis, go back up, use it at my count is 125. And the reason for that is, if you scroll down, you would see that I have a stock, here's one. And here's the other one, that was not traded that day. So what Excel is trying to tell me, is that you have 127 stocks in your portfolio. But on this day, this mean percentage change is only based on 125 of the stocks that you own. Because two of them were not traded at all. So in this case, our sample size turns out to be actually 125. So it's always a good thing for you to use the count, because you could have missing values. So I am going to calculate our confidence interval, and then move on to calculating the sample size. So let's say for a confidence level of 95%, then T of alpha over two. Remember that I'm going to use the T value is going to be T dot inverse, and the probability is going to be .975, and the degrees of freedom is n minus 1. So 125 is my n, so I'm going to put 124. And again, I'm going to remind you, that you could use 1.96 as a good estimate if you were doing this without access to any computer program. But since we have access to Excel, I am going to use the precise value, I'm not going to use the z value. I'm going to use the t value when it comes to mean calculations. And why did I put 0.975? Because once again what we are saying is that the confidence interval is 95%. So this is 95%. 0.025 is in this tail and 0.025 is in this tail. So everything to the left of this value is 0.975, so for my T dot inverse, the first argument is 0.975, the second argument is N- 1 and in this case it would be 124. And I get the value of 1.98. And again, if I didn't have access to this, I would have just substituted 1.96. Okay, now going back. The confidence interval for mean is your sample mean plus or minus t of alpha over 2 times the standard error. And standard error Is going to be calculated here based on the standard deviation of the sample that we have. So I'm going to calculate my standard error here, and that would be s, which is right here, standard deviation on my sample, divided by the square root of my sample size, which is 125. So, this is what I have done. And, my standard error is going to be .18. So now my margin of error, is this entire second term, is my margin of error. So that's T of alpha over 2, multiplied, by the standard error. So that's my margin of error. And based on this, I can now come up with my confidence interval lower value and its upper value. And the lower value is going to be my mean minus my margin of error. And my upper value is going to be my mean Plus my margin of error. This is what we would have calculated based on our sample information in terms of what could be the true mean percent change for the stock exchange on that day, somewhere between -1.7 to -0.9. So again, going back to our You can see is -1.2. So certainly, -1.2 would have been in this interval and our population would have been contained. Now, let's say that I don't consider this acceptable. I don't want this much margin of error, I don't want to be this far off, then what do I do? So that means that I need to calculate my required sample size. So let me get rid of some of these writings, and then we will continue. So now let's say that the desired error rate is only 0.3, I want to be only by 0.3 off. So then, what sample size do I need? This is the equation we have for sample size, if I didn't have my key value, this would have been Z of alpha over two. So again, remember that this is not in contrast, or this is not different than what you see in PowerPoint. But since I have access to actual numbers, I'm going to use the T value. So my sample size is going to be equal to, taking my T value, multiplying it by the standard deviation. Then taking that, and dividing it by my desired rate and desire error, which is 0.3 and squaring that whole thing. So raising it to the power of 2, and this will give me 181.7. I will round it up to 182. So in order for me to be more precise, I need a portfolio larger than 127 that I have here. I need to have 182 stocks sampled in order to be able to come up with a confidence interval for the actual stock market that is only off by 0.3 when it comes to mean percent changes.