Announcement

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

  • Regression method

    Hello,

    I would like to know if I can run a standard regression
    Code:
    regress y var1 var2 var3
    on the below database or should I use another method of regression?



    Code:
    * Example generated by -dataex-. For more info, type help dataex
    clear
    input str7(id month) long(y var1 var2 var3)
    "USA"     "2014M02" 58075395  7677321 22503195 73947285
    "USA"     "2014M03" 26658291 33806848 61213917 70062420
    "USA"     "2014M03" 97800356 92502019 39727562 44508131
    "USA"     "2014M04" 44947401 54822658 66881131  1927301
    "USA"     "2014M04" 87054495 81138495 10802439 19265887
    "USA"     "2014M05" 75487175 34168159 40409504 15126395
    "USA"     "2014M04" 56010657 12855831 55464080 48308697
    "USA"     "2014M05" 71748727 32926146 31989655 52661836
    "USA"     "2014M06" 47159684 39475847 27049612 61460741
    "USA"     "2014M07"  5992328 90982644 97993017 33013150
    "USA"     "2014M08" 66021911  7890962 14943077 81286134
    "Germany" "2014M03" 74087150 37074697 11938171 54214662
    "Germany" "2014M03" 53186213 28989557 78157066 58197954
    "Germany" "2014M04" 65500196 46711602 54956176 26441887
    "Germany" "2014M04" 70580063  5275746 23528025 38507791
    "Germany" "2017M02" 82856546 89313765 63225803 15745660
    "Germany" "2017M03" 98988476 74092513  7584715 81650510
    "India"   "2015M04" 17095578 34228487 46220618 94118111
    "India"   "2015M07" 21291478 53898418 96638338 31378799
    "India"   "2016M02" 90554189 97207157 78436690 31048102
    "Canada"  "2016M07" 24305731 25289635  4143721 62083758
    "Canada"  "2016M08"  8649956 93202609 35735765 65847688
    "Canada"  "2016M09" 98773682 48527167 48289075  4902474
    "Canada"  "2016M10" 60206930 49790282 77466615  9445386
    "Canada"  "2016M11" 50942993 86306856 48901063 90148308
    "Canada"  "2016M12" 95461783 52626810 34223068 16251594
    "Canada"  "2016M12" 57045935 98164461 19729235 42525728
    "Canada"  "2016M12" 47837261 12392510  8280669 85458911
    "Canada"  "2014M03" 26406695 96660955 15980796 75427726
    end
    Thank you

  • #2
    It depends on what you want, but in most cases that would be problematic: observations from the same country probably have more in common with one another, and observations closser together in time probably have more in common with one another. Your model often needs to take that into account. The xt suit of commands is designed for this type of situation, see help xt, also don't forget the pdf manual entry (link to that is at the top of the help-file) for even more information.
    ---------------------------------
    Maarten L. Buis
    University of Konstanz
    Department of history and sociology
    box 40
    78457 Konstanz
    Germany
    http://www.maartenbuis.nl
    ---------------------------------

    Comment


    • #3
      Ishto:
      as Maarten advised you about, you should consider an -xt- suite command.
      I would start off with -xtreg,fe- (I assume that your regressand is continuous).
      Kind regards,
      Carlo
      (StataNow 18.5)

      Comment


      • #4
        Thank you Maarten,

        I indeed tried to use the panel data option for the data (xtset). But I got the following error message:
        repeated time values within panel
        .

        Comment


        • #5
          The problem is that country and time are sometimes repeated. For example

          Code:
          "Germany" "2014M03" 74087150 37074697 11938171 54214662
          "Germany" "2014M03" 53186213 28989557 78157066 58197954
          How can this happen? What is the data generating process?
          Best wishes

          (Stata 16.1 MP)

          Comment


          • #6
            Ishto:
            this happens pretty frequently.
            You can simply -xtset- your data with -panelid- only:
            Code:
            xtset panelid
            This fix, that comes at the cost of making time-series operators unavailabe, still allows you to plug in the right-hand side of your regression equation -i.timevar-.
            Obviously, I would duly note Felix's wise advice to double-check your dataset and fix trivial issues, such as repeated data entry of the very same observation(s).
            Kind regards,
            Carlo
            (StataNow 18.5)

            Comment


            • #7
              Very helpful, thank you.

              Comment

              Working...
              X