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 [...]
Archives for the ‘Stata’ Category
Benchmarks
Wednesday, 17 October 2012
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 [...]
Pushing circles around
Friday, 13 July 2012
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 [...]
Do-file rules, revisited
Tuesday, 22 May 2012
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 [...]
Stata for stocks
Tuesday, 20 March 2012
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 [...]
Turn a date into Stata format quickly
Sunday, 18 March 2012
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 [...]
Human rights stats, part 1
Saturday, 3 March 2012
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 [...]
Stata 12 with MacVim, updated
Monday, 27 February 2012
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.
A quick tip for using Stata in interactive mode
Wednesday, 8 February 2012
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 [...]
How many zeroes in that Poisson?
Thursday, 26 January 2012
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 [...]