Statalist The Stata Listserver


[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

Re: st: linear spline and interaction


From   Maarten buis <[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/



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