Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • Batch Regression

    Hi Guys,

    I am somewhat of a newbie at Stata. I have panel data of around 80 firms with daily data taken over a three year period. In an excel file I have stacked the data such that it is chronologically sorted by Company ID. Hence; the data for three years for Deutsche Bank is on top of the same data for Citi Group.. So on so forth.

    I have three columns; CDS spread, Total Return Index, and Implied Volatility.
    The first step is to run three regressions; where the dependent variable on the LHS of each equation is the change in the respective market, and dependent variables are the lagged values of the changes in the other markets( ie deltaCDS= alpha + l.CDS + l.IV + l.Return)
    The second step is to predict the residuals from each regression.
    The third is to conduct an Seemingly unrelated regression with three equations where the dependent variable is the change in the respective market, and the dependent variables are the lagged values of the residuals from the other markets ( ie delta CDS= alpha + l.u(CDS) + l.u(IV) + l.u(Return))

    My question to you guys is, is there a way that I am able to do this using the batch excel as opposed to loading the data for each firm and running the process, saving, then repeating 80 times.

    I apologize if there is any confusion, please feel free to ask any questions for further clarification.

    Thanks!

  • #2
    Present an example of your data using the dataex command. See FAQ 12.2 What to say about your data here https://www.statalist.org/forums/help#noanswer .

    Comment


    • #3
      Originally posted by Budu Gulo View Post
      Present an example of your data using the dataex command. See FAQ 12.2 What to say about your data here https://www.statalist.org/forums/help#noanswer .
      Budu, thank you for your reply. I'm struggling to understand how to copy the data into Statalist. Sorry for this, I am very new to this. Also, even if I'm showing only a sample of two firms; that is still around 2000 rows x 3 columns. Is that too much? Thanks for your guidance

      Comment


      • #4
        Hi Hamza,

        Please read the FAQ, specially (but not only) topic 12.

        From Stata 14.2 onward, dataex is a built in command. If you have a prior version of Stata, type

        Code:
        findit dataex
        and install it. If you then run:

        Code:
        dataex
        a code to generate your database will be shown. If your database is too big (or if you don't want to share it entirely due to whatever concerns one might have), perhaps its good to restrict variables and observations on the database command. Such task can be achieved with a command such as:

        Code:
        dataex var1 var2 var3 in 1/10
        Whis will generate a code (that will be displayed on your results window in Stata) that will allow others to create var1 var2 and var3 and only for the fist 10 observations in the database.

        Comment


        • #5
          Originally posted by Igor Paploski View Post
          Hi Hamza,

          Please read the FAQ, specially (but not only) topic 12.

          From Stata 14.2 onward, dataex is a built in command. If you have a prior version of Stata, type

          Code:
          findit dataex
          and install it. If you then run:

          Code:
          dataex
          a code to generate your database will be shown. If your database is too big (or if you don't want to share it entirely due to whatever concerns one might have), perhaps its good to restrict variables and observations on the database command. Such task can be achieved with a command such as:

          Code:
          dataex var1 var2 var3 in 1/10
          Whis will generate a code (that will be displayed on your results window in Stata) that will allow others to create var1 var2 and var3 and only for the fist 10 observations in the database.
          I've done so, and these are the first ten observations. Let me know if you require further clarity. Once again I apologise about my relatively amateur understanding of Stata!!

          Code:
          * Example generated by -dataex-. To install: ssc install dataex
          clear
          input int DATE str9 CID double(YRSRMIDSPREAD TOTALRETURNINDEX Impliedvolatility)
          18263 "Diageo" 71.34999    31762 .15961999999999998
          18266 "Diageo" 67.43999  31732.7 .19079000000000002
          18267 "Diageo" 64.43999 31146.68             .19716
          18268 "Diageo" 64.43999 31058.78             .19019
          18269 "Diageo"    64.42 31263.89            .189145
          18270 "Diageo" 65.40999 31263.89            .188465
          18273 "Diageo" 63.42999 31175.98             .18803
          18274 "Diageo"    64.42 30941.58             .18675
          18275 "Diageo"    66.39 31029.48             .18838
          18276 "Diageo" 68.34999 31381.09             .18017
          end
          format %tdnn/dd/CCYY DATE

          Comment


          • #6
            Bump!

            Comment

            Working...
            X