Bookmark and Share

Notice: On April 23, 2014, Statalist moved from an email list to a forum, based at statalist.org.


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

st: From: Rodrigo Briceño <[email protected]>


From   [email protected]
To   [email protected]
Subject   st: From: Rodrigo Briceño <[email protected]>
Date   Tue, 25 Sep 2012 10:03:51 -0600

Hello Statalisters. I have a do file that use a macro in order to run
several regression models, using different lags each time. What I'm
following pasting is the syntax corresponding to ISIN=8. I have eleven
different ISIN (let's call them IDs). How can I introduce the issue of
different values there. I think this a matter of nesting, but I never
have used that. Even the text file with the results is associated to
the number (ISIN) selected. My full list includes 8, 225, 29, 220, 18,
251, 222 ,221, 244, 24, 276

Thanks for your contribution

-------------------------------------------------------------------------

forvalues i=1(1)24 {
        gen l`i'liq=l`i'.liq
}

local X = "sfid liqmk dv pprom"

forvalues i=1(1)24 {
regress liq `X' l`i'liq if isin==8
predict ehat if e(sample), res
ivhettest, ivsq
local hettest = r(nr2)
local hetprob = r(nr2p)
estadd scalar hettest = `hettest'
estadd scalar hetp = `hetprob'
estat bgodfrey, lags(1)
matrix bgchi2s = r(chi2)
matrix bgchi2p = r(p)
estadd scalar bgchi2s = bgchi2s[1,1]
estadd scalar bgchi2p = bgchi2p[1,1]
*jarque bera
tabstat ehat, stats(skewness kurtosis) column(variable) save, if isin==8
matrix stats=r(StatTotal)
local SK=stats[1,1]
local KU=stats[2,1]
gen jb = (e(N)/6)*((`SK')^2+(`KU'-3)^2/4) if isin==8
egen jb1=max(jb)
estadd scalar jb=jb1
estadd scalar jbp=chiprob(2,jb1)
drop ehat jb jb1
*end of jarque bera
estimates store m`i', title(m`i')
}

estout * using modisin8.txt, cells(b(star fmt(%9.3f)) p(fmt(%9.3f)))
starlevels(* .10 ** .05 *** .01) stats(r2 N hettest hetp bgchi2s
bgchi2p jb jbp, fmt(%9.3f %9.0g %9.3f %9.3f %9.3f %9.3f %9.3f %9.3f)
labels(R-squared)) legend label collabels(none) varlabels(_cons
Constant)
drop _est*
drop l*liq
save, replace
*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/


© Copyright 1996–2018 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   Site index