Hi all,
I am new in this forum so if this is not the proper place to post this question let me know please.
I have to run some wald test after the margin commands. I have 10 different outcomes and I have to run 8 tests for each one of them. I am using a forevalues loop to run the tests in each outcome and it does work. The code is this:
ologit INCDECIL HWUSUAL gender sup exp NatISCED* EUcitISCED* nonEUcitISCED* EUresid nonEUcitresid
margins, predict (outcome(1)) dydx(NatISCED* EUcitISCED*) at(EUresid = 0 nonEUcitresid = 0 EUcitISCED1 = 0 EUcitISCED2 = 0 EUcitISCED3 = 0 EUcitISCED4 = 0 EUcitISCED5 = 0 EUcitISCED6 = 0 EUcitISCED7 = 0 EUcitISCED8 = 0 nonEUcitISCED1 = 0 nonEUcitISCED2 = 0 nonEUcitISCED3 = 0 nonEUcitISCED4 = 0 nonEUcitISCED5 = 0 nonEUcitISCED6 = 0 nonEUcitISCED7 = 0 nonEUcitISCED8 = 0) ///
post at(nonEUcitresid = 0 NatISCED1 = 0 NatISCED2 = 0 NatISCED3 = 0 NatISCED4 = 0 NatISCED5 = 0 NatISCED6 = 0 NatISCED7 = 0 NatISCED8 = 0 nonEUcitISCED1 = 0 nonEUcitISCED2 = 0 nonEUcitISCED3 = 0 nonEUcitISCED4 = 0 nonEUcitISCED5 = 0 nonEUcitISCED6 = 0 nonEUcitISCED7 = 0 nonEUcitISCED8 = 0)
forvalues i = 1/8 {
test [NatISCED`i']1._at - [EUcitISCED`i']2._at = 0
local sign_ag = sign([NatISCED`i']1._at - [EUcitISCED`i']2._at)
display "H_0: NatISCED`i' coef <= EUcitISCED`i' coef. p-value = " 1-normal(`sign_ag'*sqrt(r(chi2)))
}
I would like to include the input for margins into the loop so I can run it for outcome from 1 to 10 and inside each outcome run the test as it is specified in the forvalues loop. I would like to save on running the margin command ten times and afterword running my loop. Can I use several loops to do that? Any advise on how to do it.
Thank you in advance,
Carlos.
Related Posts with Using several loops together
Non-convergence in IV PoissonDear Statalisters, I am using the IV Poisson model: Code: ivpoisson gmm dependent variable covari…
range of quartilesDear colleagues, I have created 4 quartiles of a variable (age) that goes form 18 to 89. What is the…
Xtabond2 Model SpecificationN: 2500 T: 3 For my purposes: - Endogenous: x1, x2, x3 - Predetermined: x4 - Exogenous: x5 x6 x7 x8…
Label VariablesHello, I have a stata file named "survey.dta" which contains the following labelled data: ident…
How to show persistence using panel dataDear stata users and experts, My data is firm year panel data, i.e., I have observations at firm le…
Subscribe to:
Post Comments (Atom)
0 Response to Using several loops together
Post a Comment