Statalist The Stata Listserver

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

RE: st: transformations in commands

From   "Feiveson, Alan H. (JSC-SK311)" <>
To   <>
Subject   RE: st: transformations in commands
Date   Mon, 5 Jun 2006 08:54:33 -0500

Phil - Thank you for your detailed insight on this subject. I never
intended to imply that I would rather use or recommend R over Stata. I
was just wondering why Stata never considered implementing expressions
in commands. As your regression example points out - no software is
going to make everyone happy about everything.

Personally, it is no big deal for me to generate "log(x)", etc. before a
command - I have been doing it for so long that it is automatic. 


-----Original Message-----
[] On Behalf Of Phil Schumm
Sent: Friday, June 02, 2006 4:54 PM
Subject: Re: st: transformations in commands

On Jun 2, 2006, at 9:58 AM, Feiveson, Alan H. wrote:
> I have been demonstrating the wonders of Stata to users of R and have 
> been embarrassed by their criticism of Stata's inability to transform 
> a variable within the syntax of a command. For example reg y log(x) 
> won't work.

I wouldn't be embarrassed about that.  Classic Stata (excluding Mata) is
a statement-oriented language, whereas R is an expression-oriented
language.  And there are things you can do with the latter (e.g.,  
form nested expressions) that you just can't do with the former.   
However, I would argue that Stata's command syntax is one of the things
that makes Stata, as an analytic package, easier to use, especially for
beginners and infrequent users.  For example, compare

fm <- lm(mpg ~ weight, data=auto)


sysuse auto
reg mpg weight

I would argue that for many people (especially non-programmers), the
latter is easier to learn.  Virtually all Stata commands follow a
simple, common syntax, and once you've mastered that, you're off to the
races.  Very efficient for getting work done.

Those who are used to making full use of an expression-oriented
environment are not going to be satisfied simply with being able to type
"reg y log(x)" at the command line, which, as compared to having to
create a variable containing log(x) first, is essentially just syntactic
sugar.  Moreover, someone used to the fundamentally object- oriented
nature of R is likely to miss that in Stata a lot more.

BTW, the introduction of Mata fundamentally changes this comparison
(Mata is much more expression-oriented).  Have you shown Mata to your
"R" friends?

For someone who knows the R language very well and likes it, you're
unlikely to get him or her to abandon it entirely in favor of Stata (the
best you could do might be to get him or her to use Stata occasionally).
This is no different from trying to get a developer to stop using his or
her favorite programming language.  However, Stata has a myriad of
compelling strengths.  Consider just these few:

     - A simply unequaled level of support and documentation
     - A virtually bullet-proof certification process
     - Covers an incredible and ever-growing range of statistical
       models over a wide variety of disciplines
     - Provides a unified approach to things such as survey data,
       alternative methods of variance estimation, etc. across the
       full set of analytic commands (with only a few exceptions)
     - Excellent performance (e.g., speed)
     - Unequaled cross-platform support
     - Highly capable and flexible graphics (of course R has
       excellent graphics too)
     - Great tools and support for "developers" (i.e., writers of
       3rd-party commands and tools)
     - A high quality journal covering new analytic methods,
       data management tools, techniques for using Stata, etc.
     - Mata, Mata, Mata!
     - etc.

Please note that this is just what leaps to mind, is obviously  
incomplete, and is in no way intended to be a serious evaluation.   
Moreover, I have nothing against R, and must confess that I am at best a
casual R user and so am completely unqualified to comment on its
capabilities.  However, I just wanted to point out that when
evangelizing for Stata, there's enough to keep you in the pulpit for
hours, and the very last thing you should feel is embarrassed ;)

-- Phil

*   For searches and help try:

*   For searches and help try:

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