Announcement

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

  • Model to use for a zero-inflated predictor variables

    Hello, I was interested in modeling a dichotomous outcome variable, phq_2, and a count variable as my explanatory variable, number of housing problems, exterior_housing. I have included frequency distributions of both these variables below. My concern is that the explanatory variable, exterior_housing variable, has a long tail and a mass of zeros. Is there any model anyone would recommend for this problem? Would a simple logit model be appropriate? The outcome variable, phq_2 is also skewed as most of the responses are 0s. Would a Firth-logit model be advisable?


    Code:
    
    tab1 phq_2_count exterior_housing
    
    -> tabulation of phq_2_count  
    
    phq_2_count |      Freq.     Percent        Cum.
    ------------+-----------------------------------
              0 |        576       57.72       57.72
              1 |        156       15.63       73.35
              2 |        142       14.23       87.58
              3 |         43        4.31       91.88
              4 |         46        4.61       96.49
              5 |         13        1.30       97.80
              6 |         22        2.20      100.00
    ------------+-----------------------------------
          Total |        998      100.00
    
    -> tabulation of exterior_housing  
    
          Total |
       exterior |
        Housing |
       problems |      Freq.     Percent        Cum.
    ------------+-----------------------------------
              0 |        785       78.27       78.27
              1 |        107       10.67       88.93
              2 |         55        5.48       94.42
              3 |         20        1.99       96.41
              4 |         15        1.50       97.91
              5 |         11        1.10       99.00
              6 |         10        1.00      100.00
    ------------+-----------------------------------
          Total |      1,003      100.00
    
    
    tab phq_2 exterior_housing
    
               |                       Total exterior Housing problems
         phq_2 |         0          1          2          3          4          5          6 |     Total
    -----------+-----------------------------------------------------------------------------+----------
    0.Negative |       702         88         42         16         11          8          5 |       872 
    1.Positive |        79         18         13          4          3          3          4 |       124 
    -----------+-----------------------------------------------------------------------------+----------
         Total |       781        106         55         20         14         11          9 |       996

  • #2
    Luis:
    what I fail to get from your post is the reason for zeros in -phq_2-.
    Is your sample limited to real estate owners?
    Or are non-real estate owners also included?
    Kind regards,
    Carlo
    (Stata 19.0)

    Comment


    • #3
      Carlo is on the right track, the first step is to understand what the reason is for all those 0s. However, I don't think ownership status is the reason for those 0s. People who rent a house can rent houses with exterior problems. It may be the renters are less aware of these problems as they are not their (immediate) problem. However, I don't think that difference between renters and owners is big enough to explains the mass of 0s. A more plausible explanation would be that the survey was designed such that renters weren't asked that question. So my advise would be to go back to the questionnaire and figure out who was asked that question.

      As to modeling, if the reason for those 0s don't give you any other solution, you can just add phq_2 and an indicator (dummy) variable for when phq_2 == 0. That is, you allow for a non-linear effect, in particular, you suspect that the 0s are somehow "different". See Stata tip 135: Leaps and bounds https://doi.org/10.1177/1536867X20909707
      ---------------------------------
      Maarten L. Buis
      University of Konstanz
      Department of history and sociology
      box 40
      78457 Konstanz
      Germany
      http://www.maartenbuis.nl
      ---------------------------------

      Comment


      • #4
        I agree with Carlo Lazzaro and Maarten Buis.

        Good advice depends on knowing more about the outcome (what is it?) and about the set-up in terms of definitions. I won't try to add to the social science here but encourage more thinking along those lines.

        Statistically, I hesitate to throw around some of the terms in play.

        zero-inflated means, IIUC, more zeros than you expect given an otherwise plausible model; it doesn't just mean that the mode is 0 which is otherwise quite common for counted variables. What is the otherwise plausible model?

        long-tailed means to me so long-tailed that you may need to think about changing from some standard model. The distribution of #problems is not one I would call long-tailed myself.

        skewed outcome means here just that the mean over 0s and 1s is some way from 0.5. That's very common for dichotomous (binary (*)) outcomes.

        Luis's table allows a stab at a preliminary modelling.

        Code:
        * Example generated by -dataex-. For more info, type help dataex
        clear
        input byte problems int(frequency0 frequency1)
        0 702 79
        1  88 18
        2  42 13
        3  16  4
        4  11  3
        5   8  3
        6   5  4
        end
        
        * use your own preference if Stata version < 18
        set scheme stcolor
        
        gen outcome_mean = frequency1 / (frequency0 + frequency1)
        
        gen outcome_mean_logit = logit(outcome_mean)
        
        mylabels 0.1(0.1)0.5, myscale(logit(@)) local(yla) format(%02.1f)
        
        gen frequency = frequency0 + frequency1
        
        gen where = 0
        
        scatter outcome_mean_logit problems, yla(`yla') ytitle(mean outcome (logit scale)) xtitle(number of problems) xla(0/6) msize(large) || scatter where problems, ms(none) mlabel(frequency) mlabpos(0) mlabsize(large) xsc(r(-0.2 .)) legend(off)
        Click image for larger version

Name:	housing.png
Views:	1
Size:	44.5 KB
ID:	1784153



        There is some irregularity there, but I am not sensing that the cases with 0 problems call for special action.

        The code above uses mylabels from the Stata Journal, but that call can be omitted.

        Code:
        . search mylabels, sj
        
        Search of official help files, FAQs, Examples, and Stata Journals
        
        SJ-24-1 gr0092_1  . . . . . . . . . . . . . . . . Software update for mylabels
                (help nicelabels, mylabels, myticks if installed) . . . . .  N. J. Cox
                Q1/24   SJ 24(1):182--184
                fixes a bug that could bite if the options myscale() and
                clean were specified together
        
        SJ-22-4 gr0092  . . . . . . . . . . . . Speaking Stata: Automating axis labels
                (help nicelabels, mylabels, myticks if installed) . . . . .  N. J. Cox
                Q4/22   SJ 22(4):975--995
                provides commands to handle two common problems with graph
                axis labels: decide in advance on some "nice" numbers to
                use on one or both axes and show particular labels on some
                transformed scale
        I am confident that a probit scale would not give a different signal.

        (*) If you care about terminology, see Section 2 of https://journals.sagepub.com/doi/pdf...36867X19830921

        Comment


        • #5
          Further to my previous, a very general point. The marginal distribution of any predictor is in itself immaterial, as typically models are phrased in terms of the distribution of the outcome conditional on or given predictors. It may give rise to ideas that a different functional form is needed, say a different link function or a transformation of a predictor. I don't sense that the marginal distribution implies anything more exotic than a plain logit or probit model, given the information so far.
          Last edited by Nick Cox; 08 Jan 2026, 05:07.

          Comment


          • #6
            Originally posted by Carlo Lazzaro View Post
            Luis:
            what I fail to get from your post is the reason for zeros in -phq_2-.
            Is your sample limited to real estate owners?
            Or are non-real estate owners also included?
            My apologies, the phq_2 variable measures mental health, is a two-question depression screening tool asking about depressed mood and loss of interest/pleasure (anhedonia) in the last two weeks, scoring 0-6. The exterior_housing variable was created by summing a battery of questions asking participants if their current place of living had any of the following problems: the exact question is copied below. If the participant answered 'Yes' (1) and 'No' (0), then the range of the exterior_housing variable is from 0 to 6. The question in the survey was asked to all participants, regardless of if they rent or own. I wanted to use the mental health variable, phq_2, as the outcome and the exterior_housing problems as the predictor, and it seems that, based on Nick Cox 's response, it seems that a logit model is reasonable to use for this particular problem. I thought the large numbers of 0s in the exterior_housing variable would require a more complicated model, but after reading his response, it doesn't appear that is needed.

            Base: All respondents

            Q92. Are any of the following in poor condition in the place you are living?

            Randomize List – Banked grid
            a. Exterior walls
            b. Floors
            c. Roof
            d. Exterior doors
            e. Windows
            f. Something else

            Yes
            No
            Last edited by Luis Mijares Castaneda; 08 Jan 2026, 09:29.

            Comment


            • #7
              It seems that you have enoight data to try six indicator predictors for each problem. Those six conditions aren't guaranteed to be equally important.

              Comment

              Working...
              X