Author Archives: Attaullah Shah

  • 0

Stata Dates: Conversion from one format to another

Case 1: From String to Stata format

Usually, when we import data manually into the Stata Editor, the dates are shown in string format. For example, Nov202011, November202011, or  etc. We can use the gen command with date function

gen newdate = date(oldDate, "MDY")

 

Case 2: From daily to monthly

gen monthly = mofd(daily_date)

 

Case 3: From daily to weekly

gen monthly = wofd(daily_date)

Case 4: From daily to quarterly

gen monthly = qofd(daily_date)

 

Case 5: From daily to yearly

gen monthly = year(daily_date)

 

Case 6: From monthly to daily

If our date is recorded in monthly numeric format such as 2001m1, 2001m2, etc, then:

gen daily = dofm(monthly_date)

  • 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)

  • 0

Research Topics in Islamic Banking and Finance

 


 How Islamic financial instruments can be used in international trade?

 A mechanism for inter-bank transactions for Islamic and conventional banks

Can Sharia board play a role in the development of Islamic instruments?

4 Tawarruq as a tool of inter-bank borrowing

5  Risk management framework for Islamic banks: do we need something special?

6  Have the challenges faced by Islamic banks changed over the last decade?

7  The dynamics of financial crisis: Conventional vs Islamic finance

8  Can Zakat be used as a microfinancing tools?

9  Value at Risk of Sukuk and conventional bonds

10  Risk analysis of Murabaha financing and leasing

11  What customers say about Islamic banking? Values vs religious perspectives

12  Can ownership structure affect earning management?

13 Collaborative Islamic Banking Service: The Case of Ijarah

14 Success factors of collaboration in Islamic banks

15 Constraints in the application of partnerships in Islamic banks

16  Can Islamic finance reduce nonperforming loans?

17  Which firms use Islamic financing?

18  Can SME’s benefit more from Islamic financing?

19  Islamic banking development and access to credit

20  Islamic finance and economic growth


  • 0

Research Topics in Finance: Earning Management

Tags : 

 


 The relationship between earning management and market liquidity

 Are top management pays and earning management practices related?

 Can financial crisis affect earning management practices?

 The effect of the earning transparency on cost of capital 

4  The impact of leverage on accrual-based earnings management

5  Can institutional investors exploit the accrual anomaly?

6  Accrual-based and real earnings management: Are investors protected?

7  Cost of capital and earnings transparency

8  The effect of accounting comparability on the accrual-based and real earnings management

9  Earnings management and accrual anomaly across market states and business cycles

10  Short-term debt maturity, monitoring and accruals-based earnings management

11  The effect of mandatory IFRS adoption on real and accrual-based earnings management activities

12  Can ownership structure affect earning management?

13  Regulatory Risk and the Cost of Capital

14  Accrual-based and real earnings management activities around seasoned equity offerings

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

16  Accruals, cash flows, and operating profitability in the cross section of stock returns

17  Does family involvement explain why corporate social responsibility affects earnings management?

18  How excess control and earning management practices are related?

19  Managerial entrenchment and earnings management

20  Product market competition and earnings management


  • 0

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


  • 0

How to convert numeric date to Stata date

Tags : 

Real-life data can come in a variety of formats.  In this post, I would like to show how to convert a numeric date to Stata date.

The problem

Let’s use an example.  Say that we have date variable in the following format and we want to convert it to Stata format.

 +----------+
 | datevar  |
 |----------|
 | 20170520 |
 | 20170521 |
 | 20170522 |
 | 20170524 |
 | 20170524 |
 +----------+

Solution

There are two steps involved to convert numeric variable to Stata format. These are:

tostring date, replace
gen date2 = date(datevar, "YMD")
format date2 %td

Explanation

The first line of code converts the numeric variable to string variable. This is necessary as the date function can work only on string variables. The second line of code uses the date function to generate a new variable date2 from the existing variable datevar . The “YMD” sepcifies how the datevar has the sorting of  year, month, and day. The last line of code just formats the new variable so that human can easily read it.


  • 2

T-bills rates, auction dates, bids and offer prices

Tags : 

Tbills




  • 0

List of KSE-100 Companies September 2017

KSE-100 companies




  • -

Research Topics in Finance – Corporate Governance

Tags : 

 Green governance and sustainability reporting in industries that are more likely to pollute e.g, oil, mining, gas etc

 Do better governed firms generate more green patents? Can institutional ownership play a role?

 Do Investors and creditors price firms social and governance risks?

  Are family firms more concerned about governance of the firm?

 How green growth is possible for developing countries?

 

 


  • 2

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