An R-squared for logistic regression, packaged

This morning I checked Paul Allison’s Statistical Horizons blog and found a post on measures for logistic regression. It introduced me to Tjur’s by way of an example, which I repackaged below: // Reference: http://www.statisticalhorizons.com/r2logistic // program definition capture prog drop tjur2 program tjur2, rclass if !inlist(e(cmd),”logit”,”logistic”) { di as err “Tjur’s R-squared only works [...]

Continue reading An R-squared for logistic regression, packaged

Benchmarks

I went googling for some examples of quadratic programming done in Mata, and stumbled across a fairly recent Statalist discussion. The original question is here and the official response, typically prompt, is here. I tested Patrick Roland’s code on my own machine (2011 MacBook Pro Core2 i5) but with Octave instead of MATLAB, and with [...]

Continue reading Benchmarks

Pushing circles around

Occasionally, a need comes up for drawing a circle. Say you have a scattershot of points that follow a bivariate normal distribution, and you want to illustrate being within a given radius inside that scattershot somewhere. You will want to draw a circle so you can use its functional form to isolate the dots that [...]

Continue reading Pushing circles around

Do-file rules, revisited

Back in 2009 I wrote this post, detailing what at the time I thought would be a good way to write do-files. Some of the ideas there have stood the test of time. Others haven’t. The changes are driven by Stata’s evolution, by new things I’ve learned and by ways that my work changed. This [...]

Continue reading Do-file rules, revisited

Stata for stocks

NFLX

The people at StataCorp are on Facebook, and the other day they linked to this blog post by Paul Clist about checking on a stock you might own through clever use of the stockquote Stata command. Last year I bought some Netflix stock when it fell to $77 after the Qwikster fail. I agreed with [...]

Continue reading Stata for stocks

Turn a date into Stata format quickly

There’s a little program that’s shown up more than once now in my housekeeping do-files, so it may be useful enough for a blog post, but it doesn’t quite warrant a spot in c(sysdir_personal) as a stand-alone ado-file. Here: // turn this date to Stata format // if it’s not that way already capture prog [...]

Continue reading Turn a date into Stata format quickly

Human rights stats, part 1

I follow @simplystats on Twitter, and on March 1 they had a post that linked to an article in Foreign Policy about a guy who has the coolest job in applied stats. He works here. The original piece described a quick algorithm that you can use to estimate the number of human rights violations using [...]

Continue reading Human rights stats, part 1

Stata 12 with MacVim, updated

A while back I showed how to get Stata 12 to work with MacVim. This is to let you know about a bug fix. I posted the details on the Statalist just now. If you’re reading this blog and you’re not also a Statalist subscriber, you may want to change that.

Continue reading Stata 12 with MacVim, updated

A quick tip for using Stata in interactive mode

You don’t always want to start a do-file in the editor for every small thing, though I usually do, and then trash it if I don’t need it. So, my default stance is that I want to preserve work for later. Yours may be the opposite. If so, one option is to type in the [...]

Continue reading A quick tip for using Stata in interactive mode

How many zeroes in that Poisson?

I have a data set, and some of the variables there are counts of a given event. Four count outcomes, the easiest thing to do is a Poisson regression, but before you do that, it’s worth asking if what you see there really is close enough to a Poisson process. You could check whether the [...]

Continue reading How many zeroes in that Poisson?