-
Categories
- Data (8)
- Learning Resources (11)
- Python (8)
- SAS (13)
- Stata (27)
Archives
- June 2024 (1)
- January 2024 (1)
- September 2023 (1)
- August 2023 (1)
- May 2023 (1)
- February 2022 (2)
- January 2022 (1)
- August 2021 (1)
- September 2019 (1)
- August 2019 (2)
- July 2019 (2)
- May 2019 (1)
- April 2019 (1)
- March 2019 (1)
- August 2018 (3)
- July 2018 (4)
- December 2017 (1)
- November 2017 (1)
- October 2017 (1)
- September 2017 (1)
- April 2017 (2)
- September 2016 (1)
- April 2016 (1)
- December 2015 (1)
- November 2015 (1)
- September 2015 (4)
- August 2015 (5)
- June 2015 (3)
- March 2015 (7)
- February 2015 (2)
Author Archives: Kai Chen
Stata command to convert string GVKEY to numerical GVKEY or vice versa
The default type of GVEKY in Compustat is string. Sometimes, we need it to be a numerical type in Stata (e.g., when we want to use the super handy command tsset). The command to convert string GVKEY to numerical GVEKY … Continue reading
Stata command to calculate the area under ROC curve
If we want to evaluate the predictive ability of a logit or probit model, Kim and Skinner (2012, JAE, Measuring securities litigation risk) suggest that A better way of comparing the predictive ability of different models is to use the Receiver … Continue reading
Stata commands to calculate skewness
Suppose we are going to calculate the skewness of 12 monthly returns. The 12 returns may be stored in a row (Figure 1) or in a column (Figure 2). This post discusses how to calculate the skewness in these two … Continue reading
Posted in Stata
Leave a comment
Lawsuit data from Stanford Law School’s Securities Class Action Clearinghouse
The Python script in the original post has been removed as its use violates the Terms of Service of the data provider. Stanford Law School’s Securities Class Action Clearinghouse is always happy to share the data (subject to a Non-Disclosure … Continue reading
Calculate idiosyncratic stock return volatility
I have noted two slightly different definitions of idiosyncratic stock return volatility in: Campbell, J. Y. and Taksler, G. B. (2003), Equity Volatility and Corporate Bond Yields. The Journal of Finance, 58: 2321–2350. doi:10.1046/j.1540-6261.2003.00607.x Rajgopal, S. and Venkatachalam, M. (2011), … Continue reading
Posted in SAS
8 Comments
Commonly used Stata commands to deal with potential outliers
In accounting archival research, we often take it for granted that we must do something to deal with potential outliers before we run a regression. The commonly used methods are: truncate, winsorize, studentized residuals, and Cook’s distance. I discuss in … Continue reading
Posted in Stata
5 Comments
Use Python to extract URLs to HTML-format SEC filings on EDGAR
[Update on 2020-06-26] Eduardo has made a significant improvement to the code. Now you can specify a starting date and download the index file during the period from that starting date to the most recent date. I expect it to … Continue reading
Posted in Python
48 Comments
Sample code for “outreg” command in Stata
outreg is a time-saving and must-have command in Stata. It will generate a ready-for-use results table like this. I’m sure you will see what a relief this can give us. outreg is not a built-in command and can be installed … Continue reading
Posted in Stata
Leave a comment
Use Python to download data from the DTCC’s Swap Data Repository
I helped my friend to download data from the DTCC’s Swap Data Repository. I am not familiar with the data and just use this as a programming practice. This article gives an introduction to the origin of the data: http://www.dtcc.com/news/2013/january/03/swap-data-repository-real-time The … Continue reading
Download FR Y-9C data from WRDS
WRDS currently populates FR Y-9C data quarter by quarter in individual datasets, like BHCF200803, BHCF200806, BHCF200809 and so on. WRDS has not stacked those individual datasets to formulate a single time-series dataset like COMPUSTAT. There are two ways to overcome … Continue reading
Posted in Data, SAS
3 Comments