Stata Fully Mapped into R

April 1, 2014
By

(This article was first published on Econometrics by Simulation, and kindly contributed to R-bloggers)

Hello all of you Stata loving statistical analysts out there!  I have great news.  I am finally nearly done with the package I have been working on which provides the mechanism for Stata users to seamlessly move from Stata to R though use of my new package "RStata"!

In this package I have taken 150 of the most commonly used commands in Stata and directly mapped their syntax into R.  Not only can they be called using identical syntax but they also return identical arguments to the active window.  In order to accomplish this task, the package has built in dependencies on many useful R packages such as plry, ggplot2, glm, etc.  So installation could take a while.

To see this new package in action, here is some sample code:

library("RStata")

sysuse auto
regress mpg weight c.weight#c.weight foreign


      Source |       SS       df       MS              Number of obs =      74
-------------+------------------------------           F(  3,    70) =   52.25
       Model |  1689.15372     3   563.05124           Prob > F      =  0.0000
    Residual |   754.30574    70  10.7757963           R-squared     =  0.6913
-------------+------------------------------           Adj R-squared =  0.6781
       Total |  2443.45946    73  33.4720474           Root MSE      =  3.2827

-----------------------------------------------------------------------------------
              mpg |      Coef.   Std. Err.      t    P>|t|     [95% Conf. Interval]
------------------+----------------------------------------------------------------
           weight |  -.0165729   .0039692    -4.18   0.000    -.0244892   -.0086567
c.weight#c.weight |   1.59e-06   6.25e-07     2.55   0.013     3.45e-07    2.84e-06
          foreign |    -2.2035   1.059246    -2.08   0.041      -4.3161   -.0909002
            _cons |   56.53884   6.197383     9.12   0.000     44.17855    68.89913
-----------------------------------------------------------------------------------


Please note, I only have a licensed version of Stata up to version 11 so newer commands are omitted from the package.

If you would like to beta test this package or contribute to mapping additional Stata commands, you can find it and installation instructions at:
github.com/EconometricsBySimulation/RStata

To leave a comment for the author, please follow the link and comment on his blog: Econometrics by Simulation.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.