Statalist


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

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


From   Kris Anderson <[email protected]>
To   [email protected]
Subject   Re: st: AW: AW: Plotting 3 way continuous interactions in regression
Date   Thu, 13 Aug 2009 08:38:07 -0700

Unfortunately, the _SAP was not the problem. It was an artifact of my cut and paste.

The message I receive is after the lincom $HPNHAF /* slope 1*/ command It says SAP/ invalid name.

I am sorry but I don't follow the code below. What is this doing? I am relatively new to coding in Stata.

Martin Weiss wrote:
<>
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/


--
Kristen G. Anderson, Ph.D.
Assistant Professor of Psychology, Reed College
Principal Investigator, Adolescent Health Research Program
Licensed Clinical Psychologist (OR)
3203 SE Woodstock Blvd., Portland, OR 97202
Phone: 503-517-7410
Fax: 503-517-7610
http://academic.reed.edu/psychology/ahrp/
*
*   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