13  Last worksheet: Time-constrained projects to pursue

Before proceeding, make sure that you have finished the preceding worksheets. In this course, I sacrificed breadth for depth and understanding. We did not have the opportunity to pursue a lot of topics in financial econometrics. It is tempting to use generative AI as a shortcut to be able to do something, but you lose access to how things were discovered and even potential discoveries of your own.

13.1 Some ground rules that you should abide by

The projects below are meant to be steps for you to discover things on your own without the verbosity of this workbook.

You can build from the baseline code provided below:

### Baseline code for exploring the
### performance of procedures based on OLS

source <- matrix(c(-1, -1,
                   -1, 0, 
                   0, -1, 
                   0, 0, 
                   1, 0,
                   1, 1), ncol = 2, byrow = TRUE)

getcoefse <- function(n)
{
  data <- source[sample(1:6, n,
                        prob = c(0.1,0.2,0.2,0.3,0.1,0.1), 
                        replace = TRUE), ]
  ols <- lm(data[, 2] ~ data[, 1])
  c(as.vector(coef(ols)), as.vector(sqrt(diag(vcov(ols)))))
}

results <- replicate(10^4, getcoefse(100))
lower <- 
upper <- 
mean((lower < -8/49) & (upper > -8/49)) 

### Baseline code for Example 11.4 
### if using NYSE data from book

library(tidyverse)
library(wooldridge)
library(car)
library(sandwich)

nyse.new <- nyse |> mutate(return_2 = lag(return, 2))
result <- lm(return ~ return_1 + return_2, data = nyse.new)
linearHypothesis(result, 
                 c("return_1", "return_2"),
                 rhs = 0, 
                 test = "F",
                 vcov = vcov(result))

### Baseline code for Example 11.4 
### if starting from scratch

library(tidyfinance)
library(tidyverse)
prices_ <- download_data( 
  domain = "stock_prices",
  symbols = "", 
  start_date = "", 
  end_date = ""
)
prices_weekly_ <- prices_ |> 
  filter(wday(date) == ) |>  
  mutate(ret = ) 

rm(list=ls())
rstudioapi::executeCommand("clearHistory", quiet = TRUE)

##############################
## I. ########################
##############################
# Baseline code for Example 11.4 
# if starting from scratch

library(tidyfinance)
library(tidyverse)
prices_ <- download_data( 
  domain = "stock_prices",
  symbols = "", 
  start_date = "", 
  end_date = ""
)

returns_ <- prices_ |>
  arrange(date) |>
  mutate(ret = ) |>
  select(symbol, date, ret)

# ACF
library(forecast)
Acf()

# Baseline code for Example 11.4 
# if using NYSE data from book

library(tidyverse)
library(wooldridge)
library(car)
library(sandwich)

nyse.new <- nyse |> mutate(return_2 = lag(return, 2))
result <- lm(return ~ return_1 + return_2, data = nyse.new)
linearHypothesis(result, 
                 c("return_1", "return_2"),
                 rhs = 0, 
                 test = "F",
                 vcov = vcov(result))



##############################
## II. #######################
##############################
getcoefse <- function(n)
{
  # Generate data for e
  data.e <- 
  # Generate data for a
  data.a <- 
  # Run the requested regression
  ols <- lm()
  # Collect results
  c(as.vector(coef(ols)), as.vector(sqrt(diag(vcov(ols)))))
}
# Collect results across replications
results <- replicate(, getcoefse())
# Collect t-statistics
t.stat <- (results[,]-)/results[,]
# Rejection rule

# How often do you reject the null


##############################
## IV. #######################
##############################

# Baseline code used in Example 10.4 

library(wooldridge)
names(fertil3)
ts.plot(fertil3$gfr)
ts.plot(fertil3$pe)
res1 <- lm(gfr ~ pe + ww2 + pill, data = fertil3)
res2 <- lm(gfr ~ pe + ww2 + pill + pe_1 + pe_2, data = fertil3)
library(tidyverse)
temp <- fertil3 |> mutate(L1pe = lag(pe,1),
                          L2pe = lag(pe,2))
lm(gfr ~ pe + ww2 + pill + L1pe + L2pe, data = temp)

You are allowed to use generative AI at certain points and they are indicated explicitly.

You should keep a copy of your entire chat log from Google Gemini. This chat log can be exported, but more importantly, you should keep documentation of how you thought through an exercise where generative AI was allowed.

13.2 Project I: Explore the performance of procedures based on OLS

Adjust the joint distribution which we have used repeatedly from Worksheet 4 to produce more extreme violations of conditional homoscedasticity.

You are asked to examine the performance of two types of 95% confidence intervals for \(\beta_{1}\) from a linear regression of \(Y\) on \(X\) with a constant. These two types of confidence intervals are one assuming MLR.5 holds and another one assuming that MLR.5 does not hold. Use 10000 replications for your Monte Carlo simulations. In order for me to check your work, run set.seed() with your a number of your choice inside the parentheses.

In your handwritten writeup, you will

  1. Write down your adjusted distribution.

  2. Write down the true value of \(\beta_{1}\) for your adjusted distribution and demonstrate why there is a violation of conditional homoscedasticity. You are allowed to use generative AI here for calculations. Make sure that you have verified the calculations.

  3. Create a table comparing the rates at which the “capture” \(\beta_{1}\) sample sizes 50, 200, and 800.

  4. Based on your table, what are your findings on the performance of the two types of 95% confidence intervals?

  5. Write a bottom line takeaway message regarding your findings which you can communicate to a new student of econometrics.

13.3 Project II. Testing the efficient markets hypothesis

Your tasks are as follows:

  1. Test the efficient markets hypothesis by following the approach in Example 11.4 of Wooldridge (2020). Instead of using NYSE for the stated periods in the example, you will be choosing one asset of interest to you. This asset could be individual stocks, equity-based products, or stock market indices. You are free to set the time periods for study.

  2. You are allowed to use generative AI as a coding aid for this item. Explore the consequences of researcher choices on the outcomes of the test. These choices include:

    1. How much past information is included in the conditional expectation (try different number of lags up to 4)
    2. The choice of frequency: daily, weekly, monthly (pay attention to how many observations are used)
  3. Obtain the expected returns of the asset. For example, in a stationary AR(2) model \(y_{t}=\beta_{0}+\beta_{1}y_{t-1}+\beta_{2}y_{t-2}+u_{t}\) with \(\mathbb{E}\left(u_{t}|y_{t-1},y_{t-2},\ldots\right)=0\), we have \(\mathbb{E}\left(y_{t}\right)=\beta_{0}/\left(1-\beta_{1}-\beta_{2}\right).\)

In your handwritten writeup, you will:

  1. Provide a motivation for your choice of asset. Why do you want to study it and how would selecting such an asset be related to testing the efficient markets hypothesis?

  2. Summarize and report your findings. What choices were made to obtain the findings? If you report the findings, you may present your findings via a table. When you report your numerical findings, round them off to two decimal places.

  3. Based on the outcomes of the test, estimate the (unconditional) expected returns on the asset. Would it be beneficial to actually hold this asset? Why or why not? Are there competing assets? How about the costs of holding such an asset? When you answer this question, it may help to have some additional data to make your point.

  4. Write a bottom line takeaway message which you can communicate to a typical person who is considering investing in the asset you have chosen.

13.4 Project III. Replicating one of the key results from Aquino (2006)

Read the first two pages of Aquino (2006) study on the Philippine stock market using daily data from 14 July 1987 to 25 May 2004. The Phisix is the old name of the PSEi (symbol PSEI.PS in Yahoo Finance). You have the following tasks, which should show up in your lines of R code:

  1. Attempt to reproduce the findings that there is a statistically significant first-order autocorrelation coefficient of 0.18 and that the reported R-squared is 0.032.

  2. Given that this was a result from 20 years ago, how would you have approached the analysis given what you know now? You may find that this is related to Example 11.4 of Wooldridge (2020).

In your handwritten writeup, you will do the following:

  1. If you encountered issues with your attempt to reproduce the findings, state them. If you did not encounter issues, state that you were successful.

  2. Evaluate the statement in Aquino (2006) that the R-squared will lead one to conclude that “the chances of earning excess profits on the basis of information on past prices alone are so small”.

  3. Write down your main findings now that you are approaching the analysis a bit differently. A short paragraph would suffice. ## Project IV: Using theory and Monte Carlo simulation to answer GOING FURTHER 18.2

Your task is to design a simulation to answer the questions in GOING FURTHER 18.2 found in page 615 of Wooldridge (2020). But before you design the simulation, answer the following questions as part of your handwritten writeup:

  1. What are \(\Delta y_{t}=y_{t}-y_{t-1}\) and \(\Delta x_{t}=x_{t}-x_{t-1}\) given (18.27) and (18.28)? This is straightforward, don’t overthink it.

  2. Focus on the regression \(\Delta y_{t}=\gamma_{0}+\gamma_{1}\Delta x_{t}+\mathrm{error}_{t}\). What is the true value of \(\gamma_{1}\)? Show your calculations.

  3. Assumption TS.4’ and TS.5’ are satisfied for the regression in the previous item. Do you think Assumptions TS.1’ to TS.3’ are satisfied? Explain.

For the simulation, set \(\left\{ e_{t}\right\}\) as a sequence of IID \(N\left(\mu_{e}=0,\sigma^{2}_{e}=1\right)\) and \(\left\{ a_{t}\right\}\) as a sequence of IID \(N\left(\mu_{a}=0,\sigma^{2}_{a}=4\right)\). Set sample size equal to 200. Modify the baseline code, which should show up in your lines of R code, provided in order for you to:

  1. Describe the center of the OLS estimator of \(\gamma_{1}\). Is this what you expected to find? Explain using the theory. Write your findings in the booklet.

  2. Describe the behavior of the t-statistic for the test of the null hypothesis \(\gamma_{1}=0\) against the two-sided alternative \(\gamma_1\neq0\). Specifically, what does the distribution of the \(t\)-statistics look like and how often you reject the null? Is this what you expected to find? Explain using the theory.

13.5 Project V: Spurious regression

Refer to the discussion of the spurious regression problem in page 615 of Wooldridge (2020). Your task is to provide lines of R code to use the setup in page 615 to show that spurious regression is indeed a problem via Monte Carlo simulation. In your handwritten writeup, you will do the following:

  1. Write up your findings similar to what you see in the book: “For a sample size of n=50, at the 5% significance level, the standard t-statistic for the null \(\beta_{1}=0\) against the two-sided alternative rejects the null about 66.2% of the time.”

  2. The details of how to generate the data are not completely written out in Wooldridge (2020). Using English, mathematics, and statistics, lay out all the steps for how the data were generated for your simulation so that anyone will be able to replicate your findings.

13.6 Project VI: Wages and prices

You will use the dataset wageprc from the wooldridge R package. For the US economy, let \(gprice\) denote the monthly growth in the overall price level and \(gwage\) be the monthly growth in wages. Your task is to provide lines of R code which will:

  1. Estimate a finite distributed lag model where \[gprice_{t}=\beta_{0}+\beta_{1}gwage_{t}+\beta_{2}gwage_{t-1}+\beta_{2}gwage_{t-2}+u_{t}\] and \(\mathbb{E}\left(u_{t}|gwage_{t},gwage_{t-1},\ldots\right)=0\).

  2. Generate the appropriate variables and run another regression so that you will directly obtain an estimate of the long-run propensity. Include three types of standard errors: the default standard errors, the heteroscedasticity-robust standard errors, and the heteroscedasticity and autocorrelation consistent standard errors (Refer to Chapter 12 of Wooldridge (2020) for more details.).

In your handwritten writeup, you will do the following.

  1. Provide a valid interpretation of the estimate of the long-run propensity. Pay attention to the units and the appropriateness of the interpretation given the context.

  2. An economically relevant null hypothesis is that the long-run propensity is equal to 1. Write down the mathematical version of this null hypothesis. Why would this null be of economic interest? What is special about the value 1? Why not 0?

  3. Calculate the three resulting \(t\)-statistics and the resulting \(p\)-values for testing the null that the long-run propensity is equal to 1. What would be your conclusions? Which \(t\)-statistic and \(p\)-value will you rely on? Why?

13.7 Project VII: How far can Google Gemini help you in simulating price paths when daily log returns are dependent?

Suppose you have a financial instrument which tracks the PSEi. You want to relax the assumption that daily log returns are IID normal to allow for dependence. Specifically, you will retain the normality assumption. But you have to incorporate the presence of some mild predictability in log returns so that past information about log returns somewhat help in predicting current log returns. In addition, you are also concerned about volatility clustering, which you have heard of but don’t really know much about.

You want to know how long you should hold this financial instrument until it triples in value. Your task is to show through your chat logs and resulting modified R code how to use generative AI to incorporate these extensions into achieve this objective. For your handwritten writeup, you only need to write a sentence stating how long do you have to hold the asset to achieve the stated objective.

References

Aquino, Rodolfo Q. 2006. “Efficiency of the Philippine Stock Market.” Applied Economics Letters 13 (7): 463–70. https://doi.org/10.1080/13504850500397437.
Wooldridge, Jeffrey M. 2020. Introductory Econometrics: A Modern Approach. 7th edition. Cengage Learning.