Announcement

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

  • Dropping the constant term

    Hello! I am having some trouble being able to drop the constant term. I have tried to use nocons and stata tells me that it is not allowed. Is there another way for me to drop the constant term? I have having trouble getting my fixed state effects regression to work.

    Thanks!

  • #2
    Some commands allow a -nocons- option, and others do not. You don't show us what command(s) you are running, so it is hard to comment. First check the help file for that command to see if there is a -nocons- option or not.

    In general, fixed effects models in Stata do not support the -nocons- option. The reason is that the fixed effects model is inherently unidentified. So, to identify the model, Stata imposes the constraint that the average of the fixed effects is zero. The constant term therefore captures the mean outcome conditional on all covariates and fixed-effects = 0, which if your variables are conveniently centered, is a very useful statistic. It also follows that , a model with no constant term could be severely misspecified.

    If, however, you are convinced that there is a strong scientific reason to posit that the constant in your model must be zero, you can see what you would get from such a model by running:

    Code:
    test _b[_cons] = 0, coef
    after your regression.

    Stata will test the hypothesis that your constant term is zero, and will also replay the regression results constrained to have the constant = 0.
    Last edited by Clyde Schechter; 20 May 2015, 14:36.

    Comment


    • #3
      Thanks for your help Clyde!

      Comment


      • #4
        assuming I know what I am doing and I want to add or drop the constant term (some people argue that the program should not "think" for the researcher, no?), is there any way I can force Stata to use a constant in a routine that is not as developed as the standard commands? Asked differently: How can I include a constant or make sure that there is no constant inside a regression equation? I remember something like

        reg y -c x

        but that is not correct?
        Last edited by Frank Taumann; 05 Oct 2019, 12:29.

        Comment


        • #5
          You typically can force a constant or remove a constant unless the model would be unidentified in your preferred form; that would be asking Stata to estimate an impossible model, which is by definition impossible. The syntax you propose is indeed not standard Stata syntax. Typically this is handled through the nocons option (adding a constant is the default).

          You seem to be referring to a specific command, but you are not telling us what that command is. That makes it hard for us to give you more specific advise. Can you help us help you by saying which command you are talking about?
          ---------------------------------
          Maarten L. Buis
          University of Konstanz
          Department of history and sociology
          box 40
          78457 Konstanz
          Germany
          http://www.maartenbuis.nl
          ---------------------------------

          Comment


          • #6
            Originally posted by Clyde Schechter View Post
            Some commands allow a -nocons- option, and others do not. You don't show us what command(s) you are running, so it is hard to comment. First check the help file for that command to see if there is a -nocons- option or not.

            In general, fixed effects models in Stata do not support the -nocons- option. The reason is that the fixed effects model is inherently unidentified. So, to identify the model, Stata imposes the constraint that the average of the fixed effects is zero. The constant term therefore captures the mean outcome conditional on all covariates and fixed-effects = 0, which if your variables are conveniently centered, is a very useful statistic. It also follows that , a model with no constant term could be severely misspecified.

            If, however, you are convinced that there is a strong scientific reason to posit that the constant in your model must be zero, you can see what you would get from such a model by running:

            Code:
            test _b[_cons] = 0, coef
            after your regression.

            Stata will test the hypothesis that your constant term is zero, and will also replay the regression results constrained to have the constant = 0.
            Hi Clyde, is there a way to constrain the constant term to be a specific value? How to denote the constant term in the constraint command? Thank you!

            Comment


            • #7
              You do it like this:

              Code:
              . sysuse auto
              (1978 Automobile Data)
              
              . constraint define 1 _cons=77
              
              . cnsreg price mpg headroom, constraint(1)
              
              Constrained linear regression                   Number of obs     =         74
                                                              F(   2,     72)   =     127.00
                                                              Prob > F          =     0.0000
                                                              Root MSE          =  3218.9657
              
               ( 1)  _cons = 77
              ------------------------------------------------------------------------------
                     price |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
              -------------+----------------------------------------------------------------
                       mpg |   38.54329   38.99286     0.99   0.326    -39.18755    116.2741
                  headroom |   1668.344   276.6659     6.03   0.000      1116.82    2219.867
                     _cons |         77  (constrained)
              ------------------------------------------------------------------------------
              Originally posted by shem shen View Post

              Hi Clyde, is there a way to constrain the constant term to be a specific value? How to denote the constant term in the constraint command? Thank you!

              Comment


              • #8
                Originally posted by Joro Kolev View Post
                You do it like this:

                Code:
                . sysuse auto
                (1978 Automobile Data)
                
                . constraint define 1 _cons=77
                
                . cnsreg price mpg headroom, constraint(1)
                
                Constrained linear regression Number of obs = 74
                F( 2, 72) = 127.00
                Prob > F = 0.0000
                Root MSE = 3218.9657
                
                ( 1) _cons = 77
                ------------------------------------------------------------------------------
                price | Coef. Std. Err. t P>|t| [95% Conf. Interval]
                -------------+----------------------------------------------------------------
                mpg | 38.54329 38.99286 0.99 0.326 -39.18755 116.2741
                headroom | 1668.344 276.6659 6.03 0.000 1116.82 2219.867
                _cons | 77 (constrained)
                ------------------------------------------------------------------------------
                Thank you again Joro! You have been of great help to me recently.

                Comment

                Working...
                X