Announcement

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

  • #31
    A weighted mean is always obtainable one step at a time. Calculate the numerator; the denominator; and then divide.


    Code:
    bysort newdate: egen R3_q5 = total(cond(q_R3 == 5, w * ex_ret, .) ) 
    
    bysort newdate: egen denom = total(cond(q_R3 == 5, w, .) ) 
    
    replace R3_q5 = R3_q5 / denom

    Comment


    • #32
      Thank you Nick Cox for your reference. I have replied to the query posted by Kate Lussy in post # 5 of this thread.
      Regards
      --------------------------------------------------
      Attaullah Shah, PhD.
      Professor of Finance, Institute of Management Sciences Peshawar, Pakistan
      FinTechProfessor.com
      https://asdocx.com
      Check out my asdoc program, which sends outputs to MS Word.
      For more flexibility, consider using asdocx which can send Stata outputs to MS Word, Excel, LaTeX, or HTML.

      Comment

      Working...
      X