Announcement

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

  • Keeping the residual and accounting for heteroscedasticity

    I have two questions- I have time series data over 18 years for internet search terms- I have deasonalised this data on the day of the week and month dummies. How do I generate a new variable by keeping the residual for the terms on each day as a column in my data?
    And also, I want to account for heteroscedasticity by dividing the residual by its standard deviation- is there a shortcut in doing this for all my variables in one go and having this as a new variable in a new column within my data?

  • #2
    Why not use , robust to deal with heteroskedasticity?
    Code:
    regress y x , robust
    predict efit, resid

    Comment


    • #3
      Hi George,
      What is the "efit" part of this? And also is there a way to do this for all my variables in one go as I have around 50?

      Comment


      • #4
        efit is the residual you wanted.

        Code:
        use auto, clear
        foreach var in price mpg rep78 headroom trunk weight {
        qui reg `var' foreign, robust
        predict e_`var', residual
        }

        Comment


        • #5
          You might want to look for autocorrelated errors as well.

          Comment


          • #6
            Thanks for the help George,

            With this I want to keep the residual and have this as a new column on data- e.g. for my search term recession, I want recession_robust as a new variable, with its new residual term. How would I go about doing this?

            Comment


            • #7
              That is exactly what post #4 does.

              Comment

              Working...
              X