Announcement

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

  • #16
    Thank you so much! I thought of this yesterday but considered that [1,1] should be right. Thanks for the alternative coding of this. The -bootstrap- worked smoothly and I now have the coeffects.

    An only thing that does not work is the following (but as long as the bootstrap estimations are displayed this is less important, I guess):
    . scalar list b_total b_direct b_indirect
    scalar b_indirect not found
    r(111);

    Why would _bs_1: r(b_indirect) will be displayed but not scalar b_indirect? Thanks once again for the enormous help!

    Comment


    • #17
      Why would _bs_1: r(b_indirect) will be displayed but not scalar b_indirect? Thanks once again for the enormous help!
      Because the code never defines a scalar named b_indirect.

      Review the code and you will see that there are explicit commands defining scalars b_total and b_direct:
      Code:
      scalar b_total = bb_total[1,1]
      return scalar b_total = bb_total[1,1]
      
      *matrix list r(table)
      
      *display b_total
      *scalar list
      
      *Estimate NDE
      glm early_menopause i.smokingm [pw=wt_iow], fam(binomial) link(log) vce(robust)  nolog base
      
      matrix bb_direct=e(b)
      *matrix list e(b)
      
      scalar b_direct = bb_direct[1,1]
      There is no similar command defining scalar b_indirect. What you do have for b_indirect is:
      Code:
      return scalar b_indirect = b_total-b_direct
      But this command does not define a scalar. Rather it causes a number to be placed in r(b_indirect). But it does not create any scalar. The mention of the word -scalar- in that command simply tells Stata that what is to be placed in r() is a number, not a matrix, nor a macro.

      Comment


      • #18
        Yes, that's right. Thanks again, this was very helpful.

        Comment

        Working...
        X