Statalist


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

st: AW: AW: Plotting 3 way continuous interactions in regression


From   "Martin Weiss" <[email protected]>
To   <[email protected]>
Subject   st: AW: AW: Plotting 3 way continuous interactions in regression
Date   Thu, 13 Aug 2009 14:09:04 +0200

<> 

Apart from the problem mentioned before, your strategy is technically a
little cumbersome but valid...


*************
sysuse auto, clear
reg pr we len he

su he, mean
gl headmean=r(mean)

gl mycovariates /* 
 */ "weight*($headmean)+2*le"

lincom $mycovariates
global b1 = r(estimate)

di $b1
*************



HTH
Martin


-----Ursprüngliche Nachricht-----
Von: [email protected]
[mailto:[email protected]] Im Auftrag von Martin Weiss
Gesendet: Donnerstag, 13. August 2009 14:06
An: [email protected]
Betreff: st: AW: Plotting 3 way continuous interactions in regression


<> 

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

What exactly does Stata say after which command?



HTH
Martin


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

Hi,

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.

Thanks

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


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