Assignment 4.

Find the first 100 companies that have daily returns during all of 1980 and calculate the equal weighted beta and alpha for 1980 for each of these companies.  Write out the company name, permno, cusip, year, alpha, beta and number of observations in your estimate.  Only calculate this for companies that have no more than 10 missing observations.

Specific instructions to help you:

  1. The equal weighted index is called EWRETD in the CRSP files.  It is an equal weighted index of all companies on our file, so it includes all companies that trade on the NYSE/AMEX or OTC.
  2. Betas can be calculated with the subroutine RLINES, which can be found in the file rlines.f on my /public directory.   The first line of the file is an example of a call to the subroutine.
  3. You will need to create two work vectors--I call them xwork and ywork. (don't forget to dimension them--how many trading days are there in 1980?)
  4. You can use the crsp-supplied subroutine INDXDT(yyyymmdd) to find the index corresponding to a certain date.  For example, if you want the variable istart to be the index for June 5, 1980, then you would use ISTART = INDXDT(19800605).  You want to calculate betas from 19800101 to 19801231.
  5. In CRSP, missing returns are coded by numbers less than -1.0  A -99.0 means a price wasn't available on that day.  A -66.0 means that there were 9 or more missing observations prior to this missing observation.  It also means that the next non-missing observation is a 1-day return.
  6. A non-missing observation followed by a missing observation may still not be a good observation.  If the missing observation was coded -99.0, then the non-missing observation is a multi day return.  If the missing observation was coded -66.0, then the non-missing observation is a 1 day return.  You should use only 1-day returns in your estimation.  That means delete observations for all days with reported returns less than -1.0.  You will also have to check for and delete observations that follow any missing observation EXCEPT for -66.0 observations.

 

return    r1    r2     r3    r4   -99.0  r6

      -----|-----|-----|-----|-----|-----|

day        1      2     3     4      5     6

here, r6 is actually the return for both days 5 and 6, since it is based on closing proces on day 4 and day 6.

 

return    r1  -99.0 -99.0 -99.0 -99.0    r6

      -----|-----|-----|-----|-----|-----|

day        1      2     3     4      5     6

here, r6 is the return for days 2 through 6.  It is a 5-day return since it is based on closing proces on day 1 and day 6.

 

return  -99.0 -99.0 -99.0 -99.0 -66.0   r6

      -----|-----|-----|-----|-----|-----|

day        1      2     3     4      5     6

here, r6 is a 1 day return, and is based on closing prices on day 5 and 6.   Presumably there are at least 10 missing observations before day 6, and so CRSP does not report a cumulative return for r6.

 

return  -88.0 -88.0 -88.0 -88.0 -88.0   r6

      -----|-----|-----|-----|-----|-----|

day        1      2     3     4      5     6

r6 is a 1-day return.  Days before day 6 are before BEGRET. 

 

You can look at a program I have written that is more complicated than what you want, if you want to.  It is in my /public directory and is called betasave.f