Bookmark and Share

Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.


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

st: From: Rodrigo Briceño <rjbriceno@gmail.com>


From   owner-statalist@hsphsun2.harvard.edu
To   statalist@hsphsun2.harvard.edu
Subject   st: From: Rodrigo Briceño <rjbriceno@gmail.com>
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–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   Site index