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

st: AW: Plotting 3 way continuous interactions in regression

From   "Martin Weiss" <>
To   <>
Subject   st: AW: Plotting 3 way continuous interactions in regression
Date   Thu, 13 Aug 2009 14:06:10 +0200


You use "_SAP" in your -regress- command, but "SAP" in your -global-s....

What exactly does Stata say after which command?


-----Ursprüngliche Nachricht-----
[] Im Auftrag von Kris Anderson
Gesendet: Donnerstag, 13. August 2009 01:54
Betreff: st: Plotting 3 way continuous interactions in regression


I am stuck on a piece of code that I can't seem to debug. I am trying to 
plot a 3-way interaction using the FAQ on plotting these interactions 
with covariates. The code hangs up as I try to compute 4 simple slopes. 
The program tells me the name of my interaction term is invalid. Can 
anyone see a problem here? I tried renaming the variable but it didn't help.


regress avgdrink age sex gradedich white hisp csocanx caffil cpn SAF SP 
AP _SAP if currentdrinker > 0

sum csocanx
global hi=r(max)
global lo=r(min)
sum caffil
global HAF=r(mean)+r(sd)
global LAF=r(mean)-r(sd)
sum cpn
global HPN=r(mean) +r(sd)
global LPN=r(mean) -r(sd)
sum age
global mage=r(mean)
sum gradedich
global mgrade=r(mean)
sum white
global mwhite=r(mean)
sum hisp
global mhisp=r(mean)
global HPNHAF "csocanx + ($HPN)*SP + ($HAF)*SAF + ($HPN)*($HAF)*SAP"
global HPNLAF "csocanx + ($HPN)*SP + ($LAF)*SAF + ($HPN)*($LAF)*SAP"
global LPNHAF "csocanx + ($LPN)*SP + ($HAF)*SAF + ($LPN)*($HAF)*SAP"
global LPNLAF "csocanx + ($LPN)*SP + ($LAF)*SAF + ($LPN)*($LAF)*SAP"
lincom $HPNHAF /* slope 1*/
global b1 = r(estimate)
lincom $HPNLAF /* slope 2*/
global b2 = r(estimate)
lincom $LPNHAF /* slope 3*/
global b3 = r(estimate)
lincom $LPNLAF /* slope 4*/
global b4 = r(estimate)

*   For searches and help try:

*   For searches and help try:

© Copyright 1996–2015 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index