Announcement

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

  • Extracting beta coefficient, std error and P-value from changing dependent variables.

    Hi all,

    I'm running a regressiong to test the independent variable "DOL" against a changing dependent variable y1,y3,....,y60.

    I would like to extract and save beta coefficient, std error and the P-value from my regressions and so far have the code:

    clear

    import excel "D:\Test Loop.xlsx", sheet("Raw Data") firstrow

    tempname myresults

    postfile `myresults' y constant b1 se using myresults.dta
    foreach y of varlist y1-y60 {
    quietly xi: reg `y' DOL
    post `myresults' (`y') (`=_b[_cons]') (`=_b[DOL]') (`=_se[DOL]')
    }
    postclose `myresults'
    I managed to extract the constants, betas and standard errors, but have no idea how to extract the t-value, P-value and CI.

    Thank you.
    Last edited by Bernard Lam; 19 Nov 2020, 08:56.

  • #2
    After your -reg- command, everything you are asking for is saved in matrix r(table). So grab that matrix and extract them from there.

    As an aside, with no relevance to your question, -xi- is essentially obsolete. When you think of using it, use factor variable notation instead (-help fvvarlist- for details). There are a few exotic situations where factor variable notation is still not supported and you have to fall back on -xi-, but those things are uncommon, and for most of them there are more modern commands that do the same thing and do support factor variable notation. Also, for what you are doing, it looks like neither factor variable nor -xi- would do anything anyway.

    Comment

    Working...
    X