Announcement

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

  • plotting means + cis using imputed data and coefplot

    Hi everyone,

    I hope you'll be able to help me with this question. I have multiple years of cross-sectional data for examining how a categorical independent variable x relates to a binary outcome y. I had some missing data, so I imputed the missing observations following appropriate procedures. I'd like to plot means and confidence intervals for the outcome variable over the different categories of the independent variable and over time while accounting for the imputed dataset. In other words, my code looks something like this:

    HTML Code:
    mi svyset id [pweight = svy_weight] 
    
    mi estimate, post: mean i.y if x==0, over(svy_year)
    estimates store x0
    
    mi estimate, post: mean i.y if x==1, over(svy_year)
    estimates store x1
    
    mi estimate, post: mean i.y if x==2, over(svy_year)
    estimates store x2
    
    coefplot  x1 x2 x3, vert
    Unfortunately, the resulting coefplot includes the mean values for when y==0 and when y==1. I'd like to plot only the means + cis for when y==1. Is there a way to do that? I've tried other commands (ciplot and cibar) but I can't seem to make them work while accounting for the multiply imputed data and survey weights.

    Any guidance would be most appreciated!

  • #2
    I can't make sense of what you are asking for. If you want "the means + cis for when y == 1" you don't need any calculations of any kind. The mean of y will be 1.

    What am I missing here?

    Comment


    • #3
      Originally posted by Clyde Schechter View Post
      I can't make sense of what you are asking for. If you want "the means + cis for when y == 1" you don't need any calculations of any kind. The mean of y will be 1.

      What am I missing here?
      Sorry about that. Perhaps the attached plot helps to clarify the situation. Basically, the code listed in #1 produces means and confidence intervals that represent the weighted proportion of people in each category of X who experience either outcome 0.y or 1.y in a given year. But the resulting graph plots both proportions. I'd like to only keep one of the estimated proportions (e.g., for the weighted proportion of people in each category of X who experience outcome 1.y in a given year)

      Graph.gph
      Attached Files

      Comment


      • #4
        I think if you take the i. out of the -mean- commands you will get what you want.

        Comment

        Working...
        X