Benchmarks Online

Skip Navigation Links


Page One

Campus Computing News

New and Improved SkillSoft Online Training Available to Faculty, Staff and Students

Today's Cartoon

RSS Matters

The Network Connection

Link of the Month

WWW@UNT.EDU

Short Courses

IRC News

Staff Activities

Subscribe to Benchmarks Online
    

 Research and Statistical Support - University of North Texas

RSS Matters

Link to the last RSS article here: Using Statistical Software in Classroom Instruction: S-Plus/R, An Accessible, Low Cost Alternative  - Ed.

Stata 9: Stata Reloaded

By Patrick McLeod, Research and Statistical Support Services Consultant

One of the first tasks I performed when I began working in Academic Computing Services as a staff member was packing up all of our Stata 7 stock and shipping it back to Stata Corp in exchange for new Stata 8 merchandise. Stata 8 has served faithfully in the two years since, but as with all things having to do with software, a changing of the guard is upon us. On April 27th, Stata Corp will ship Stata 9 to all who have pre-ordered it and to all GradPlan sites. As a GradPlan Method 3 site, UNT will be receiving our new stock of Stata 9 merchandise (CDs, User Guides and Reference Manuals) early in the last week of April.

What’s New In Stata 9?

The most interesting addition to Stata’s arsenal of statistical tools is Mata, a complete programming language for matrix computations (from http://www.stata.com/stata9/mata.html ):

Mata is a full-blown programming language that compiles what you type into byte-code, optimizes it, and executes it fast. Behind the scenes, many of the new features of Stata 9, such as linear mixed models and multinomial probit, were written in Mata. You can use Mata to implement bit systems, or you can use it interactively.

To enter Mata, type mata at Stata's dot prompt. To exit, type end at Mata's colon prompt:

. mata

 mata (type end to exit)

: sqrt(-4)
.
 
: sqrt(-4+0i)
  2i
 
: end

Mata supports real and complex numbers, binary and text strings (up to 2,147,483,647 characters long), and, for serious programming problems, even pointers!

Mata uses LAPACK routines for its advanced matrix features, such as Cholesky decomposition, LU decomposition, QR decomposition, SV decomposition, eigenvalues and eigenvectors, and solvers and inverters.

Mata supports matrices that are views onto, not copies of, the data. Say you have loaded a dataset of 200,000 observations and 150 variables, and you need a matrix of 80 of those variables in 180,000 of the observations. Rather than requiring 110 megabytes, Mata needs only 640 bytes.

Everybody knows that matrix languages evaluate matrix expressions, such as b=invsym(X'X)*X'y, and Mata is no exception. Because of Mata's design, however, it is fast enough to work at the element level. Here is Mata's polynomial solver:

numeric rowvector polysolve(numeric vector y, numeric vector x)
{
     numeric rowvector  res, c, empty
     real scalar        i, j, n
 
     if (cols(y) != cols(x) | rows(y) != rows(x)) _error(3200)
     if ((n=length(x)) == 0) _error(3200)
     res = (iscomplex(y) | iscomplex(x) ? 0i : 0)
     for (j=1; j<=n; j++) { 
         c = (1)
         for (i=1; i<=n; i++) { 
             if (i != j) { 
                 c = polymult(c, (-x[i],1) :/ (x[j]-x[i]))
             }
         }
         res = polyadd(res, y[j] :* c)
     }
     while (res[cols(res)]==0) res = res[|1,1 \ 1,cols(res)-1|]
     return(res)
}

Much of Mata is written in Mata.

In addition to Mata, there are a slew of .ado additions to Stata’s statistical analyses and some welcome added functionality (my personal favorite is the allowance for multiple .do file editor windows at the same time): Linear mixed models (Two-way models, three-way models, multilevel models, random intercepts, random coefficients), multivariate methods (multidimensional scaling, correspondence analysis, biplots, tetrachoric correlations, procrustean analysis, analysis of proximity matrices), new survey statistics (balanced repeated replications, jackknife variance estimates, multistage designs, poststratification), multinomial probit, probit and tobit with endogenous covariates, zero-truncated Poisson and negative binomial regression, seasonal ARIMA models, stereotype logistic regression, improvements in nonlinear regression estimation, multiple Do-file editors, multiple viewers and tabbed viewing, multiple graph windows, dockable windows, XML support, multiple language label support, and quite a bit more.

For a complete description of the upgrades and additions available in Stata 9, please visit http://www.stata.com/stata9/ .

Upgrading from Stata 7, Stata 8 to Stata 9

Unlike the moving goalposts that were the upgrade requirements from Stata 7 to Stata 8, Stata Corp has provided us with some firm guidelines for upgrading to Stata 9. Anyone who has purchased Stata 8 since January 2005 to the present qualifies for a copy of Stata 9 at the level that they purchased Stata 8 (one-year or perpetual, Intercooled or SE) for the difference in the costs of the two products. For example, a perpetual license for Intercooled Stata 8 costs $129. A perpetual license for Intercooled Stata 9 costs $145. Anyone who has purchased a perpetual licensed copy of Stata 8 from January through the current time would qualify for a perpetual licensed copy of Stata 9 for $16.

I am in communication with Stata regarding other questions I have received in the past regarding Stata (discounts for faculty using Stata in classroom instruction, a new network license for Stata 9 and a new network license for Stat/Transfer 8) and will disseminate this information as soon as I receive it.

I am looking forward to working with all of our UNT Stata users at this exciting time in Stata development!

P.S. If I’m around long enough to write a Benchmarks Online column called Stata: Stata Revolutions for the Stata 10 release and I don’t have a “Ph.D.” after my name (or I am more than a year from having that at the end of my name), someone please kick me out.*

Links


* If Stata decides to release Stata 10 next year, please disregard this message.

Return to top