Announcement

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

  • weighted standard deviation

    Good afternoon,

    I am trying to compute weighted average and weighted standard deviation:

    Code:
    . collapse (mean) portret  (sd) weighted_sd =portret [iweight= weight16 ], by(year month day)
    
    . count
      5,649
    
    . count if portret==.
      0
    
    . count if weighted_sd ==.
      3,590
    The weighted average seems fine, but the weighted standard deviation is missing in most cases (even though the weights exist, and there is a minimum of 2 observations per year-month-day). Could someone please help identify the problem?

    Thank you,
    Stan

  • #2
    Hi, Stan.

    Without an example of your data, it will be hard to check the issue.

    Comment


    • #3
      I think the problem was that I used iweight instead of aweight. I'm getting sensible results with the latter.

      Comment

      Working...
      X