Author Archives: Attaullah Shah

  • 11

Research Topics in Finance: Asset Pricing

Category:Blog Tags : 

 


Investor sentiment: Does it augment the performance of asset pricing models?

Mispricing and the five-factor model

Size, value, profitability, and investment: Evidence from emerging markets

4 Noisy prices and the Fama–French five-factor asset pricing model

5 Cross-sectional tests of the CAPM and Fama–French three-factor model

6 Decomposing the size, value and momentum premia of the Fama–French–Carhart four-factor model

7 Monday effect in Fama–French’s RMW factor

8 Digesting anomalies in emerging markets: A comparison of factor pricing models

9 Q-theory, mispricing, and profitability premium

10 Limits of arbitrage and idiosyncratic volatility

11 Is size dead? A review of the size effect in equity returns

12 Market states and the risk-based explanation of the size premium

13 Market volatility and momentum

14 A risk-return explanation of the momentum-reversal “anomaly”

15  Time-varying risk, mispricing attributes, and the accrual premium

16 Bayesian tests of global factor models

17 Model comparison tests of linear factor models in stock returns

18 Multi-factor asset pricing models: Factor construction choices and the revisit of pricing factors

19 Idiosyncratic volatility in the Asian equity market

20 What global economic factors drive emerging Asian stock market returns?


  • 9

asdoc version 2 : Summary of New features | export Stata output to MS Word

Category:Uncategorized

Version 2.0 of asdoc is here. This version brings several improvements, adds new features, and fixes minor bugs in the earlier version. Following is the summary of new features and updates.

 

Brief Introduction of asdoc

asdoc sends Stata output to Word / RTF format. asdoc creates high-quality, publication-ready tables from various Stata commands such as summarize, correlate, pwcorr, tab1, tab2, tabulate1, tabulate2, tabstat, ttest, regress, table, amean, proportions, means, and many more. Using asdoc is pretty easy. We need to just add asdoc as a prefix to Stata commands. asdoc has several built-in routines for dedicated calculations and making nicely formatted tables.

 

How to update

The program can be updated by using the following command from Stata command window

ssc install asdoc, replace

 

New Features in Version 2.0

1.  Wide regression tables

This is a new format in which regression tables can be reported. In this format, the variables are shown in columns and one regression is reported per row. Therefore, this type of regressions tables is ideal for portfolios, industries, years, etc. Here is one example of a wide regression table. asdoc allows a significant amount of customization for wide tables including asterisks for showing significance, reporting t-statistics and standard errors either below regression coefficients or sideways, controlling decimal points, reporting additional regression statistics such adjusted R2, RMSE, RSS, etc., adding multiple tables in the same file, and several other features. Read this post to know more about wide table format.

 

2. Allowing by-group regressions

Version 2.0 of asdoc provides the convenience of estimating regressions over groups and summarizing the regression estimates in nicely formatted tables. This feature follows the Stata default of bysort prefix. This feature works with all three types of regression tables of asdoc that include detailed regression tables, nested tables, and wide tables. In this blog post, I show some examples of by-group regressions.

 

3. Allowing by-group descriptive statistics

Using the bysort prefix with asdoc, we can now find default, detailed, and customized summary statistics over groups. Details related to this feature will be added later on in a blog post.

 

4. Option label with tabulate and regress commands

Option label can now be used with regression and tabulation commands. Using this option, asdoc will report variable labels instead of variable names. In case variable labels are empty, then the variable names are reported.

 

5. Developing tables row by row using option row

Option row is a new feature in version 2. Option row allows building a table row by row from text and statistics. In each run of asdoc with option row, a row is added to the output table. This is a useful feature when statistics are collected from different Stata commands to build customized tables. To know more about this option, read this blog post.

 

6.  Accumulate text or numbers with option accum

Option accum allows accumulating text or numbers in a global macro. Once accumulated, the contents of the macro can then be written to an output file using option row.

 

7. Saving files in different folders

One additional feature of version 2.0 is the ability to write new files or append to existing files in different folders.

 


  • 2

asdoc : Easily create Summary Stats in Stata and send it to MS Word: A video example

Category:Blog Tags : 

In this video post, I show the use of asdoc for the different type of summary statistics in Stata and sending them to MS word. Examples given in this video include:

  1. Default summary statistics that include the number of observations, mean, standard deviation, minimum, and maximum
  2. Detailed summary statistics that include no. of observations, mean, standard deviation, 1st percentile, median, 99th percentile, skewness, and kurtosis
  3. Customized summary statistics
  4. Controlling the number of decimal points
  5. Creating new files
  6. appending to existing files

I would really appreciate if you comment on this video on Youtube and subscribe to my channel if you have not already done that.


  • 4

Dropping i.dummies from regression | asdoc | Word | Stata

Category:asdoc,Blog,Stata Programs Tags : 

Questions: I have time and location dummies which I want to include in the regression, but do not want to report them in the regression nested tables created with asdoc. How can I do that?

If you have not already installed asdoc, you can install it from SSC by typing the following in the Stata command window:

ssc install asdoc

Let’s use an example data set.

use http://fintechprofessor.com/regdata.dta, clear

This dataset has four main independent variables, named as x1, x2, x3, x4 and a set of possible dummy variables that will be constructed from the variable year (from 2001-2005) and location (from 1-3).  Let us estimated the following regression:

asdoc reg y x1 x2 x3 i.year i.location, nest drop(i.year i.location) replace

asdoc reg y x1 x2 x4 i.year i.location, nest drop(i.year i.location)

Explanations

In the above two lines, we have estimated two regressions and sent their output to a Word file.  In the first line, we estimated a regression with the three main independent variables x1, x2, and x3 and included the year and location dummies on the fly. The option nest will create a nested regression table. The option drop(i.year i.location) drops these dummy variables from the regression table, however, they are included in the main regression. The two lines produce the following regression table in MS Word. 


[mc4wp_form id=”1409″]


  • 4

Exporting tabs and cross-tabs to MS Word from Stata with asdoc

Category:Blog Tags : 

For installation and other uses of asdoc, please see this short blog post.

Tabulation and Cross-tabs with asdoc

Exporting tables created by Stata commands such as tab, tabulate1, tabulate12, table, tabsum, tab1, tab2, and others to MS word is super easy with asdoc.  As with other commands, we need to just add asdoc as a prefix to the tabulation commands that includes tabulate, tabulate1 tabulate2, tab1, tab2, etc. Since frequency tables in Stata can assume different structures, asdoc writes these tables from log files.

 

One-way table

Example: One-way table

sysuse auto, clear 
asdoc tabulate rep78, replace

 

Please note that replace is asdoc option to replace the existing file. If we were to write to the existing file, we would then use option append, instead of replace.

 

Two-way table of frequencies

 

webuse citytemp2, clear

asdoc tabulate region agecat, replace

 

Example: Include row percentages

 

asdoc tabulate region agecat , nokey row replace

Note nokey suppresses the display of a key above two-way tables.

 

Example: Include column percentages

asdoc tabulate region agecat , nokey column replace

 
Example: Include row percentages, suppress frequency counts

asdoc tabulate region agecat, nokey row nofreq replace

 

One- and two-way tables of summary statistics

Example: One-way tabulation with summary statistics

 

sysuse auto, clear
asdoc tabulate rep78, summarize(mpg) replace

 

Example: Two variables tabulation with summary statistics

generate wgtcat = autocode(weight, 4, 1760, 4840)

asdoc tabulate wgtcat foreign, summarize(mpg) replace

 

Example: Suppress frequencies

asdoc tabulate wgtcat foreign, summarize(mpg) nofreq replace

 

Multiple-way tabulation (tab1)

tab1 produces a one-way tabulation for each variable specified in varlist.

Example: Multiple-way tabulation

sysuse nlsw88, clear
asdoc tab1 race married grade, replace

 

Two-way for all possible combinations (tab2)

Example: Two variables tabulation with summary statistics

asdoc tab2 race south, replace

  • 1

Stata Rolling command vs asreg for rolling regressions: Similarities and differences

Category:Stata Programs Tags : 

Karina van Kuijk asked the following question:

Question: 

I need to calculate the factor sensitivity of firms to ultimately sort portfolio’s based on this factor. I have found the asreg Stata code on your website and I was wondering if this code would be useful for my purpose. However, if I compare the rolling Stata code with your aserg program on a small dataset, I won’t get the same results.

Answer 

The key difference between the Stata’s official rolling command and asreg [see this blog entry for installation] is in their speeds. asreg is an order of magnitude faster than rolling.  There are other differences with respect to how these two calculate the regression components in a rolling window.  For example, rolling command will report statistics when the rolling window reaches the required length while asreg reports statistics when the number of observations is greater than the parameters being estimated. Therefore, if we have one independent variable and use a rolling window of 10 periods, rolling will report statistics from the 10th period in the dataset. However, asreg will report statistics from the 3rd observation (two parameters here, the coefficient of the independent variable and the intercept).  To make the results of asreg at par with the rolling command, let us use an example:

 

Example

Let us use the grunfeld data that has 10 companies and 20 years of time series for each company. We shall use the variables invest as dependent variable and mvalue as the independent variable.  Therefore, the rolling command will look like:

 

webuse grunfeld

rolling _b, window(10) saving (beta, replace): reg invest mvalue

The results from the rolling command are reported below only for the first company

 

company start end _b_cons _b_mvalue
1 1935 1944 186.5406 .0562316
1 1936 1945 196.1084 .0573704
1 1937 1946 106.4769 .0847188
1 1938 1947 53.12083 .1053145
1 1939 1948 364.5426 .0359897
1 1940 1949 372.5457 .0400371
1 1941 1950 360.8489 .04835
1 1942 1951 213.7943 .090357
1 1943 1952 119.8572 .1195415
1 1944 1953 -284.6031 .2229699
1 1945 1954 -496.6066 .2841584

 

To find similar results with asreg, we shall type:

bysort company: asreg invest mvalue, wind(year 10)

 

asreg generated the following results for the first company:

 

company year _Nobs _R2 _adjR2 _b_cons _b_mvalue
1 1935 . . . . .
1 1936 . . . . .
1 1937 3 .98568503 .97137006 192.3812 .04135324
1 1938 4 .91957661 .87936492 129.06727 .05411168
1 1939 5 .86795099 .82393465 129.91674 .05233687
1 1940 6 .69944952 .6243119 108.59266 .06102699
1 1941 7 .54085608 .4490273 91.235677 .06942586
1 1942 8 .31250011 .19791679 182.86065 .05101677
1 1943 9 .25355654 .14692176 197.08754 .05052367
1 1944 10 .24298452 .14835759 186.54064 .05623158
1 1945 10 .20582267 .10655051 196.10839 .05737045
1 1946 10 .29515806 .20705282 106.47691 .0847188
1 1947 10 .3728928 .2945044 53.120829 .10531451
1 1948 10 .05894158 -.05869073 364.54258 .03598974
1 1949 10 .1461912 .0394651 372.54574 .04003715
1 1950 10 .18946219 .08814496 360.84887 .04834995
1 1951 10 .41646846 .34352702 213.79429 .09035704
1 1952 10 .38796888 .31146499 119.85717 .11954148
1 1953 10 .69741758 .65959478 -284.60313 .22296989
1 1954 10 .67138447 .63030752 -496.6066 .28415839

 

As mentioned above, asreg does not wait for the full window to get the required number of period. Therefore, results from the rolling command and asreg start to match only from the 10th observation,  i.e., the year 1944. If you like asreg to ignore observation unless the minimum number of periods are available, you can use the option min. So to match the results with the rolling command, we can type:

bysort company: asreg invest mvalue, wind(year 10) min(9)

 

and there you go, asreg produces the same coefficients as the rolling command, with blistering speed.

 

Please do cite asreg in your research

 

In-text citation

Rolling regressions were estimated using asreg, a Stata program written by Shah (2017).

 

Bibliography

Shah, Attaullah, (2017), ASREG: Stata module to estimate rolling window regressions. Fama-MacBeth and by(group) regressions, https://EconPapers.repec.org/RePEc:boc:bocode:s458339.


  • 10

Research topics | Corporate Governance and Disclosure

Category:Blog Tags : 

In this blog post, I would like to present a list of research topics related to corporate governance and disclosure choices. 


 

 The relevance of good corporate governance practices in family controlled and concentrated ownership environment?

 Corporate governance practices, firms performance, and risk? Are these related?

Market risk disclosures and corporate governance structure

4  How and why an independent audit matters?

5   What determines CSR quantity and quality?

6   Usefulness of annual reports to individual investors.

7  Can board diversity play a role in the disclosure process?

8   How mandatory derivative disclosure policy affect CEO compensation and earning smoothing?

9  Earning management and IRFS adoption

10 The impact of Islamic Financial Services Board Standard No. 3 on corporate governance

11 The perception of financial analysts on risk, risk management, and internal control disclosure

12 The role of ethnic directors in corporate social responsibility: Does culture matter?

13 Corporate governance and intellectual capital reporting in a period of financial crisis

14  Extent and determinants of voluntary disclosure for regulatory purposes

15 The impact of company size and multiple directorships on corporate governance effectiveness

16  The capital structure and investment decisions of the small owner-managed firm

17 Governance indicators as determinants of operational risk

18 Corporate governance, size, and disclosure of related party transactions

19  Social media: New challenges and opportunities for corporate governance

20 The Corporate Gini Index (CGI) determinants and advantages

21  Industry concentration and corporate disclosure policy

22  The Impact of Audit Committee Characteristics on Corporate Voluntary Disclosure

23  Equity home bias and corporate disclosure

24  The impact of news articles and corporate disclosure on credit risk valuation

25  Internet-based corporate disclosure and market value


  • 1

Plotting cumulative average abnormal (CAAR) on a graph in Stata

Category:Uncategorized

In Stata, we can use the two-way graph type for plotting abnormal returns or cumulative average abnormal returns against the days of the event window. Suppose that we have event window of 7 days, and have the following data

 

 
days caar1 caar2 caar3 caar4
-3 0 0 0 0
-2 -.0043456 -.0050911 .0000683 .0000504
-1 -.0034961 -.0023533 .0037439 .0042783
0 -.0034278 .0019828 .0090661 .0106628
1 .0016178 .0067894 .0131572 .0156011
2 .0039689 .0104367 .0190594 .0221428
3 .0040022 .0129478 .0218878 .0267722

to plot the first caar1, we shall type :

graph twoway line caar1 days, xline(0)

 

If we were to plot all caars, then

graph twoway line caar* days, xline(0)

 


  • 14

asdoc : options and examples

Category:asdoc,Stata Programs Tags : 

Introduction

asdoc sends Stata output to Word / RTF format. asdoc creates high-quality, publication-ready tables from various Stata commands such as
summarize, correlate, pwcorr, tab1, tab2, tabulate1, tabulate2, tabstat, ttest, regress, table, amean, proportions, means, and many more.
Using asdoc is pretty easy. We need to just add asdoc as a prefix to Stata commands. asdoc has several built-in routines for dedicated
calculations and making nicely formatted tables.

 

asdoc Options

How to enter asdoc options and Stata_command options?
Both the asdoc options and Stata_command specific options should be entered after comma. asdoc will parse both the option itself. For example,the following command has both types of options.

asdoc sum, detail replace dec(3)

option detail belongs to sum command of Stata, whereas options replace and dec(3) are asdoc options.

Following options are used for controlling the behavior of asdoc:

1.1 Replace / append:

We shall use option replace when an existing output file needs to be replaced. On the other hand, we shall use option append if we want to
append results to the existing file. Both the options are optional. Therefore, if none of these options are used, asdoc will first determine
whether a file with a similar name exists in the current directory. If it exists, asdoc will assume an append option. If the file does not
exist, it will create a new file with the default name “Myfile.doc”

Example 1 : running asdoc without replace or append (first time)

sysuse auto
asdoc sum

The above lines of code will generate a new file with the name Myfile.doc. Next, if we estimate a table of correlation, we can replace the
existing file Myfile.doc or append to it. Again, if we do not use any of these options, option append will be assumed. So;

Example 2 : running asdoc without replace or append (second time)

asdoc cor
OR
asdoc cor, append

Both of the above commands serve the same purpose. The file Myfile.doc will now contain a table of summary statistics, followed by a table ofcorrelations. However, had we typed the following, then the file would contain only table of correlations. asdoc cor, replace

1.2 rowappend:

To develop a table row by row from different runs of the asdoc, we need to use option rowappend. This option can be used with ttest, customized summary statistics, or in other instances where the table headers and structure do not change
and appendable statistics have a similar structure as those already in the table.

 

1.3 save (file_name):

Option save(file_name) is an optional option. This option is used to specify the name of the output file. If left blank, the default name will
be used, that is Myfile.doc. If .doc extension is not preferred, then option save will have to be used with the desired extension, such as
.rtf

Example 3 : Naming the output file

asdoc sum, save(summary.doc)
OR
asdoc sum, save(summary.rtf)

 

1.4 title(table_title)

Option title(table_title) is an optional option. This option is used to specify table title. If left blank, a default table title will be
used.

asdoc sum, save(summary.doc) title(Descriptive statistics)

 

1.5 Font size i.e. fs(#)

The default font size of asdoc is 10 pt. Option fs(#) can be used to change it. For example, fs(12) or fs(8), etc.

 

1.6 Decimal points i.e. dec(#)

The default decimal points in many commands are 3. In some commands, the decimal points are borrowed from the Stata output and hence they cannot be changed. In several commands, it is possible to change decimal points with option dec(#). For example, dec(2) or dec(4), etc.

 

1.7 Adding text lines to the output file i.e. text(text lines)

We can write text to our output file with option text(text lines). This is useful when we want to add details or comments with the Stata
output. In fact, this option makes asdoc really flexible in terms of adding tables and paragraph at the same time. We never have to leave the
Stata interface to add comments or interpretation with the results. One trick that we can play is to use option fs() to change font size and
mark headings and sub-headings in the document. Consider the following examples [I have copied some text from www.wikipedia.org for this example]

1. Write a heading "Details on Cars" in our document
asdoc, text(Details on Cars) fs(16) replace

 

2. Now add some text

asdoc, text(A car is a wheeled motor vehicle used for transportation) append fs(10) 
asdoc, text(Most definitions of car say they run primarily on roads, seat one ) append fs(10) asdoc, text(to eight people, have four tires, and mainly transport people.) append fs(10)

 

3. Now add some statistics

sysuse auto, clear
asdoc sum, append fs(10)

 

1.8 Hide Stata output with option hide

We can suppress Stata output with option hide. It is important to mention that option hide might not work with some of the Stata commands (asdoc creates output from log files in some cases).

 

1.9 Getting Stata commands in output files (cmd)

If we need to report the Stata command in the output file, we can use the option cmd.

 

1.10 Abbreviate variable names with option (abb(#))

In case variable names are lengthy, they can be abbreviated in the output file with option abb(#). For example, abb(8). In many cases, the
default value is 10. However, when option label is used, this value is set to = abb + 22

 

1.11 Report variable labels with option (label)

Several commands allow reporting variable labels instead of variable names. For example, the most commonly used commands for reporting statistics are correlate and summarize. Both of these commands allow option label. For example :

asdoc cor, label
asdoc sum, label

 

1.12 Always report equal decimal points (tzok)

The default for report decimal points is to drop trailing zeros and report only valid decimal points. However, we can use the option tzok
i.e. trailing zeros OK, to report equal decimal points for all values even if the trailing values are zero. Therefore, using option
dec(4) for reporting 4 decimal points, the value 2.1 will be reported as follows with and without option tzok.

Default style 2.1
with tzok option 2.1000

 


  • 4

Rolling regressions, beta, t-statistics, and SE in Stata

Category:Uncategorized

asreg can easily estimate rolling regressions, betas, t-statistics and SE in Stata. To understand the syntax and basic use of asreg, you can watch this Youtube video. In this post, I show how to use asreg for reporting standard errors, fitted values, and t-statistics in a rolling window.

To install asreg, type the following on the Stata command window

ssc install asreg

 

Report standard errors and fitted values 

We shall use the grunfeld data set for our examples. Using a rolling window of 15 observations, let us fit a regression model where our dependent variable is invest and independent variables are mvalue and kstock. We shall estimate the rolling regression separately for each company, therefore, we shall use the prefix bys company : 

Please note that option se and fit are used for reporting standard errors and fitted values, respectively.

webuse grunfeld, clear

bys company: asreg invest mvalue kstock, wind(year 15) fit se

 

Find t-statistics in the rolling window

Once we have the standard errors and coefficients, we can generate t-statistics by dividing respective coefficients on their standard errors. Therefore, to find t-values for the variable mvalue and kstock, we can generate new variables:

gen t_mvalue = _b_mvalue / _se_mvalue

gen t_kstock = _b_kstock / _se_kstock