Sunday, August 25, 2013

A great example of the utility of R

I am in the process of moving over to R as my baseline statistics applications.  Recently I have been working largely in STATA and then moving some results over to R for its fantastic graphic options.  While this has worked, it has significant limitations.  One of the strengths of R is its creation of objects that can be fed automatically into graphics commands (which STATA can also do -- but in a less comprehensive way).

The following blog post is a great example of how R works and the advantages it provides.  After the break, I will have a short commentary on why I think this example illustrates the utility of R so well.

http://rforpublichealth.blogspot.com/2013/08/exporting-results-of-linear-regression_24.html






What I like most about this post is that it shows how R's object-based approach provides some great strengths.  With so many objects created by the fit commands, you can really customize what you are doing with the statistics and in the presentation of the results.  Of course, you do need to know a little about statistics to understand what R is doing -- which I see as a feature.  In this simple example, you have to understand why pulling the diagonal of robust covariance matrix gives you the robust standard errors.  Notably, you don't have to actually do the matrix multiplication (there is a package in the example that does it for you), but you could.

The collection of objects then makes creating publication-quality tables relatively easy.  From such an approach, true reproducible research (where you embed all of the analysis into the report for automatic updating and external reproducibility) is within reach.  I am not sure I will get there -- but I am getting more interested in the approach.

1 comment: