Announcement

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

  • vector of control variables for panel data

    i want to know the command to get vector of control variable. I want to get vector of country level control variables - democratic accountability, log gdp, investment freedom and uncertainty index. These are single values for each country. I want to regress stock returns in this and a fixed effect dummy variable.

  • #2
    i am attaching the article i am referring to.
    Attached Files

    Comment


    • #3
      * For pooled OLS regression with robust standard errors:
      Code:
      reg stockreturns democraticaccountability loggdp investment freedom uncertaintyindex, robust
      * For a panel model with random effects and robust standard errors:
      Code:
      xtreg stockreturns democraticaccountability loggdp investment freedom uncertaintyindex, re robust
      To select the appropriate model among the above, you type:
      Code:
      xttest0
      If the test is significant, then choose the random effect model and go to the next step.

      * Fixed effect versus random effect panel model:
      Code:
      xtoverid
      If the test is significant, then the final model should the one with fixed effects and robust standard errors and you type:
      Code:
      xtreg stockreturns democraticaccountability loggdp investment freedom uncertaintyindex, fe robust

      Please note that the names of your variables should be the same as they appear in your .dta file.
      If you suspect cross sectional dependence, then you can use -xtcd2- to test for it. When there is cross sectional dependence, then you should use -xtscc- command instead of-xtreg-. See Stata Help for xtscc after installing the command if not installed.
      Code:
      ssc install xtscc
      help xtscc
      Hope this helps and answers your query.
      Last edited by Emna Trabelsi; 29 Aug 2020, 11:36.

      Comment


      • #4
        i am doing a fixed effect with panel pooled data regression

        Comment


        • #5
          I have only on value for these control variables whereas my stock returns are daily and so are the deaths and confirmed cases. How to i fix that?

          Comment


          • #6
            So your control variables are either time-invariant or you are working on just one country. To have panel data, you need time-varying observations for each variable (or daily as in the case of the stock returns) by country.

            Comment


            • #7
              Originally posted by kazi naher View Post
              i am doing a fixed effect with panel pooled data regression
              If you want to follow the model estimated in the attached paper, you type:
              Code:
              reg stockreturns democraticaccountability loggdp investment freedom uncertaintyindex i.time, robust
              Last edited by Emna Trabelsi; 29 Aug 2020, 12:09.

              Comment


              • #8
                this is showing r(2001) error as i have only one value for democratic accountability ,gdp, investment freedom and uncertainty avoidance index for each country

                Comment


                • #9
                  i am working with 35 countries and the model in the paper is exactly what i am trying to run. But each country has only one value for each data for the control variable. How to i balance them to match with my daily stock returns,confirmed cases and deaths for each country as in the paper table 2?

                  Comment


                  • #10
                    Originally posted by kazi naher View Post
                    i am working with 35 countries and the model in the paper is exactly what i am trying to run. But each country has only one value for each data for the control variable. How to i balance them to match with my daily stock returns,confirmed cases and deaths for each country as in the paper table 2?
                    When you run
                    Code:
                    reg stockreturns democraticaccountability loggdp investment freedom uncertaintyindex i.time, robust
                    , what do you obtain? Please you need to correct the names of all variables and of the time variable (I named here it time).

                    You also need to give an excerpt of your data. Maybe, someone else can help.

                    Comment


                    • #11
                      Here an example of a (imaginary) dataset of two countries and with 7 daily obervations for each country. Your data should look something like this:
                      Code:
                      * Example generated by -dataex-. To install: ssc install dataex
                      clear
                      input float(stockreturns democraticaccountability uncertaintyindex deathcases id time)
                        30 5 2  10 1 1
                      2514 5 2  12 1 2
                        12 5 2  36 1 3
                       250 5 2 150 1 4
                        14 5 2 100 1 5
                       140 5 2  10 1 6
                        32 5 2 115 1 7
                        30 6 3  20 2 1
                        25 6 3  40 2 2
                        36 6 3 536 2 3
                       900 6 3  23 2 4
                        40 6 3  50 2 5
                       365 6 3  12 2 6
                        50 6 3 123 2 7
                      end

                      Here, democraticaccountability and uncertaintyindex are time-invariant (one value for each country).
                      Last edited by Emna Trabelsi; 29 Aug 2020, 12:24.

                      Comment


                      • #12
                        here are the excel files - first sheet shows my control variables for each country - the years depending on the latest data available. The second sheet shows the stock returns of major index of each country and the daily confirmed cases and deaths in each country. I would like to know how to I balance them so that the number of observations are equal for all since that is the main error for getting the vector
                        Attached Files

                        Comment


                        • #13
                          I want to get the command to balance my unbalanced data, that is single observation for control variables to daily observation.

                          Comment


                          • #14
                            Originally posted by Emna Trabelsi View Post

                            When you run
                            Code:
                            reg stockreturns democraticaccountability loggdp investment freedom uncertaintyindex i.time, robust
                            , what do you obtain? Please you need to correct the names of all variables and of the time variable (I named here it time).

                            You also need to give an excerpt of your data. Maybe, someone else can help.
                            it says omitted for the control variables. I have used DATE as time
                            Attached Files

                            Comment


                            • #15
                              Originally posted by kazi naher View Post

                              it says omitted for the control variables. I have used DATE as time
                              You need to rearrange your data in your Excel file and obtain a final dataset before running any regression. The problem is in the look of your data. I have no knowledge of a stata command that can balance your data in just one step for instance, but I will see what we can do to achieve the final result without a promise.
                              Last edited by Emna Trabelsi; 31 Aug 2020, 08:55.

                              Comment

                              Working...
                              X