Category Archives: Uncategorized

  • 0

Log vs simple returns: Examples and comparisons

Tags : 

Simple vs log returns


Conversion from daily to other frequencies

MS Excel Example 

[Download Example]

id date prices simple ri log_ri ri+1
1 1/1/2010 70
1 1/2/2010 72 2.857% 2.817% 102.857%
1 1/3/2010 75 4.167% 4.082% 104.167%
1 1/4/2010 73 -2.667% -2.703% 97.333%
1 1/5/2010 74 1.370% 1.361% 101.370%
1 1/6/2010 76 2.703% 2.667% 102.703%
1 1/7/2010 77 1.316% 1.307% 101.316%


In the above table, we have data from 1/1/2010 to 1/7/2010.  The first column had firm id; second column has dates; third column has stock prices; fourth and fifth columns have simple and log returns, calculated as:

simple ri = ( Price[i] – Price[i-1] ) /  Price[i-1]  — (Eq. 1)

log ri      =ln ( Price[i]  /  Price[i-1]  — (Eq. 2)

where Price[i] is stock price in the current period,  Price[i-1] is the stock price in the previous period, ln is the natural log. To convert simple returns to n-period cumulative returns, we can use the products of the terms (1 + ri) up to period n. Therefore, the fifth column adds value of 1 to the simple period returns.


Weekly cumulative simple returns

Suppose we wish to find weekly cumulative simple returns from the stock prices, we shall just use the first and the last  stock prices of the week and apply equation (1). Therefore, our cumulative weekly simple return is as follows:

weekly simple ri = ( 77 – 70) /  70 = 10.00%

And if we were to find weekly cumulative simple returns from the daily returns, then we would add 1 to each of the period simple_ri, find its product, and deduct 1 at the end. Therefore, the formula for converting simple periodic daily returns to weekly cumulative returns would be :

Cumulative n-period simple returns =

(1+simple_r1) * (1+simple_r2) *(1+simple_r3)  … (1+simple_rn)  – 1     — (Eq. 3)

Therefore, applying Equation 3 to our example;

Cumulative weekly simple returns =

102.857% *  104.167% * 97.333% * 101.370% * 102.703% * 101.316% -1 = 10.00%


Weekly cumulative log returns

Now suppose we wish to find weekly cumulative log returns from the stock prices, again we shall use the first and the last  of the stock prices of the week in equation (2). So, our cumulative weekly log return is as follows:

weekly log ri =ln ( 77 /  70) = 9.53%

Since log returns are continuously compounded returns, it is normal to see that the log returns are lower than simple returns. To find n-period log returns from daily log returns, we need to just sum up the daily log returns. Therefore :

Cumulative weekly simple returns = 2.817% + 4.082% +  (-2.703%) +  1.361% + 2.667% +  1.307% = 9.53%


Stata Example

We shall continue to use the same data as above. The Stata do file for all of the following steps  can be downloaded from here.

The following lines of code will generate the required data

input float date byte(id prices) float wofd
18263 1 70 2600
18264 1 72 2600
18265 1 75 2600
18266 1 73 2600
18267 1 74 2600
18268 1 76 2600
18269 1 77 2600
format %td date
format %tw wofd
tsset id date

Now to generate simple and log returns

bys id (date) : gen simple_ri = (price / L.price) -1
bys id (date) : gen log_ri = ln(price / L.price)


Cumulative weekly simple returns

we shall use ascol program. This program can be downloaded from SSC by typing:

ssc install ascol

If daily returns are calculated with Eq. 1 above (i.e. simple returns) and they need to be converted to cumulative n-periods returns, we shall use the option ctype(product). For this purpose, we would type the following command:

ascol simple_ri, ctype(product) keep(all) returns toweek

For syntax and option details of ascol, you can type help ascol at the Stata command prompt. We shall just breifly list the option used in the above command. After typing ascol, we need to mention the name of the variable for which cumulative returns are needed. In our case, it is the simple_ri. Then after comma, we invoke various program options. Our first option is ctype(product) , which tells ascol to apply product method of converting from daily to weekly ( see Eq. 3 above ).  Then we use keep(all)  to stop ascol from collapsing the data set to weekly frequency. Absent this option, the data will be reduced to one observation per ID and weekly_period identifier.  We use option returns to tell ascol that we simple_ri variable is a stock-returns variables. The other possibility in this regard is the option price, which can be used if the variable is stock prices.  And finally, we used toweek option for converting the data to weekly frequency. Other possible option in this regard are tomonth, toquarter, and toyear.


Cumulative weekly log returns

IF daily returns were calculated using Eq. 2 above  (i.e. log returns) and they need to be converted to cumulative n-periods returns, we shall use the option ctype(sum). For this purpose, we would type the following command:

 ascol log_ri , ctype(sum) keep(all) returns toweek gen(log_cumRi)

The syntax details remain the same as given above. We have used one additional option gen(log_cum) for naming the new variable as log_cumRi

  • 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

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

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 |


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


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 : 


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