Category Archives: Blog

  • 0

Find annual | monthly cumulative (product) of returns

Tags : 

The problem


Let’s say that we have daily stock returns. We want to convert those returns to cumulative returns for a weekly, monthly or yearly frequency.

Where cumulative returns = (1+Ri1) * (1+Ri2) * (1+R3) * … (1+R4) – 1

 

Solution

First create the weekly, monthly or year identifier, and then use asrol program.

Let us use this data set [Click here to download], also shown below and find returns for different frequencies.

 +----------------------+
 | id    date    returns|
 |----------------------|
 | 1 30jun1993 .7437958 |
 | 1 02jul1993 .0674011 |
 | 1 06jul1993 .2668857 |
 | 1 14jul1993 .0454151 |
 | 1 19jul1993 .1340756 |
 |----------------------|
 | 1 29jul1993 .8053644 |
 | 1 13aug1993 .5861199 |
 | 1 24sep1993 .3200437 |
 | 1 19oct1993 .0098762 |
 | 1 19oct1993 .005197  |
 +----------------------+

 

Find weekly cumulative returns

Let us first install asrol from ssc

ssc install asrol

Now create weekly date

gen week = wofd(date)

Now find the returns using asrol

bys id week :  asrol returns, stat(product) add(1)

Note : add(1) adds 1 with each returns before multiplication and then subtracts 1 at the end.

Find monthly cumulative returns

gen month = mofd(date)
bys id month:  asrol returns, stat(product) add(1)

Find yearly cumulative returns

 gen year= year(date)
bys id year:  asrol returns, stat(product) add(1)

  • 2

Research Topics in Finance | Financing / Capital Structure Choices

Tags : 

In this blog post, I would like to present a list of research topics related to financing or capital structure decisions.


 Top managers experiences and firms’ capital structure choices

 Do macroeconomic factors affect the choice of debt /equity financing? How are small firms affected?

 Supply of capital and debt-equity choices

 Persistence in capital structure decisions?

4  Can earning timing affect capital structure decisions?

5   Can stock return shocks affect capital structure decisions?

6   Effects of Capital Structure on Cost of Capital

7  judicial efficiency and capital structure: is there a relation?

8   Cultural and religious effects on capital structure choices

9  Credit market imperfections and capital structure changes

10  How corporate governance affect capital structure decisions

11  How financial crisis plays a role in altering capital structures

12  Country tax system and capital structure choices

13  Information asymmetries and capital structure decisions around the world

14  Product market competition and capital structure decisions

15  Capital structure adjustments: Do macroeconomic and business risks matter?

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

17  Competing theories of capital structure: pecking order theory vs trade-off theory

18  Can hedging increase the debt capacity of a firm?

19  Can credit ratings determine firm’s capital structure

20  Diversification and capital structure


  • 3

Rolling window regressions in Stata

Tags : 

Rolling window statistics are also known as sliding or moving window statistics. Rolling window regressions have special use in Finance and other disciplines. Rolling window calculations require lots of looping over observations. The problem is compounded by different data structures such as unbalanced panel data, data with many duplicates, and data with many missing values. Yet, there might be data sets that have both time series gaps as well as many duplicate observations across groups.

asreg : A simple and fast solution to rolling window regressions

asreg is a Stata program for estimation of rolling window regressions. To estimate rolling window regressions in Stata, the conventional method is to use the rolling command of Stata. However, that command is too slow, especially for larger data set. asreg is order of magnitude faster than estimating rolling window regressions through conventional methods such as Stata loops or using the Stata’s official rolling command. asreg has the same speed efficiency as asrol. All the rolling window calculations, estimation of regression parameters, and writing the results to Stata variables are done in the Mata language.

 

Why asreg is so fast?

Rolling window calculations require lots of looping over observations. The problem is compounded by different data structures such as unbalanced panel data, data with many duplicates, and data with many missing values. Yet, there might be data sets that have both time series gaps as well as many duplicate observations across groups. asreg does not use a static code for all types of data structures. Instead, asreg intelligently identifies data structures and matches one of its rolling window routines with the data characteristics. Therefore, the rolling window regressions are fast even in larger data sets. asreg writes all regression ouputs to the data in memory as seperate variables. This eliminates the need for writing the results to a separate file, and then merging them back to the data for any further calculations.

 

Installation

asreg can be installed for free by typing the following command in the Stata’s command window:

ssc install asreg

After the installation is complete, we can directly use asreg from the Stata’s command window. Let us use the grunfeld data set from the web and estimate rolling regressions with asreg. To download the data set, type the following from the Stata command window:

webuse grunfeld, clear

Please note that the word clear after comma tells Stata to unload any existing data set from its memory. So this option has to be used carefully as this might result in losing any unsaved changes to the data set in memory.

 

Example 1: regression in a 10-years rolling window

bys company: asreg invest mvalue kstock, wind(year 10)

Explanation: Let us discuss the components of the code line that we used above for 10-years rolling regressions.

bys company : forces asreg to estimate the rolling regression separately for each company

asreg invest mvlaue kstock : asreg invokes the asreg program. Right after asreg, we have to type the name of the dependent variable, and then the full list of independent variables. Therefore, in our example, the dependent variable is invest, and we have two independent variables, i.e., mvalue and kstock.

, wind(year 10) : After comma, the program’s optional options are specified. The phrase wind(year 10) tells Stata to use a rolling window of 10 observation, based on the values of the existing variable year.

 

Example 2: Regression for each company in a recursive window

webuse grunfeld

bys company: asreg invest mvalue kstock, wind(year 10) rec

OR

. bys company: asreg invest mvalue kstock, wind(year 1000)

 

Example 3: Using option minimum

. webuse grunfeld

. bys company: asreg invest mvalue kstock, wind(10) min(5)

 

Example 4: Reporting standard errors

. webuse grunfeld

. bys company: asreg invest mvalue kstock, wind(10) se

 

Example 5: Reporting standard errors, fitted values and residuals

. webuse grunfeld

. bys company: asreg invest mvalue kstock, wind(10) se fit