Announcement

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

  • #16
    Eric:
    I want to model the prices in a first model, and the amounts in a second model ;using multilevel fixed effects model for each.
    I don't think I will be able to do both models as I have time constraints, so I will be focusing on determining the factors affecting the prices in a first place.
    How can I overcome the r(451) error to do a pooled OLS, a random fixed effects or multilevel fixed effects models ?
    Whatever model I am using the problem persits, since I can't set the dataset as panel.

    Comment


    • #17
      Lamia:
      the problem you experience cannot persist with pooled OLS, as you do not have to -xtset- your data beforehand.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #18
        Lamia, would you please write down in detail the equation you which to estimate. Neither Carlo nor I nor anyone else can guess it.

        Comment


        • #19
          I planned on estimating multiples models , and choosing one after running tests and checking results.
          But as you know I couldn't get there because of the date variable.
          Here is a part of the do-file I wrote.


          Code:
          global id SubCategory_Species
          global t Date
          global ylist log_CADh
          global xlist Regions Fishmonger_Type Work_Envrmt Boat_Category  Boat_Type  Final_Use Entity_Type Entity_City
          
          describe $id $t $ylist $xlist
          summarize $id $t $ylist $xlist
          
          ************Setting Data as Panel Data***********
          sort $id $t
          xtset $id $t
          xtdescribe
          xtsum $id $t $ylist $xlist
          
          ************Models*******************************
          *Pooled OLS estimator
          reg $ylist $xlist
          
          * Population-averaged estimator
          xtreg $ylist $xlist, pa
          
          * Between estimator
          xtreg $ylist $xlist, be
          
          * Fixed effects or within estimator
          xtreg $ylist $xlist, fe
          
          * First-differences estimator
          reg D.($ylist $xlist), noconstant
          
          * Random effects estimator
          xtreg $ylist $xlist, re theta
          
          *************Tests******************************
          * Hausman test for fixed versus random effects model
          quietly xtreg $ylist $xlist, fe
          estimates store fixed
          quietly xtreg $ylist $xlist, re
          estimates store random
          hausman fixed random
          
          * Breusch-Pagan LM test for random effects versus OLS
          quietly xtreg $ylist $xlist, re
          xttest0

          Comment


          • #20
            Lamia:
            the pooled OLS that you coded up is not actually pooled, as it treats each observation as independent,
            You should go:
            Code:
            reg $ylist $xlist, vce(cluster panelid)
            Kind regards,
            Carlo
            (Stata 19.0)

            Comment


            • #21
              A Static Pooled OLS is the only possibility I see for the moment. You will have to decide on which of the variables you wish to cluster your residuals.

              Comment


              • #22
                Thanks a lot for all your help Carlo & Eric,
                I tried the pooled OLS with clustered residuals and it worked.

                I am still trying to solve the issue as Pooled OLS doesn't always give consistent coefficients, and I would like to do the Hausman and Breusch-Pagan LM test to make sure the results will be relevant.
                I went back to Carlo's idea to add fictious hours to the date variable. My date variable already has hours, only all observations within the same day have 00:00:00. I think this may have been the reason why it didn't work.
                I am now looking for a way to assign different times for each observations of a day.
                I figured this could be a way to go around the error

                How can I transform Old_Date into New_Date?

                Old_Date New_Date
                01/01/2010 00:00:00 01/01/2010 00:00:00
                01/01/2010 00:00:00 01/01/2010 00:01:00
                01/01/2010 00:00:00 01/01/2010 00:02:00
                01/01/2010 00:00:00 01/01/2010 00:03:00
                01/01/2010 00:00:00 01/01/2010 00:04:00

                Comment


                • #23
                  Clustering the residuals takes care of serial correlation in the residuals. the important assumption is that the residuals are not correlated with the explanatory. The dummy variables you introduce (Regions Fishmonger_Type Work_Envrmt Boat_Category Boat_Type Final_Use Entity_Type Entity_City) should take care of at least part of that.

                  Comment


                  • #24
                    Eric :
                    I did the Pooled OLS with clustered residuals and run the -testparm- afterwards.
                    The results show that the F-statistic is significant which means that we can reject poolability across time and across category of species at the 5 percent level of significance, which is evidence in favor of fixed effects.
                    This is why I am trying to fix the time variable to be able to run a fixed effects model.

                    Comment


                    • #25
                      Someone else will have to step in here

                      Comment


                      • #26
                        Thanks a lot for all of your answers, you've been very helpful

                        Comment

                        Working...
                        X