Notice: On March 31, it was announced that Statalist is moving from an email list to a forum. The old list will shut down on April 23, and its replacement, statalist.org is already up and running.

# RE: st: predictnl expression too long

 From Richard J Swartz To "statalist@hsphsun2.harvard.edu" Subject RE: st: predictnl expression too long Date Fri, 8 Mar 2013 10:17:10 -0600

```Thanks Maarten!
After reading the comments and help files on predict, it looks like predict() and xb() have set quantities they can produce involving the linear portion of the model (XB).  Is this correct?
If so then, unfortunately the function I'm estimating cannot be simplified by predict() or xb() because  the function I want to predict use a subset of the linear component, (i.e. a subset of the predictors) as opposed to the full XB linear component.  If someone had more experience with xb() and predict() to do this kind of estimation I am open to suggestions!  Code for the quantity I am trying to predict using predictnl is below.  `XB010' etc. are macro variables that are the subsets of the linear components.  They are also long expressions.

predictnl eff= normal((`xb111')/`sigma')*((`xb111')+`sigma'*(normalden((`xb111')/`sigma')/normal((`xb111')\`sigma')))/*
*/-normal((`xb011')/`sigma')*((`xb011')+`sigma'*(normalden((`xb011')/`sigma')/normal((`xb011')\`sigma')))/*
*/-normal((`xb101')/`sigma')*((`xb101')+`sigma'*(normalden((`xb101')/`sigma')/normal((`xb101')\`sigma')))/*
*/+normal((`xb001')/`sigma')*((`xb001')+`sigma'*(normalden((`xb001')/`sigma')/normal((`xb001')\`sigma')))/*
*/-normal((`xb110')/`sigma')*((`xb110')+`sigma'*(normalden((`xb110')/`sigma')/normal((`xb110')\`sigma')))/*
*/+normal((`xb010')/`sigma')*((`xb010')+`sigma'*(normalden((`xb010')/`sigma')/normal((`xb010')\`sigma')))/*
*/+normal((`xb100')/`sigma')*((`xb100')+`sigma'*(normalden((`xb100')/`sigma')/normal((`xb100')\`sigma')))/*
*/-normal((`xb000')/`sigma')*((`xb000')+`sigma'*(normalden((`xb000')/`sigma')/normal((`xb000')\`sigma'))), se(inteff_se)

Thanks,
Richard

-----Original Message-----
From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Maarten Buis
Sent: Friday, March 08, 2013 2:32 AM
To: statalist@hsphsun2.harvard.edu
Subject: Re: st: predictnl expression too long

On Thu, Mar 7, 2013 at 8:34 PM, Richard J Swartz wrote:
> I am a new stata user and I'm trying to use the command "predictnl" to create an estimate of a 3-way interaction effect for a Tobit model (a la Ai and Norton 2003: "Interaction terms in logit and probit").  When I run "predictnl" stata gives me the error message:
>
> Expression too long
> r(130);

You can often dramatically reduce the length of a -predictnl- expression by using the -xb()- function, see: -help predictnl-.

Hope this helps,
Maarten

---------------------------------
Maarten L. Buis
WZB
Reichpietschufer 50
10785 Berlin
Germany

http://www.maartenbuis.nl
---------------------------------

*
*   For searches and help try:
*   http://www.stata.com/help.cgi?search
*   http://www.stata.com/support/faqs/resources/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/faqs/resources/statalist-faq/
*   http://www.ats.ucla.edu/stat/stata/
```