Announcement

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

  • multivariate regression

    Hello,

    I try to analyze panel data using the following regression model.
    All variables have been defined and only valid observations are left in the sample.
    alpha i are firm fixed effects, and gamma t are time fixed effects. Can you tell me the command for this regression?
    I would really appreciate your help.
    Thank you!
    Regards
    Johanna
    Click image for larger version

Name:	Bildschirmfoto 2020-08-11 um 06.57.24.png
Views:	1
Size:	23.4 KB
ID:	1568419

    Last edited by Johanna Behling; 13 Aug 2020, 08:27.

  • #2
    first you need to transform variables involving ln so create two new varibales
    gen lnCOST = ln(COST)
    gen lnSALES = ln(SALES)
    btw when you take the difference of ln of a variable that is generally accepted as an approximation for a growth rate of the variable. So, you seem to be modeling
    growth rate of COST and using growth rate of SALES as one of your independent variables.

    next you need to tsset your data so you can do time related calculations like difference operator. so

    tsset yourtimevariable yourcrossectionalvariable

    (you have not specified the names of your time variable and the crosssectional variable so you need to substitute those in the above command

    then expand the equation which would be something like

    xtreg D.lnCOST D.lnSALES DEC#D.lnSALES DEC#D.lnSALES#SUCCDEC DEC#D.lnSALES#D.GDP DEC#D.lnSALES#AINT DEC#D.lnSALES#EINT ///
    DEC#D.lnSALES#LEV DEC#D.lnSALES#ERT yourcrossectionalvariable yourtimevariable

    there are succinct ways of achieving the interaction variables using ## for continuous and categorical variables
    So, this is the gist of what you need to do and should put you in the right direction. you might want to start the xtreg model by adding variables one by one and see if you run into any problems

    Comment


    • #3
      I checked the documentation for the tsset command and it looks like panelvar goes first. so it should be like following FYI
      tsset yourcrossectionalvariable yourtimevariable

      Comment


      • #4
        i dont know the continuous variable specification for difference of a continuous variable. what i would do is create another variable for difference of a continuous variable

        so it would then it will look like this

        tsset yourtimevariable yourcrossectionalvariable
        gen lnCOST = ln(COST)
        gen lnSALES = ln(SALES)

        gen DlnCOST = D.lnCOST
        gen DlnSALES =D.lnSALES
        gen DGDP =D.GDP

        xt DlnCOST DlnSALES DEC#c.DlnSALES DEC#c.DlnSALES#SUCCDEC DEC#c.DlnSALES#c.DGDP DEC#c.DlnSALES#AINT DEC#c.DlnSALES#EINT ///
        DEC#c.DlnSALES#LEV DEC#c.DlnSALES#ERT yourcrossectionalvariable yourtimevariable

        Comment


        • #5
          Hello Oscar,

          thank you for your reply. But it does not seem to work.
          I always get the error r198 # invalid name.

          I have no idea how to solve that problem..
          I predefined all variables in excel - so I do not need to calculate growth rates, changes or logarithms in STATA anymore.
          But I cannot seem to make the regression work..

          Thank you very much for your help.

          Comment


          • #6
            Invalid name usually indicates that there is a problem with the variable name. After importing to the data to Stata look at the name of variables and make sure they are exactly as the ones you are using in the xtreg command. I just saw that in the last post I put down xt only instead of xtreg should have been

            xtreg DlnCOST DlnSALES DEC#c.DlnSALES DEC#c.DlnSALES#SUCCDEC DEC#c.DlnSALES#c.DGDP DEC#c.DlnSALES#AINT DEC#c.DlnSALES#EINT ///
            DEC#c.DlnSALES#LEV DEC#c.DlnSALES#ERT yourcrossectionalvariable yourtimevariable

            If that does not help please post a sample data by typing dataex and copying the data and sahring that in your reply to this forum. That is the only way you can get help to solve these kinds of issues.

            Comment


            • #7
              thank you! Problem solved.
              Have a wonderful day!

              Comment

              Working...
              X