Cost of Equity | CAPM | Fama and French  Model

In this project, we calculated the cost of equity using CAPM and Fama and French model using the APT method.
Details and steps of the project include:

  1. Importing different files from Excel
  2. Used Rolling regressions with one-year, 3-years, and 5-years windows to get factor loadings
  3. Calculated the long-run average risk premiums of the factors
  4. Factor loadings and long-run risk premiums were used to find forecasted cost of equity
  5. Then calculated the absolute difference between actual returns and the forecasted cost of equity
  6. These absolute forecast errors were then averaged across one-month, one-year, 3-years, and 5-years periods
  7. Made Word Tables for each of the above averages for each firm
  8. Several variations were tried for the above using decile portfolios etc.
  9. Next Variation included the creation of the type portfolios, i.e. industry portfolios etc.
  10. Next Variation included the creation of a single portfolio for all firms.
  11. In addition, the project generated summary statistics tables for individual firms, decile portfolios, type portfolios, and overall portfolios.
  12. Additional variations are possible e.g, report the cost of equity by firm-year, portfolio-year, etc.

Our Stata Code

We have developed easy to use yet robust codes for the above steps. The codes need just a basic understanding of Stata. Further, our comments on each line of code will surely help you in running the code as well as in understanding the process more clearly. We normally share all Stata files, the raw data files, and Stata codes with comments. The purposeis to help researchers to learn and apply these codes on their own. We also try to answer questions that might arise at a later stage when the researcher applies these codes.


The code is available for $ $299 with some example data.
For further details, please contact us at:

Implied cost of capital (ICC) implied cost of capital

We are excited to announce that we now offer Stata codes specifically designed for the calculation of the Implied Cost of Capital (ICC) model. The ICC is a forward-looking approach that estimates a company’s cost of equity capital based on current market prices and analysts’ forecasts. Unlike traditional methods of calculating observed cost of capital, which rely on historical data and can be subject to past biases, ICC models provide a more current and dynamic perspective. They integrate market expectations and can better reflect the ongoing changes in a company’s risk profile and growth prospects. To see the details of our Stata code for ICC, visit this page.

About the developer

Dr. Attaullah Shah, Ph.D. in Finance, brings over 20 years of extensive experience in developing cutting-edge Stata packages and writing robust codes for various financial analyses. With a strong background in finance and a deep understanding of quantitative methodologies, Dr. Attaullah Shah has successfully developed codes for portfolio creation, asset pricing, cost of equity estimation, event studies, and many other applications.

Having authored several Stata packages, Dr. Attaullah Shah has established a reputation for delivering high-quality, reliable solutions to the financial research community. With a passion for facilitating knowledge transfer, Dr. Shah has designed the code and accompanying resources to be user-friendly, even for those with basic understanding of Stata.

Dr. Shah is committed to providing exceptional support and ensuring that researchers can seamlessly apply these codes to their own projects. By leveraging Dr. Shah’s expertise and extensive experience, you can trust that this code is built on a solid foundation of academic rigor and practical applicability.”


Fama, E. F., & French, K. R. (1993). Common risk factors in the returns on stocks and bonds. Journal of Financial Economics33(1), 3-56.


Project tags: Initial Public offerings, IPO, Fama and French, BHAR, CAR, cumulative abnormal returns, market adjusted returns, event study, Stata , FinTechprofessor