pasobpart.blogg.se

Egen stata
Egen stata





egen stata
  1. #EGEN STATA HOW TO#
  2. #EGEN STATA INSTALL#
  3. #EGEN STATA SOFTWARE#
  4. #EGEN STATA PLUS#
  5. #EGEN STATA DOWNLOAD#

In this case the -egen- command added only a minute to the total time. Where r_is and r_ps are returns in MONTHS for firm i and size portfolio p, respectively.Īs far as I understand, I will have to calculate (1+r_is) for the fourth month after fiscal year end * (1+r_is) for the next fifth month *….for (1+r_is) for the third month of the upcoming year and subtract from that returns accumulated the same way for portfolios to which the firm is assigned monthly ?Įgen sizedecile = xtile(l. It is a running sum in -generate- commands and a completed sum in -egen- commands.

#EGEN STATA HOW TO#

I am not sure how to edit your code to estimate size adjusted return using monthly CRSP returns where accumulation starts 4 months after the fiscal year end and for one year (Sloan, 1996):Īs per Shi and Zhang (RAST 2012) who replicate Sloan (1996), future sized adjusted returns are calculated as follows: List permno cum_ret minret maxret n_periods n_miss first_date last_date if first=1

egen stata egen stata

However, I will include Stata code below which creates the SAS output table shown on the “Computing Compound Returns” link:īys permno: egen n_miss= total(n_miss_one) In the “Search WRDS” box type “cumulative returns.” Under the “Knowledge Base” tab there is a link to “Computing Cumulative Returns” and under the “Support” tab there is a link to “Ways to Calculate Compound Returns.” The SAS programs you will find are equivalent to the Stata code I have shown above. If you are a WRDS subscriber, log onto WRDS. * Keep only the last trading day of the month for * Calculate the discrete net return by hand */īys id: gen ret2= (prc/prc) -1 if prc=prc * Use Stata’s -egen- function to sum up the returns */īys id: egen sumlnret= sum(lnret) if != 1īys id: gen cum_ret= exp(sumlnret)-1 if prc= prc * Generate the continuously compounded returns,Įxcluding return based on the last day of Nov,īys id: gen lnret= ln(1+retx) if != 1 After accumulating the log returns, I convert these back into a monthly discrete return (this is the cumulative return) and reconcile this return to what one would calculate by simply dividing the last trading day’s price by the first trading day’s price and subtracting one. I use the -bysort- command, abbreviated -bys-, to accumulate only the returns associated with a given firm. There are three different firms included in this sample. Note that I exclude the December 3rd return since this is based on someone holding the stock the last day of November, and I am interested in calculating the monthly December return. This is because the log of a product is the sum of the logs. A multi-period log return is the sum of the individual single-period log returns.

#EGEN STATA PLUS#

The primary identifier of these firms has been scrubbed to avoid copyright infringement.Ĭontinuously compounded returns are defined as the log of 1 plus the discrete net return. I pulled the month of December, 2012 price and return activity for three firms from CRSP. I recommend David Ruppert’s Statistics and Finance: An Introduction to anyone that needs an additional resource on the mathematics of returns. Part 2 shows the Stata equivalent of a SAS program posted in the WRDS Knowledge Base/Support. Part 1 uses an example dataset that I will include in the post so non-WRDS subscribers may follow along. This item may be available elsewhere in EconPapers: Search for items with the same title.This post has two parts.

#EGEN STATA DOWNLOAD#

Windows users should not attempt to download these files with a web browser.Ĭitations: View citations in EconPapers (2) Track citations by RSS feed The module is made available under terms of the GPL v3 ().

#EGEN STATA INSTALL#

Note: This module should be installed from within Stata by typing "ssc install egen_inequal". Keywords: relative mean deviation coefficient of variation Gini index Mehran index Piesch index Kakwani index Theil entropy index mean log deviation generalized entropy (search for similar items in EconPapers) The set of programs in this package uses egen to create newvar of the optionally specified storage type equal to one of the standard inequality and Foster-Greer-Thorbecke (FGT) poverty measures.

#EGEN STATA SOFTWARE#

Statistical Software Components from Boston College Department of Economics EGEN_INEQUAL: Stata module providing extensions to generate inequality and poverty measures







Egen stata