|
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
st: NL estimation loop results are not always returned.
NL estimation loop results are not always returned.
I am using the NL command in STATA IC version 10.1 for Windows.
I am attempting to estimate the intersection of 2 lines in a segmented linear
regression. The dataset contains about 9000 tests with 5 to 10 stimulus and
response pairs for each test. There is no missing data. I want to run a seperate model for each test.
perameters are:
y - response
x - stimulus
b1 - first line slope forced to be 0 (so b1 is excluded from equasion)
aone - initial estimate of first line y intercept
xints - initial estimate of intercept of lines
btwo - initial estimate of slope of second line
I need results for:
a1 - first line y intercept
beta - slope of second line
xint - intercept of lines
mms - model mean square
msr - residual mean square
dfr - residual degrees of freedom
converge - does the model converge for this test
The code I used is:
foreach t of num 1/900 {
local aone = aone
local xints = xints
local btwo = btwo
capture quietly nl (y=({a1}*x)*(x<{c})+({a1}*{c}+{b2}*(x-{c}))*(x>={c})) if test==`t', initial(a1 `aone' c `xints' b2 `btwo')
capture replace beta = _coef[/b2] if test==`t'
capture replace xint = _coef[/c] if test==`t'
capture replace mms = e(mms) if test==`t'
capture replace msr = e(msr) if test==`t'
capture replace dfr = e(df_r) if test==`t'
capture replace converge= e(converge) if test==`t'
disp `t'
}
For some tests the returned mms=. and the dfr=9.
All tests return all results except for those with dfr=9.
converge is always =1.
Test 14 and 15 return all results, test 16 does not return mms.
I would appericate any suggestions on why mms is not returned.
test y x a1 aone btwo xints beta converge xint dfr mms msr
14 0.883141 24.6 0.883141 0.883141 0.306994 31.94317 -0.06707 1 38 7 11.99627 0.989146
14 0.979558 29.1 0.883141 0.883141 0.306994 31.94317 -0.06707 1 38 7 11.99627 0.989146
14 0.968345 33.6 0.883141 0.883141 0.306994 31.94317 -0.06707 1 38 7 11.99627 0.989146
14 1.762098 38 0.883141 0.883141 0.306994 31.94317 -0.06707 1 38 7 11.99627 0.989146
14 1.977106 42.5 0.883141 0.883141 0.306994 31.94317 -0.06707 1 38 7 11.99627 0.989146
14 4.13076 46.9 0.883141 0.883141 0.306994 31.94317 -0.06707 1 38 7 11.99627 0.989146
14 4.688457 51.3 0.883141 0.883141 0.306994 31.94317 -0.06707 1 38 7 11.99627 0.989146
14 6.324555 55.8 0.883141 0.883141 0.306994 31.94317 -0.06707 1 38 7 11.99627 0.989146
14 3.597742 60.2 0.883141 0.883141 0.306994 31.94317 -0.06707 1 38 7 11.99627 0.989146
14 3.681544 64.7 0.883141 0.883141 0.306994 31.94317 -0.06707 1 38 7 11.99627 0.989146
15 0.7871 24.6 0.216785 0.216785 0.409626 34.47077 0.036578 1 17.30777 8 2.187868 0.767131
15 1.291309 29 0.216785 0.216785 0.409626 34.47077 0.036578 1 17.30777 8 2.187868 0.767131
15 0.216785 33.4 0.216785 0.216785 0.409626 34.47077 0.036578 1 17.30777 8 2.187868 0.767131
15 2.118507 37.9 0.216785 0.216785 0.409626 34.47077 0.036578 1 17.30777 8 2.187868 0.767131
15 1.954474 42.3 0.216785 0.216785 0.409626 34.47077 0.036578 1 17.30777 8 2.187868 0.767131
15 2.296308 46.8 0.216785 0.216785 0.409626 34.47077 0.036578 1 17.30777 8 2.187868 0.767131
15 2.404529 51.3 0.216785 0.216785 0.409626 34.47077 0.036578 1 17.30777 8 2.187868 0.767131
15 2.697926 55.7 0.216785 0.216785 0.409626 34.47077 0.036578 1 17.30777 8 2.187868 0.767131
15 3.944845 60.2 0.216785 0.216785 0.409626 34.47077 0.036578 1 17.30777 8 2.187868 0.767131
15 8.05434 64.6 0.216785 0.216785 0.409626 34.47077 0.036578 1 17.30777 8 2.187868 0.767131
16 0.146565 24.3 0.146565 0.146565 0.185816 32.98842 -0.02161 1 206.0967 9 0.552894
16 0.893367 28.6 0.146565 0.146565 0.185816 32.98842 -0.02161 1 206.0967 9 0.552894
16 0.368154 33 0.146565 0.146565 0.185816 32.98842 -0.02161 1 206.0967 9 0.552894
16 1.432287 37.4 0.146565 0.146565 0.185816 32.98842 -0.02161 1 206.0967 9 0.552894
16 1.074064 41.9 0.146565 0.146565 0.185816 32.98842 -0.02161 1 206.0967 9 0.552894
16 3.24362 46.3 0.146565 0.146565 0.185816 32.98842 -0.02161 1 206.0967 9 0.552894
16 2.606333 50.7 0.146565 0.146565 0.185816 32.98842 -0.02161 1 206.0967 9 0.552894
16 1.607052 55.2 0.146565 0.146565 0.185816 32.98842 -0.02161 1 206.0967 9 0.552894
16 1.866508 59.6 0.146565 0.146565 0.185816 32.98842 -0.02161 1 206.0967 9 0.552894
16 4.375524 64.1 0.146565 0.146565 0.185816 32.98842 -0.02161 1 206.0967 9 0.552894
Bert Stover University of Washington
*
* 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/