When performing logistic regression involving categorical variables with multiple levels, I encountered this case when all the levels are insignificant but the testparm function (which evaluates the overall significance) states that the variable is significant.

  1. How is it possible when all the levels of the variable are insignificant that the testparm function returns a significant result?

  2. If I am selecting variables to remove based on the p value, should I remove this particular variable from the model, ignoring the testparm results?

enter image description here

  • 2
    $\begingroup$ The question here is essentially statistical, hence I removed "Stata" from the title as incidental. At the same time, note in passing that testparm is a command in Stata, not a function. $\endgroup$ – Nick Cox Mar 18 '16 at 8:24
  • $\begingroup$ Thanks for the edit. I just wanted to attract the attention of Stata users who have experience in using the testparm command. $\endgroup$ – Rey Mar 18 '16 at 8:52
  • 3
    $\begingroup$ You're undermining my attempt to make this non-specific to Stata. If you believe that this is a Stata-specific question, you shouldn't be posting it here. See the Help Center for guidance on software-specific questions. $\endgroup$ – Nick Cox Mar 18 '16 at 9:01

Note that the way your run the testparm command, is the combined joint test that all coefficients on the indicators for are 0 (in all equations) [Stata 14 manual pag 2640], which hypothesis in your case cannot be rejected. However, this hypothesis is rejected for the category levels in your model. This should show when you run the test command for each individual category. For example using an example file from UCLA

    use http://www.ats.ucla.edu/stat/stata/webbooks/reg/elemapi2
    regress api00 yr_rnd i.collcat i.dnum
    testparm i.dnum // test hypothesis that all category levels are 0
    test 135.dnum   // test one category level
    dis 1.21^2      // display F using t from regress result

    logistic yr_rnd api00 i.collcat i.dnum
    testparm i.dnum
    test 135.dnum   // test one category level
    dis -0.42^2     // display chi2 using z from logistic result
  • $\begingroup$ Thanks for the reply. Are you suggesting that I do tests for each category level? Initially, I wanted to remove the categorical variable as all levels were insignificant. However, I am surprised to see that when I did the testparm, the overall p was significant, resulting in a dilemma on whether I should remove it from a multivariate model. $\endgroup$ – Rey Mar 20 '16 at 15:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.