| |
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]
Re: st: linear spline and interaction
Thanks Marteen,
I was expecting a increase relationship between z and y, for both
categories of the dummy variables, I did not correctly interpret my
outputs, now by looking carefully to the outputs and producing the plot, I
understood how to interpret my outputs
mkspline Z1 a Z2 =Z
xi: reg Y i.D*Z1 i.D*Z2
Y Coef.
Dummy -1,80
Z1 0,07
Z1*Dummy 0,02
Dummy (dropped)
Z2 0,33
Z2*Dummy -0,07
_cons 1,43
the parameter of Z1 is the change in Y for dummy =0 for Z < a (cut point)
the parameter of Z2 is the change in Y for dummy =0 for Z >= a (cut point)
the combination Z2+Z2*Dummy is for Dummu=1
Sami
From: Maarten buis <[email protected]>
Reply-To: [email protected]
To: [email protected]
Subject: Re: st: linear spline and interaction
Date: Fri, 22 Sep 2006 21:20:02 +0100 (BST)
--- stata_user stata_user <[email protected]> wrote:
<snip>
> The first line creates a linear spline at the value 'a' of the
> variable z
<snip>
> My question , how I can include an interaction term with a dummy
> variable d? the code
>
> xi: reg y i.d*z1 i.d*z2
>
> does not give me the expected result
"Does not give me the expected result" is not very informative. Your
code makes sense to me. So I cannot tell you why the results don't
match your expectations.
Things are often more clear when using a real example with real data.
The example below reproduces your code but now for a dataset we all
have access to, so we can all see the results and see if they are as
expected. Can you tell us what in this example is not as you expected
or if this is as expectd, what in this example is different from your
data?
HTH,
Maarten
*------------- begin example ---------
sysuse auto, clear
mkspline mpg1 21 mpg2=mpg, marginal
reg price mpg1 mpg2
xi: reg price i.foreign*mpg1 i.foreign*mpg2
predict yhat
twoway line yhat mpg if foreign == 0, sort || /*
*/ line yhat mpg if foreign == 1, sort || /*
*/ scatter price mpg if foreign == 0 || /*
*/ scatter price mpg if foreign == 1, /*
*/ legend(label(1 "domestic") label(2 "foreign") /*
*/ label(3 "domestic") label(4 "foreign")) /*
*/ ytitle(price)
*------------- end example --------------
-----------------------------------------
Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands
visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z434
+31 20 5986715
http://home.fsw.vu.nl/m.buis/
-----------------------------------------
___________________________________________________________
The all-new Yahoo! Mail goes wherever you go - free your email address from
your Internet provider. http://uk.docs.yahoo.com/nowyoucan.html
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/
_________________________________________________________________
Windows Live� Messenger has arrived. Click here to download it for free!
http://imagine-msn.com/messenger/launch80/?locale=en-gb
*
* For searches and help try:
* http://www.stata.com/support/faqs/res/findit.html
* http://www.stata.com/support/statalist/faq
* http://www.ats.ucla.edu/stat/stata/