Announcement

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

  • Continuous variable vs categorical variable in a Binary Logistic Regression

    Hello everyone
    In my model I have a independent continuous quantitative variable (Age). How can I check for linearity with the dichotomous dependent variable var (1 or 0).
    I tried to create a predictor variable [predict probvar], but I could not execute the graph [graph probvar Age, connect(s)]. The Stata error was "class member function not found".
    Tks.

  • #2
    Well, you don't show the regression you performed before attempting to run -predict-, but I'm going to guess that it was -logit- or -probit-. In either case, the default prediction is the modeled probability of dependent var = 1. The logistic and probit models are non-linear, so unless your range of values of age is rather narrow, you should not expect the relationship between probvar and age to be linear: it should look like a sigmoid curve (or a piece of a sigmoid curve if the range of values of age is restricted.)

    As for being unable to run -graph probvar Age-, that is because -graph- always requires additional modification to express the type of graph desired. So perhaps what you want is a line graph -graph twoway line probvar Age, sort-, or a scatter plot -graph twoway scatter probvar Age-?

    Comment


    • #3
      Hi, It's a logit model.
      His suggestion of commands generated the graphics. Thank you very much.

      Comment


      • #4
        One more help in the same model (binary logistic regression).
        May I trust the Hosmer-Lemeshow Test for Logistic Regression? How can I confirm if the model is correctly specified? What is the best interpretation for the Hosmer-Lemeshow Test result?
        Tks.

        Comment


        • #5
          Well, with regards to the discussion over the "trustfulness" of the Hosmer-Lemeshow test, I gather you may wish to take a look at this text:http://statisticalhorizons.com/hosmer-lemeshow

          That said, personally, I have performed this test so far.

          Texts on its interpretation are sort of ubiquitous, so to speak, in the literature overall.
          Last edited by Marcos Almeida; 12 Feb 2017, 17:17.
          Best regards,

          Marcos

          Comment


          • #6
            "Why I Don’t Trust the Hosmer-Lemeshow Test for Logistic Regression".

            The p-value is just below .05. Have I need to try some interactions or non-linearities in the model?
            Likelihood-ratio test LR chi2(1) = 2.79
            (Assumption: . nested in LRTEST_0) Prob > chi2 = 0.0949
            The Hosmer-Lemeshow Test
            number of observations = 1418
            number of groups = 10
            Hosmer-Lemeshow chi2(8) = 24.45
            Prob > chi2 = 0.0019

            Comment


            • #7
              The output is not under CODE delimiters as recommended in the FAQ.

              In spite of not being easily readable, it seems to present the results of two entwined commands, the LR test and the HL test.

              Being this so, there is no reason to expect similarity of p-values between both tests, given their respective theoretical backgrounds.
              Best regards,

              Marcos

              Comment


              • #8
                I have not been following this but have just noticed one aspect: note that the H-L test has long been known to have "too much power" on occasion and this is, at least partly, linked to how many groups are used; in my opinion, with an N of over 1,400, 10 groups is too few; see Paul, P, Pennell, ML and Lemeshow, SL (2013), "Standardizing the power of the Hosmer-Lemeshow goodness of fit test in large data sets," Statistics in Medicine, 32: 67-80; note that p. 75 has some guidance on choosing the number of groups (for situations where N is no more than 25,000)

                Comment


                • #9
                  Thank you Clyde, Marcos and Rich.

                  Comment

                  Working...
                  X