In Stata 16, the code below cannot run normally, but in Stata 15 and Stata 13, the code can run correctly, however, the results between them is different.
Which result should I believe?
* Example generated by -dataex-. To install: ssc install dataex clear input double(dv id serial) float(iv med mod1 newid) 4 1 1 .12499996 .5486109 -.05694437 1 4 1 2 -.07500005 -.17361127 -.05694437 1 4 1 3 -.07500005 .5486109 -.05694437 1 3.8 1 4 -.07500005 -.06250016 -.05694437 1 4 1 5 -.07500005 .3263887 -.05694437 1 3 1 6 -.07500005 -.3958335 -.05694437 1 4 1 7 .325 -.3958335 -.05694437 1 4 1 8 -.07500005 -.3958335 -.05694437 1 3.2 2 1 1.725 -.4375001 .14305563 2 3.7 2 2 .725 -.3819445 .14305563 2 3.7 2 3 -.6750001 .006944391 .14305563 2 3.4 2 4 -.07500005 .2291666 .14305563 2 3.3 2 5 -1.075 -.54861116 .14305563 2 3 2 6 .325 .2291666 .14305563 2 4.7 2 7 -.27500004 .4513888 .14305563 2 5 2 8 -.6750001 .4513888 .14305563 2 4 3 1 -.125 -.013888836 -.3569444 3 3.5 3 2 .075 -.013888836 -.3569444 3 3.8 3 3 -.125 -.013888836 -.3569444 3 3.6 3 4 -.125 .09722228 -.3569444 3 3.8 3 5 .075 -.013888836 -.3569444 3 4 3 6 .075 -.013888836 -.3569444 3 3.8 3 7 .075 -.013888836 -.3569444 3 4 3 8 .075 -.013888836 -.3569444 3 3.2 4 1 -.17142864 -.007936531 -.4569444 4 3.7 4 2 -.7714286 .04761903 -.4569444 4 2.7 4 3 .02857137 -.06349209 -.4569444 4 2.2 4 4 .4285714 -.11904764 -.4569444 4 2.4 4 5 .6285714 .10317458 -.4569444 4 2.9 4 6 .22857137 .3253968 -.4569444 4 . 4 7 . . -.4569444 4 3.8 4 8 -.3714286 -.2857143 -.4569444 4 3.9 5 1 .025000047 .58333325 -.15694436 5 4.3 5 2 -.17499995 .02777767 -.15694436 5 4.1 5 3 -.17499995 .4166666 -.15694436 5 3.4 5 4 .025000047 -.25000012 -.15694436 5 3.5 5 5 .425 -.3611112 -.15694436 5 3.8 5 6 .22500005 -.19444455 -.15694436 5 3.1 5 7 -.17499995 -.25000012 -.15694436 5 4.3 5 8 -.17499995 .02777767 -.15694436 5 4 6 1 .7000001 -.08333354 .14305563 6 4.2 6 2 .3000001 .472222 .14305563 6 4 6 3 .1000001 .027777566 .14305563 6 3.6 6 4 -.2999999 -.08333354 .14305563 6 3.3 6 5 -.2999999 -.08333354 .14305563 6 3.8 6 6 -.2999999 -.1388891 .14305563 6 3.3 6 7 .1000001 -.08333354 .14305563 6 3.3 6 8 -.2999999 -.02777799 .14305563 6 3.8 7 1 -.0999999 .06250016 .14305563 7 3.5 7 2 -.0999999 .3402779 .14305563 7 3.3 7 3 -.0999999 .11805572 .14305563 7 2.8 7 4 -.0999999 -.1041665 .14305563 7 3 7 5 .3000001 -.1041665 .14305563 7 3 7 6 .1000001 -.1041665 .14305563 7 3.2 7 7 .1000001 -.1041665 .14305563 7 3 7 8 -.0999999 -.1041665 .14305563 7 . 8 1 . . .4430556 8 . 8 2 . . .4430556 8 4.5 8 3 .033333253 -.111111 .4430556 8 3.6 8 4 -.3666667 -.111111 .4430556 8 3.4 8 5 .033333253 -.05555545 .4430556 8 3.1 8 6 -.16666675 .22222233 .4430556 8 3.4 8 7 .43333325 .16666678 .4430556 8 3.6 8 8 .033333253 -.111111 .4430556 8 4.1 9 1 .12500003 .3680556 -.05694437 9 4.6 9 2 .12500003 .47916675 -.05694437 9 4.5 9 3 -.27499998 -2.1319444 -.05694437 9 4 9 4 .12500003 .14583342 -.05694437 9 4.5 9 5 .12500003 .14583342 -.05694437 9 4 9 6 -.27499998 .3680556 -.05694437 9 4.5 9 7 .12500003 .25694454 -.05694437 9 4.5 9 8 -.07499997 .3680556 -.05694437 9 3.4 10 1 .2 0 .8430556 10 3.5 10 2 .2 0 .8430556 10 3.7 10 3 .2 0 .8430556 10 3 10 4 0 0 .8430556 10 3.3 10 5 .2 0 .8430556 10 3.6 10 6 -.8 0 .8430556 10 3 10 7 0 0 .8430556 10 3 10 8 0 0 .8430556 10 3.8 11 1 .8 0 .24305563 11 3.8 11 2 -.20000005 0 .24305563 11 3.4 11 3 -.20000005 0 .24305563 11 3.8 11 4 -.20000005 0 .24305563 11 3.6 11 5 -4.768372e-08 0 .24305563 11 4 11 6 -.20000005 0 .24305563 11 3.6 11 7 -4.768372e-08 0 .24305563 11 3.4 11 8 -4.768372e-08 0 .24305563 11 4.1 12 1 -.75 0 -.05694437 12 3.3 12 2 -.55 0 -.05694437 12 3.8 12 3 .25 0 -.05694437 12 3.9 12 4 -.75 0 -.05694437 12 3.9 12 5 -.35 0 -.05694437 12 3.6 12 6 .65 0 -.05694437 12 3 12 7 .25 0 -.05694437 12 4.3 12 8 1.25 0 -.05694437 12 3 13 1 0 -.009259198 -.6569444 13 3 13 2 0 -.009259198 -.6569444 13 3 13 3 0 -.064814754 -.6569444 13 3 13 4 0 -.009259198 -.6569444 13 end xtset id serial set seed 10000 capture program drop MoDMed program define MoDMed, rclass quietly summarize mod1 return list global m=r(mean) global sd=r(sd) mixed med l.iv mod1 cl.iv#c.mod1 || id: l.iv, var cov(exc) iter(50) return scalar al=(_b[med:L.iv]+_b[med:cL.iv#c.mod1]*($m-$sd)) return scalar ah=(_b[med:L.iv]+_b[med:cL.iv#c.mod1]*($m+$sd)) mixed dv med l.iv || id: l.iv med, var cov(exc) iter(50) return scalar b=(_b[dv:med]) end bootstrap indL=(r(al)*r(b)) indH=(r(ah)*r(b)) diff=(r(ah)*r(b)-r(al)*r(b)), reps(50) reject(e(converged)!=1) cluster(id) idcluster(newid) group(serial): MoDMed estat bootstrap program drop MoDMed
Related Posts with the smae code and the same data, but the result is different using STATA 13,15 and 16
Oaxaca decomposition for nonlinear regression (nldecompose)Hello readers, I am trying to decompose (using Ben Jann’s nldecompose) differences in the probabilit…
GenerateI am using two data set, one contains data for children and another for woman. Now both data sets ha…
Year fixed effectsHello everyone, I am running a panel data regression model in which I observe 4 time periods and 66 …
graph pie with some of percentagesHow to display the fraction when percentage is above 20%, I know how to display all percentages Cod…
regression result only except first variableHello When I regress as below, why don't I get the result for the first variable and how can I fix …
Subscribe to:
Post Comments (Atom)
0 Response to the smae code and the same data, but the result is different using STATA 13,15 and 16
Post a Comment