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.

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

From |
Nick Cox <njcoxstata@gmail.com> |

To |
statalist@hsphsun2.harvard.edu |

Subject |
Re: st: on-the-fly indicator at cutpoints of continuous variable |

Date |
Tue, 20 Nov 2012 18:37:56 +0000 |

In your original example it is unclear whether k is a constant you give or it's a parameter to be estimated. But either way -nl- can do it. I suppose we have all wanted to be able to write e.g. transformations on the command line. My wild guess is that the difficulty is not so much writing code to accept such input, but working out what that would imply all the way through to r- and e-class results, -margins-, -marginsplot-, etc., etc. I have no idea whether it's on the development list for Stata 13 or any other version. But I suspect that there are many things that users really, really miss that are more crucial. To each their own preferences, naturally. Nick On Tue, Nov 20, 2012 at 4:50 PM, Hoffman, George <ghoffman@mcw.edu> wrote: > Ah yes, nl. I have done that. I need to write a wrapper to make it easier. And that linear regression was just an example; a more generic approach would maybe go on the Stata 13 wish list! > Thanks again, > George > > > -----Original Message----- > From: owner-statalist@hsphsun2.harvard.edu [mailto:owner-statalist@hsphsun2.harvard.edu] On Behalf Of Nick Cox > Sent: Tuesday, November 20, 2012 9:57 AM > To: statalist@hsphsun2.harvard.edu > Subject: Re: st: on-the-fly indicator at cutpoints of continuous variable > > You can do something close to this in -nl-, but you would need to do it differently. > > Nick > > On Tue, Nov 20, 2012 at 3:44 PM, Hoffman, George <ghoffman@mcw.edu> wrote: > >> I'd like to model the following: >> reg Y c.x1 c.x2 i.x3 >> where i.x3 takes on a value of 1 if x3<k, otherwise 0 >> >> this does not work: >> reg Y c.x1 c.x2 i.(x3<k) >> >> it is simple to create an indicator variable and include that in the regression, but is there a way to include an on-the-fly indicator in commands? >> >> Apparently this is 'easy' in R. is there an equivalent in 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/

**References**:**st: on-the-fly indicator at cutpoints of continuous variable***From:*"Hoffman, George" <ghoffman@mcw.edu>

**Re: st: on-the-fly indicator at cutpoints of continuous variable***From:*Nick Cox <njcoxstata@gmail.com>

**RE: st: on-the-fly indicator at cutpoints of continuous variable***From:*"Hoffman, George" <ghoffman@mcw.edu>

- Prev by Date:
**st: RE: RE: Bivariate time series regression** - Next by Date:
**st: overid command** - Previous by thread:
**RE: st: on-the-fly indicator at cutpoints of continuous variable** - Next by thread:
**st: mcmcmixed version for binary outcome variables?** - Index(es):