Announcement

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

  • test coefficients across equations (logit regression)

    Hi, by referring to the following website, https://stats.idre.ucla.edu/stata/co...s-using-suest/
    I try to test coefficients across equations for logit models, but it did not work.
    This is my code
    Code:
    logit educ2 i.gender2cat i.hukounew c.feducon c.fisei if cohort==1
    est store c1
    logit educ2 i.gender2cat i.hukounew c.feducon c.fisei if cohort==2
    est store c2
    logit educ2 i.gender2cat i.hukounew c.feducon c.fisei if cohort==3
    est store c3
    logit educ2 i.gender2cat i.hukounew c.feducon c.fisei if cohort==4
    est store c4
    suest c1 c2 c3 c4
    test [c1_educ2]gender2cat = [c2_educ2]gender2cat
    STATA returns the following problem, which says the variable "gender2cat" is not found. But I do have this variable in my data.
    Code:
    test [c1_educ2]gender2cat = [c2_mean]gender2cat
    [gender2cat] not found
    r(111);
    Here is my data from dataex, I would appreciate if you can help me. Thanks!

    Dataset pruned by user request
    Last edited by sladmin; 28 Mar 2018, 11:07. Reason: Prune dataset due to confidentiality.

  • #2
    This is because you are using the wrong notation for the coefficients. There will not be a coefficient named gender2cat in the -suest- output. (Take a look and you will see that this is true.) Instead you will find something called 1.gender2cat or 2.gender2cat or something like that. You can't omit the 1. or 2. (or whatever #. it is).

    When using -suest- it can be difficult to know in advance just what the coefficients will be called. So I generally like to add the -coefl- option when I run -suest-. That way it shows me the actual names of the coefficients, and that enables me to properly refer to them in subsequent -test- or -lincom- commands or other such calculations.

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      This is because you are using the wrong notation for the coefficients. There will not be a coefficient named gender2cat in the -suest- output. (Take a look and you will see that this is true.) Instead you will find something called 1.gender2cat or 2.gender2cat or something like that. You can't omit the 1. or 2. (or whatever #. it is).

      When using -suest- it can be difficult to know in advance just what the coefficients will be called. So I generally like to add the -coefl- option when I run -suest-. That way it shows me the actual names of the coefficients, and that enables me to properly refer to them in subsequent -test- or -lincom- commands or other such calculations.
      I see. Thank you very much!

      Comment


      • #4
        I have a similar question. I am running a logistic regression and want to know how two different groups compare on each independent variable in the model. It seems unwise to run a model where I interact the grouping variable with each independent variable in the model. It seems best to run a logistic regression for each group, then test the equality of the coefficients against one another. But how would you go about testing *all* of the coefficients in models? My syntax looks as follows:

        logit y x1 x2 x3 if group==1
        est store group1
        logit y x1 x2 x3 if group==2
        est store group2
        suest group1 group2
        test ????

        Would I have to run separate -test- for each variable? I would worry about getting a significant result by chance if I am doing this across many models.

        Comment


        • #5
          Code:
          test [group1_y = group2_y]: x1 x2 x3
          Note: The specific way that -suest- names equations for different kinds of regression sometimes changes from one model to the next and one version to the next. What I have shown above is how it works for -logit- models in the current version (18.5). YMMV.

          If you are using an earlier version and this syntax does not work for you, run -suest, coefl- after the original -suest- command. Stata will respond with -suest- output that shows how it names all the coefficients. From that you can figure out how to construct the -test- command because, I believe across every version, the syntax for that is -test [model1 = model2] varlist-. So you just have to figure out how -suest- names the models.

          Comment

          Working...
          X