Announcement

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

  • 'svy: logistic' command error

    Hi All,
    I am trying to run a logistic regression with my survey data, where the outcome is a binary variable called ‘pcr_pf’ and I want to look at the association with different variables such as sex, age group, urban/rural, etc. The problem is that for almost all variables I try to run, stata either freezes or works for a long time and then says there is an error because of convergence problem, or an error when executing the command. This is occurring even just with univariate analyses for the majority of my independent variables.
    My survey data is a two-stage cluster randomised design – with the sample population split into four strata (domain) and with clusters (cno) being villages. Per strata we had random selection of townships, random selections of villages per township, and random selection of households per village. My svyset command is:
    rename weight wts_hh
    order probhh wts_hh, after (domain)
    svyset [pweight=wts_hh] , strata(domain) psu(cno)
    There is one domain that doesn’t contain any cases of the dependent variable of interest. Could it be this causing the problem? However, even if I just run a command such as
    svy: logistic pcr_pf sex
    I still get no output, stata freezes and then says there was an error executing the command, even though I have cases of the dependent variable in both male and female strata.
    Can anyone help?
    Thanks.

  • #2
    There is one domain that doesn’t contain any cases of the dependent variable of interest. Could it be this causing the problem?
    You can troubleshoot that one yourself. -drop- all observations from that domain and try it again. If that solves the problem, that would be the answer. (But I doubt it will work out that way.)

    It's not obvious to me what is wrong. Can you post a small example of your data that reproduces this problem?
    Last edited by Clyde Schechter; 07 Sep 2016, 21:31.

    Comment


    • #3
      Hello Hannah,

      Welcome to the Stata Forum.

      Generally speaking, I sugggest you retry with a slightly different command for svyset: it should include the psu variable (without brackets) before the probability weights.

      Specifically for two-stage designs, you may wish to take a look at this:http://www.stata.com/help.cgi?svyset

      Best,

      Marcos
      Last edited by Marcos Almeida; 08 Sep 2016, 09:17.
      Best regards,

      Marcos

      Comment


      • #4
        HI Both,
        Thanks for your responses.
        So I tried changing the svyset command around to:

        svyset: cno [pweight=wts_hh] , strata(domain)

        However, the logistic regression still wouldn't run.
        Then I tried dropping all domain 3 observations and it still won't run again!

        Any other thoughts?

        Comment


        • #5
          Hello, Hanna,

          Please try "exactly" the command demanded to perform the svyset.

          You may take a look at the text I shared in #3.

          For example, you are not supposed to type - svyset: cno - , but svyset cno -, i.e., without two dots.

          Hopefully it works now!

          If not, please provide the commands and the output, exactly and under CODE delimiters, as recommended in the FAQ.

          Marcos
          Best regards,

          Marcos

          Comment

          Working...
          X