# st: RE: AW: RE: AW: computing interaction effects after xtprobit

 From To Subject st: RE: AW: RE: AW: computing interaction effects after xtprobit Date Thu, 9 Apr 2009 17:13:54 +0100

```Hello Martin,

Following your advice below, I used predictnl in order to get the whole vector of predictions.

predictnl linearpred = _b[_cons] + _b[cont1]*cont1+ _b[cont2]*cont2+ _b[inter]*inter+ _b[cont3]*cont3

predictnl coef = _b[inter] - (_b[cont1]+_b[inter]*cont2)*(_b[cont2] + _b[inter]*cont1)*(linearpred)

I then computed the interaction effect as follows

predictnl interact = coef*(normden(linearpred))

This works fine. I would like to compute the significance of this interaction effect. Can options of the predictnl command be used for that (eg p() )?

________________________________

From: owner-statalist@hsphsun2.harvard.edu on behalf of Martin Weiss
Sent: Tue 31/03/2009 12:18
To: statalist@hsphsun2.harvard.edu
Subject: st: AW: RE: AW: computing interaction effects after xtprobit

<>

I am not an expert in these issues so you should pay closer attention to
Austin`s remarks than mine.

What I do understand from your code sample is that you are trying to store a
vector of values in a -local- which is bound to end in tears. Take the line

***
local coef = _b[inter] - (_b[cont1]+_b[inter]*cont2)*(_ ...
****

What is Stata supposed to make of "cont2"? By default, it assumes the first
value of "cont2", multiplies out the product with the coefficients you
specified and stores this _one_ value in the local. This may be what you
want, but I doubt it.

If you want the whole vector of predictions, use -predict- itself. You may
also want to look at -adjust- as a front-end for -predict-. See Brian`s

Incidentally, you are right that you cannot take shortcuts such as "*" in
these calculations but have to spell them out. -h unab- may be your friend
in preprocessing a -varlist-...

HTH
Martin

Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von
I.Roland@lse.ac.uk
Gesendet: Dienstag, 31. März 2009 13:06
An: statalist@hsphsun2.harvard.edu
Betreff: st: RE: AW: computing interaction effects after xtprobit

Hi Martin/Austin

Thanks for this. I am trying to replicate what -inteff- does with
-predictnl- for my model.

My variables are as follows:

y binary dependent variable
cont1 continuous independent variable
cont2 continuous independent variable
inter: cont1*cont2
cont3 continuous independent variable

The RE probit is:

xtprobit y cont1 cont2 inter cont3, i(group)

Based on Norton and Ai (2004, p.158), I then use the following code to
compute the interaction effect:

local xb = _b[_cons] + _b[cont1]*cont1 + _b[cont2]*cont2 + _b[inter]*inter +
_b[cont3]*cont3
local coef = _b[inter] - (_b[cont1]+_b[inter]*cont2)*(_b[cont2] +
_b[inter]*cont1)*(_b[_cons] + _b[cont1]*cont1 +_b[cont2]*cont2 +
_b[inter]*inter + _b[cont3]*cont3)
predictnl interac = (`coef')*(normden(`xb')), se(se_interac)
sum interac se_interac
That runs fine but delivers a constant interaction effect. Forgive my
ignorance, but could this be because it ignores the unobserved random
effects?
Alternatively, I would like to estimate a FE probit - same model as above
but with indicator variables (identified by group in the RE model). This
approach may be better since it is not possible to capture the unobserved
random effects. I have a lot of indicator variables and would like to find
an easy way to capture them in the code that I need to run to compute the
interaction effect. It seems it is not possible to use the usual truncation
* in the code (see code I tried below where ind* captures all the
indicators).
local xb = _b[_cons] + _b[cps]*cps + _b[rz]*rz + _b[cpsrz]*cpsrz +
_b[share]*share + _b[ind*]*(ind*)
________________________________________
From: owner-statalist@hsphsun2.harvard.edu on behalf of Martin Weiss
Sent: Fri 27/03/2009 17:07
To: statalist@hsphsun2.harvard.edu
Subject: st: AW: computing interaction effects after xtprobit

<>

http://www.stata-journal.com/sjpdf.html?articlenum=st0063, page 156 says
that you can replicate anything -ssc d inteff- does via -predictnl-.

HTH
Martin

-----Ursprüngliche Nachricht-----
Von: owner-statalist@hsphsun2.harvard.edu
[mailto:owner-statalist@hsphsun2.harvard.edu] Im Auftrag von
I.Roland@lse.ac.uk
Gesendet: Freitag, 27. März 2009 18:02
An: statalist@hsphsun2.harvard.edu
Betreff: st: computing interaction effects after xtprobit

Hello Statalisters,

I would like to estimate a random-effects probit that includes an
interaction term between two continuous independent variables. After the
command 'probit', 'inteff' can be used to compute the correct interaction
effects. However, it does not seem to work after 'xtprobit'. Does anyone
know how to compute interaction effects after 'xtprobit'?

communications disclaimer:
http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm

*
*   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/

*
*   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/
communications disclaimer:
http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm

*
*   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/

Please access the attached hyperlink for an important electronic communications disclaimer: http://www.lse.ac.uk/collections/secretariat/legal/disclaimer.htm```

<<winmail.dat>>