Announcement

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

  • what's wrong with the syntax below: estadd issue

    I want to imitate estadd's official example to calculate the one-sided p values, however, the one-sided p values for model 1 was wrong, for model 2 was correct. Where is wrong?

    Code:
    capture program drop estadd_bstdy
    program estadd_bstdy, eclass
        tempname bstdy
        matrix `bstdy' = e(b)
        quietly summarize `e(depvar)' if e(sample)
        matrix `bstdy' = `bstdy' / r(sd)
        ereturn matrix bstdy = `bstdy'
    end
    sysuse auto,clear
    eststo clear
    eststo: quietly regress price weight mpg
    eststo: quietly regress price weight mpg foreign
    estadd bstdy : *
    //estout, cells(b bstdy(par))
    
    
    capture program drop estadd_oneSidedP
    program estadd_oneSidedP, eclass
        tempname oneSidedP
        matrix `oneSidedP' = r(table)
        matrix `oneSidedP' = `oneSidedP'/2
        ereturn matrix oneSidedP = `oneSidedP'
    end
    estadd oneSidedP : *
    esttab ,cells("b(fmt(3)) p(fmt(3))" se(fmt(3) par))
    esttab , cells("b(fmt(3)) oneSidedP[4](fmt(3))" se(fmt(3) par))
    Last edited by Fred Lee; 15 Apr 2022, 09:20.
Working...
X