Stata Codes for Asset Pricing Models
Testing asset pricing models requires time-series returns of portfolios formed on firms’ characteristics such as size, book-to-market, leverage, beta, and others (also commonly known as the left-hand-side variables or the LHS). These models use factor returns, such as the market factor, SMB, HML, momentum, profitability, liquidity, and investment (commonly known as the right-hand-side variables or the RHS). One challenging task is to sort assets based on specific criteria, create portfolios, calculate portfolio returns per period, and periodically rebalance portfolios as the criteria change over time. To overcome these challenges, we use dedicated programs written in Stata. These programs not only help to reduce the risk of errors that can occur when manually analyzing data in programs like MS Excel, but they also accelerate the process, saving a significant amount of time.
We provide codes for the following: