Announcement

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

  • Can you compute margins after STREG if using sampling weights in STSET?

    Hello friends:
    I am trying to run margins on a STREG command and I am getting the following message:

    Code:
    margins bplan, pwcompare
    variable wt_vn_dw already defined
    r(110);

    Here is my following code:
    stset duration [pweight = wt_vn_dw], failure(outcome_v2==1) scale(1)
    stcrreg TM1_Male educ TM1_AGE ownership IND_EXP SU_EXP TOT_EMP TOT_HOURS_v2 TM_SIZEH GR_PREF BUS_HITECH CPT_W1LAG i.Industry ask ib(1999).project ib(0).bplan_form bplanlag ib(0).bplan#c.bplanlag , compete(outcome==3)

    Is this because margins can calculate sample weighted competing risk regression data? It some how is linked to the variable that uses sampling weights wt_vn_dw for the analysis, but in my research in the issue I am not certain how to proceed to resolve the issue. Any insight our guidance to resources would be most useful. Thank you for your time.
    Last edited by Diana Hechavarria; 06 Sep 2018, 21:44. Reason: STSET, STREG, MARGINS, r(110), error code r(110), variable already defined

  • #2
    I solved my own problem with some more reading, not sure why but when I specified this code margins worked:

    Code:
    margins bplan [pweight=wt_vn_dw]

    ​​​​​​​Just in case someone has a similar issue. Specify the sampling weight again.

    Comment

    Working...
    X