Announcement

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

  • Non-linear hypotheses testing with a GSEM

    Hello, I'm having trouble with the testnl command after a GSEM model. Specifically, my problem is that I can't refer to the covariance coefficient of my GSEM estimation within the testnl command.

    Here is a minimal working example of my problem:

    Code:
    sysuse auto
    gsem (price <- mpg rep78) (trunk <- length turn), cov(e.price*e.trunk)
    gsem, coeflegend
    testnl _b[trunk:length]=0
    testnl _b[/var(e.price)]=0
    testnl  _b[/cov(e.price,e.trunk)]=0
    In the previous example, everything works fine until I test the hypothesis that the covariance between the error terms is 0, where I get an "option e.trunk not allowed" error.

    I guess that the comma inside the covariance is interpreted as an option, but I don't know how else I can refer to this covariance. I inspected the e(b) matrix, but the coefficient have the same name.

    Any help would be appreciated. Thanks in advance for your responses.

  • #2
    This might be a bug, because this is a linear hypothesis, and if you test it as a linear hypothesis, everything works fine.

    Code:
    . testnl  _b[/cov(e.price,e.trunk)]=0
    option e.trunk not allowed
    r(198);
    
    . test  _b[/cov(e.price,e.trunk)]=0
    
     ( 1)  [/]cov(e.price,e.trunk) = 0
    
               chi2(  1) =    0.12
             Prob > chi2 =    0.7330

    Comment


    • #3
      I think you should write to StataCorp and ask them what is going on and why -testnl- is not able to parse this legitimate syntax.

      But meanwhile, I have an idea how you might be able to work around this problem.

      Apparently -nlcom- does not suffer from the same defect, here:

      Code:
      . nlcom  _b[/cov(e.price,e.trunk)]
      
             _nl_1:  _b[/cov(e.price,e.trunk)]
      
      ------------------------------------------------------------------------------
                   |      Coef.   Std. Err.      z    P>|z|     [95% Conf. Interval]
      -------------+----------------------------------------------------------------
             _nl_1 |  -303.0687   888.4854    -0.34   0.733    -2044.468    1438.331
      ------------------------------------------------------------------------------
      Then this suggests the following work around the problem:

      Reformulate your nonlinear hypothesis in such a way, that your hypothesis becomes a non-linear combination on one side, and zero on the other side of the equality. E.g.,

      if you want to test

      form 1) Ho: a/b = 5, reformulate this null as the equivalent null
      form 2) Ho: a/b - 5 = 0.

      Then use -nlcom- to estimate the quantity a/b - 5, and it will also give you a test of whether the quantity is equal to 0.

      In other words test your form 1) but moving to form 2) and using -nlcom-.

      Comment


      • #4
        Originally posted by Joro Kolev View Post
        I think you should write to StataCorp and ask them what is going on and why -testnl- is not able to parse this legitimate syntax.

        But meanwhile, I have an idea how you might be able to work around this problem.

        Apparently -nlcom- does not suffer from the same defect, here:

        Code:
        . nlcom _b[/cov(e.price,e.trunk)]
        
        _nl_1: _b[/cov(e.price,e.trunk)]
        
        ------------------------------------------------------------------------------
        | Coef. Std. Err. z P>|z| [95% Conf. Interval]
        -------------+----------------------------------------------------------------
        _nl_1 | -303.0687 888.4854 -0.34 0.733 -2044.468 1438.331
        ------------------------------------------------------------------------------
        Then this suggests the following work around the problem:

        Reformulate your nonlinear hypothesis in such a way, that your hypothesis becomes a non-linear combination on one side, and zero on the other side of the equality. E.g.,

        if you want to test

        form 1) Ho: a/b = 5, reformulate this null as the equivalent null
        form 2) Ho: a/b - 5 = 0.

        Then use -nlcom- to estimate the quantity a/b - 5, and it will also give you a test of whether the quantity is equal to 0.

        In other words test your form 1) but moving to form 2) and using -nlcom-.
        Thanks Joro, I also believe that this is a bug. My hypothesis contains another terms and I can't use the -test- command, but your -nlcom- solution worked.

        I'm not sure about how to report this to StataCorp though, but I will try to report this in the following days.

        Greetings.



        Comment


        • #5
          There is no way how the -nlcom- solution can possibly not work. Any nonlinear hypothesis on a parameter vector B of the form Ho: g(B) = h(B) can be reformulated as the equivalent Ho: f(B)=0, where f(B)= g(B) - h(B). In other words there is no loss of generality in formulating any nonlinear hypothesis as Ho: f(B)=0.

          Christmas/New year greetings to you too !

          Comment

          Working...
          X