Hi,
using a goodness of fit test in form of R2 and AIC I test which hyperbolic discounting model fit my data set on health outcomes best. The models are based on a non linear equation in form of:
nl (y=(((1+x1)/(1+x2))^(({b0}*H+{b1}*x1+{b2}* x3)/{b3}* x4)), vce(cluster ID).
For the aggregate level (N=99) it worked fine using the command estat ic afterwards, however I want to test the fit of R2 also on an individual level too.
In the forum I found the idea by U.Kohler in form of:
. gen r2 = .
local i 1
levelsof firm, local(K)
foreach k of local K {
regress yvar xvarlist if firm == `k'
replace r2 = e(r2) in `i++'
}
However, STATA does not allow "if" after the nl command. is there another way to deal with this nl form to generate the new R2 variable per individual?
I would highly appreciate your help!
Thank you.
Janin
using a goodness of fit test in form of R2 and AIC I test which hyperbolic discounting model fit my data set on health outcomes best. The models are based on a non linear equation in form of:
nl (y=(((1+x1)/(1+x2))^(({b0}*H+{b1}*x1+{b2}* x3)/{b3}* x4)), vce(cluster ID).
For the aggregate level (N=99) it worked fine using the command estat ic afterwards, however I want to test the fit of R2 also on an individual level too.
In the forum I found the idea by U.Kohler in form of:
. gen r2 = .
local i 1
levelsof firm, local(K)
foreach k of local K {
regress yvar xvarlist if firm == `k'
replace r2 = e(r2) in `i++'
}
However, STATA does not allow "if" after the nl command. is there another way to deal with this nl form to generate the new R2 variable per individual?
I would highly appreciate your help!
Thank you.
Janin
Comment