Statalist The Stata Listserver


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

Re: st: St: I am using a model with interactions. How can I obtain marginal effects


From   Maarten buis <[email protected]>
To   [email protected]
Subject   Re: st: St: I am using a model with interactions. How can I obtain marginal effects
Date   Sat, 11 Feb 2006 17:48:35 +0000 (GMT)

Hello:

The problem is in the line: -local xb  _b[pcinc]*`meanpcinc '+_b[ratio1]*`meanratio1 '+_b[ii1] 
*`meanpcinc '*`meanratio1 '+_b[_cons]-. You call macros names `meanpcinc ' and `meanratio1 ' with
a space. However you made the macros `meanpcinc' and `meanratio1', without space. So you called
macros that do not exist, so they return a missing value, and that causes the syntax error. so
that line should read: -local xb  _b[pcinc]*`meanpcinc' + _b[ratio1]*`meanratio1' +
_b[ii1]*`meanpcinc'*`meanratio1' + _b[_cons]-. Note that the "-" at the begining and the end just
mean by Statalist convention "type in Stata whatever is in between".

HTH,
Maarten

--- �� ���� <[email protected]> wrote:
>    According to the 
> http://www.stata.com/support/faqs/stat/mfx_interact.html,the author tells 
> me how to obtain marginal effects and their standard errors. So I program, 
> the code is following:
>  (Note:  h is the dependent variable ,  pcinc  ratio1 ii1 is the 
> independent                variable ,furthermore , ii1 is the interaction 
> term.)
>  probit h  pcinc ratio1 ii1
>  quietly summarize  pcinc if  e(sample)
>  local meanpcinc = r(mean)
>  quietly summarize ratio1 if e(sample)
>  local meanratio1= r(mean)
>  local xb  _b[pcinc]*`meanpcinc '+_b[ratio1]*`meanratio1 '+_b[ii1] 
> *`meanpcinc '*`meanratio1 '+_b[_cons]
> 
> (The above step is ok in stata)
> 
> predictnl dydt=  normalden(`xb')*(_b[pcinc]+_b[ii1]*`meanratio1')in 1 
> ,se(sep)
> 
>  ��invalid syntax�� appears in stata. I don��t know what��s wrong with this 
> step .so could you help me to solve this problem.

-----------------------------------------
between 1/2/2006 and 31/3/2006 I will be
visiting the UCLA, during this time the
best way to reach me is by email

Maarten L. Buis
Department of Social Research Methodology
Vrije Universiteit Amsterdam
Boelelaan 1081
1081 HV Amsterdam
The Netherlands

visiting adress:
Buitenveldertselaan 3 (Metropolitan), room Z214

+31 20 5986715

http://home.fsw.vu.nl/m.buis/
-----------------------------------------


		
___________________________________________________________ 
To help you stay safe and secure online, we've developed the all new Yahoo! Security Centre. http://uk.security.yahoo.com
*
*   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