Announcement

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

  • Svy function - using svylogitgof

    Hi there, I am running a logistic regression, using svy: logit etc and then trying to do a post test using svylogitgof, however unfortunately as I have missing values in some of my variables, I am getting an error message after I type svylogitgof which says matrix has missing values r(504); - I would appreciate any assistance in how I might do a post-test using the svy function with missing values?
    Thanks

  • #2
    Jacquie:
    one step behind: are your missing values ignorable or not?
    Providing more details about your missing data will increase the likelihood of helpful replies.
    Kind regards,
    Carlo
    Kind regards,
    Carlo
    (StataNow 18.5)

    Comment


    • #3
      Hi there Carlo
      I am comfortable ignoring the missing values (its a pen and paper questionnaire and the missing seem to be fairly randomly distributed)
      Thanks
      Jacquie

      Comment


      • #4
        Personally, I can't reproduce the error. Perhaps you could show your commands and output or provide a replicable example. Show the estimation commands and output too; the problem may be there rather than with svylogitgof.
        -------------------------------------------
        Richard Williams, Notre Dame Dept of Sociology
        Stata Version: 17.0 MP (2 processor)

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

        Comment


        • #5


          The only matrix that appears in svylogit.ado is e(V), the variance-covariance matrix of the decile mean residuals, and it appears in only one statement:

          Code:
          matrix chivalm = e(b) * inv(e(V)) * e(b)'
          I found this out by typing:
          Code:
          viewsource svylogitgof.ado
          in the command line.

          The error follows the attempt to execute that statement. You might have discovered this for yourself if you had
          Code:
          set trace on
          svylogitgof
          set trace off
          The error can arise if all of the values of a residual in a "decile" group are constant; this leads to missing standard errors and to e(V) being less than full rank. In the example that follows I've induced this problem by deliberately increasing the number of groups to 20 instead of the default 10 in svylogitgof. That led to three groups with missing standard errors and to e(V) having rank 16.

          When e(V) is less than full rank, svylogit cannot compute the F statistic. The solution, if there is a solution, is to make your model more complex, so as to reduce the likelihood of tied groups.


          Code:
          sysuse auto, clear
          svyset _n [pw = turn]
          svy: logistic foreign length
          predict double phat
          gen double resid = foreign - phat
          codebook resid
          xtile byte decile = resid [pw = turn], nquantiles(20)
          
          svy, over(decile): mean resid
          
          /* Check rank of e(V) */
          mata: rank(st_matrix("e(V)"))
          
          matrix chivalm = e(b) * inv(e(V)) * e(b)'
          Last edited by Steve Samuels; 24 Oct 2014, 19:32.
          Steve Samuels
          Statistical Consulting
          [email protected]

          Stata 14.2

          Comment


          • #6
            In Stata 13, you can use estat gof after svy: logit. estat gof is somewhat tolerant of problems like the one you encountered. There is no longer a good reason for using svylogitgof.
            Steve Samuels
            Statistical Consulting
            [email protected]

            Stata 14.2

            Comment


            • #7
              Thank you very much Steve, estat gof worked perfectly - much appreciated!

              Comment


              • #8
                Hi there, I am running a logistic regression on survey data, using svy: logit etc; I have STATA 12; I am trying to do a post test: could you please tell me how to get svylogitgof ? I typed "findit svylogitgof" in search bar above but do not get the first entry to click on "st0099_1"? Could you please help me locating it? Also I read Steve Samuel 's entry above saying that estat gof is ok to use with svy:logit in stata 13; what about using it in stata 12?
                Thank you for your help.
                Michele

                Comment


                • #9
                  Welcome to Statalist, Michele! Type findit in the Command area (bottom of window), not in the search bar.
                  Last edited by Steve Samuels; 14 Apr 2015, 23:01.
                  Steve Samuels
                  Statistical Consulting
                  [email protected]

                  Stata 14.2

                  Comment


                  • #10
                    Just to add: I don't have Stata 12 to test estat gof after svy: logit or svy: logistic. Just try it yourself.
                    Steve Samuels
                    Statistical Consulting
                    [email protected]

                    Stata 14.2

                    Comment


                    • #11
                      I do have Stata 12 and it is there. But yes, the simplest thing is just to try it or type things like -help estat gof-.
                      -------------------------------------------
                      Richard Williams, Notre Dame Dept of Sociology
                      Stata Version: 17.0 MP (2 processor)

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

                      Comment

                      Working...
                      X