Announcement

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

  • Using TEST or LINCOM to check if a coefficient minus a variable (not included in the reg) is different from zero

    Dear all,

    I need to test if the difference between a coefficient coming from a linear regression and a certain variable (which is in my dataset but which I do NOT use in my regression) is significantly different from zero.

    I am not quite sure how to do it by using "lincom" or "test"

    Assuming that the coefficient I’m interested in is the one of variable X1 and the variable included in my.dta (but NOT used in the regression) is X2, would it OK to right the test as follows:

    lincom _coef[X1] - X2

    I tried to do so, but it does not work (it shows an error: “X2 not found”)

    Many thanks in advance

  • #2
    Welcome to Statalist.

    I don't understand what you are trying to do. You are trying to compare a coefficient with a variable, which makes no sense. I suspect you want both variables in the model and then do a test of whether their effects are equal (or else opposite of each other). Maybe you could clarify what your goal is.
    -------------------------------------------
    Richard Williams, Notre Dame Dept of Sociology
    StataNow Version: 19.5 MP (2 processor)

    EMAIL: [email protected]
    WWW: https://www3.nd.edu/~rwilliam

    Comment


    • #3
      Sasso simon:
      I do hope that what follows is consistent with what you're looking for (caveat emptor: -check- variable contains equally spaced values):
      Code:
      sysuse auto.dta
      g check=_n
      reg price mpg
      forvalues i = 1(1)74 {
      test mpg=`i'
      }
      PS: Crossed in the cyberspace with Richard's reply, who raised a relevant concern.
      Kind regards,
      Carlo
      (Stata 19.0)

      Comment


      • #4
        Dear Richard,

        Many thanks for your reply. In my setting the coefficient that comes out of the regression is not really what I’m interested in. What I am interested in is an elasticity that is calculated as the difference between that coefficient (coming from the regression) and a certain other variable (which in my case is a share).

        Therefore I would need to test if coefficient (i.e. _coef[X1] ) minus my shares (i.e. X2) is significantly different from zero for most of the observation in my sample.

        Any clue on how to do this (with test, lincom or with any other command)?

        Many thanks again

        (Many thanks also to Carlo, but I am afraid that that is not what I am looking for: I have values of a certain variable and I have just to make sure that the value of that variable are not equal to another variable which is in my dataset)

        Comment


        • #5
          Therefore I would need to test if coefficient (i.e. _coef[X1] ) minus my shares (i.e. X2) is significantly different from zero for most of the observation in my sample.
          This makes no sense if by "significantly different" you mean "statistically significantly" different. Each observation is a sample with n = 1, hence it has no way to estimate variation. So there is no such thing as a statistical significance test based on a sample of 1*; you cannot test "significance" for single observations.

          I have values of a certain variable and I have just to make sure that the value of that variable are not equal to another variable which is in my dataset
          Does this relate to your original question? Here you are talking about comparing two variables, nothing involving coefficients. If you want to make sure they are always different it's:

          Code:
          assert var1 != var2
          Added: *Well, if there is a pre-specified "known" variance, then there are things like z-tests based on that. But these tests are typically seen only in mathematical statistics textbooks for their theoretical interest and play no role that I have ever seen in statistical applications.
          Last edited by Clyde Schechter; 17 Mar 2017, 11:58.

          Comment


          • #6
            Dear Clyde,

            Many thanks for your reply. In the P.S. of my previous post, I didn’t express myself well. Apologies for that.

            I do not want to compare 2 variables. As I said before, I just need to test if the difference between a coefficient of a certain variable, i.e. _coef[X1], and another variable (which is NOT included in my regression) is different from zero.

            If I had to test if the difference between a coefficient of a certain variable _coef[X1], and another fixed value (e.g. 5) is different from zero, that would be done via
            lincom _coef[X1] - 5

            How can I do the same, but with the values of a certain variable?

            Many thanks again

            Comment


            • #7
              I still find no way to make sense of this. "The values of a certain variable" is a vector, or in any event, a set of numbers. A coefficient is a single value. It makes no sense to speak of them as being equal or not equal: they are different animals altogether and no relationship of equality is even defined between them.

              Do you mean you want to test if the average value of the variable is equal to that coefficient? Or some other single number calculated from the ensemble of values of the variable?

              Comment


              • #8
                Like Clyde, I still don't understand this. But suppose the coefficient is .17. Do you maybe want something like

                ttest x2 = .17

                That would test whether the mean of x2 = the value of the coefficient.

                If this isn't what you mean, maybe you can demonstrate how you would try to do this by hand.
                -------------------------------------------
                Richard Williams, Notre Dame Dept of Sociology
                StataNow Version: 19.5 MP (2 processor)

                EMAIL: [email protected]
                WWW: https://www3.nd.edu/~rwilliam

                Comment


                • #9
                  Dear Cylde and Richard,

                  Many thanks for your help.

                  The relationship I’m interested in is not the one between the outcome variable and regressors that are in my regression. I am interested in the elasticity of another variable with respect to two of the regressors that are in my regression (of course, there are specific reasons why I cannot simply run a regression with the outcome variable of interest).

                  After some calculations, I have found that the elasticity I am interested in is equal to the coefficient coming out from the regression minus, in my case, the share of certain type of employees present in each firm. What I would like to do now is to test whether that elasticity is statistically significant for my sample of firms.

                  Any idea on how I could do that?

                  Many thanks again

                  Comment


                  • #10
                    Dear Sasso,

                    I also have the same problem, did you manage to find out the answer?

                    Many thanks in advance

                    Comment

                    Working...
                    X