We can apply the chi-square testing framework to the second problem in this section: evaluating whether a
Question:
We can apply the chi-square testing framework to the second problem in this section: evaluating whether a certain statistical model fits a data set. Daily stock returns from the S&P500 for 10 can be used to assess whether stock activity each day is independent of the stock's behavior on previous days. This sounds like a very complex question, and it is, but a chi-square test can be used to study the problem. We will label each day as Up or Down (D) depending on whether the market was up or down that day. For example, consider the following changes in price, their new labels of up and down, and then the number of days that must be observed before each Up day: Change in price 2.52 -1.46 0.51 -4.07 3.36 1.10 -5.46 -1.03 -2.99 1.71 Outcome Up D Up D Up Up D D D Up Days to Up 1 - 2 - 2 1 - - - 4 If the days really are independent, then the number of days until a positive trading day should follow a geometric distribution. The geometric distribution describes the probability of waiting for the k th trial to observe the first success. Here each up day (Up) represents a success, and down (D) days represent failures. In the data above, it took only one day until the market was up, so the first wait time was 1 day. It took two more days before we observed our next Up trading day, and two more for the third Up day. We would like to determine if these counts (1, 2, 2, 1, 4, and so on) follow the geometric distribution. Figure 6.10 shows the number of waiting days for a positive trading day during 10 years for the S&P500. Days 1 2 3 4 5 6 7+ Total Observed 717 369 155 69 28 14 10 1362 Figure 6.10: Observed distribution of the waiting time until a positive trading day for the S&P500.
Given the information in above write python code for the following:
Calculate the expected values based on the geometric distribution with a probability of 53.2%
Compare the expected vs. the observed values from the textbook using the Chi-Square distribution
Reach a conclusion
Explain what is the business impact of your conclusion
Introduction to Corporate Finance What Companies Do
ISBN: 978-1111222284
3rd edition
Authors: John Graham, Scott Smart