Statalist


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

st: nlcom for tobit interactions


From   "Walter Forrest" <[email protected]>
To   [email protected]
Subject   st: nlcom for tobit interactions
Date   Sun, 9 Nov 2008 14:09:39 -0500

Hi,

I'm trying to estimate interaction effects in a tobit model using nlcom.

I've managed to get estimates for hypothesized x1 and x2 values (e.g.
with x1 and x2 held at their means), but I'm having some trouble
getting nlcom to provide estimates (coefficients, standard errors, and
confidence intervals) for each observation based on the actual x1 and
x2 values for those cases. (Ultimately, I'd like to be able to
generate a plot that shows the interaction effect for every single
case in much the same way as inteff does for logit and probit models).
It seems that nlcom requires constants rather than variables which, if
correct, would suggest that I need to find a way to run the command
for each case, one at a time, and then save those results before
running nlcom for the next case. I thought about trying to use forval
(i.e. forval i=1 /`_N'), but I'm not sure how to do that and still
save the nlcom results so that I could later append them into a
separate data file. (Clearly, I've reached the limits of my knowledge
of stata programming commands).

Here's what I have so far:

tobit y x1 x2 x3 ... etc, ll ul

predict xb if e(sample)

quietly summarize xb if e(sample)

            local meanxb =r(mean)

quietly summarize `x1' if e(sample)

local mx1=r(mean)

quietly summarize `x2' if e(sample)

local mx2=r(mean)

*/ This creates meanxb

local big "normal(`meanxb'/_b[/sigma])"

local small "normalden(`meanxb'/_b[/sigma])"

nlcom ((_b[`x3']*`big')+(1/_b[/sigma])*((_b[`x1']*_b[`x2'])+(_b[`x1']*_b[`x3']*`mx1')
+ (_b[`x2']*_b[`x3']*`mx2') + (_b[`x3']*_b[`x3']*`mx1'*`mx2')) *
`small'), post


Can anyone suggest a solution? I'd appreciate any advice you can give.

Thanks



Walter Forrest
Assistant Professor
College of Criminal Justice
Northeastern University
429 Churchill Hall
Boston MA 02115-5000
*
*   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–2024 StataCorp LLC   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index