jackman.stanford.edu/blog
• Bayesian Analysis for the Social Sciences Wiley; Amazon; errata as of 5/23/13

• 113th U.S. Senate
• ideal point estimates pdf csv 7/17/14
• scatterplot against 2012 Obama vote share pdf
• roll call object: RData
• 113th U.S. House
• ideal point estimates pdf csv 7/18/14
• scatterplot vs Obama vote share pdf d3/svg
• roll call object: RData

## Saturday July 26, 2008

Filed under: flight nerdery,general — jackman @ 4:04 am

So prompted by Kieran’s comment, here are some shoot-from-the-hip reactions to the QF30 incident.

They seem very lucky that whatever caused that hole didn’t make a bigger hole (a la UA811) or send debris into the engine intake.

They’re also very lucky to have had a reasonably quick diversion option (Manilla); as a veteran trans-Pacific flier, I do sometimes wonder about what would happen if something bad happened in the region, say, between Fiji and Hawaii, or even between Hawaii and the mainland US: there’s really not a lot of good options there. The Jo’berg – Perth/Sydney Qantas flights would seem to pose a similar kind of challenge. UA811 suffered its explosive decompression about 16mins out of HNL; Aloha 243 suffered its event 23 minutes out of Hilo bound for HNL, and landed at Kahului 10mins later. It appears that QF30 experienced its decompression event an hour after take-off, with the landing at Manilla occurring an hour after that.

We arrived in Sydney this morning to news of the incident all over the Australian media. As we waited for our Virgin flight to Brisbane, we started talking about the mishap with another passenger. He said “well, the plane is ancient, built in 1991″. I laughed.

“There are plenty of planes in service that are that old,” I said.
“Yeah, in Russia.”
“No, in the United States”.
“Same thing”.

Laughs all around.

And in fact, N179UA, our 744 for UAL863 SFO-SYD 2008-07-24 was built in 1991, the same year as VH-OJK (the QF 744 in question).

I did hear one media report (on Sky News) saying that an oxygen cannister might be the culprit, consistent with a hazardous cargo/explosive event explanation; better that for Qantas, that the “poor maintenance”/”history of corrosion” theory that is getting a run here and there.

The New York Times report (of course) couldn’t help but refer to Dustin Hoffman’s Rainman Qantas rant.

## Thursday July 24, 2008

Filed under: computing — jackman @ 10:51 pm

Wow, so this wordpress for iPhone app seems like it might actually work.

Greetings from UA 863, waiting to push back from gate 94 at SFO.

## Wednesday July 23, 2008

Filed under: general — jackman @ 1:12 pm

This was really helpful. I often find myself screaming “forward” at the TV while watching rugby.

And I’ll be in Australia watching Australia play New Zealand on Saturday night (game is in Sydney, I’ll be in Brisbane with male kin, screaming at TV etc).

## Monday July 21, 2008

Filed under: politics,statistics — jackman @ 10:12 am

Dan Pinello at CUNY is rallying support for a boycott of the 2012 APSA meetings in New Orleans. Chief reason:

A 2004 amendment to the Louisiana Constitution denies marriage and “the legal incidents thereof” to same-sex couples

New Orleans is Not Gay-Friendly. A principal argument of many who advocate for the New Orleans conference is that the Crescent City is gay-friendly. But what evidence is there of that assertion?

For instance, Louisiana did not force the 2004 state constitutional amendment on an otherwise gay-relationship-tolerant Big Easy. Rather, 55 percent of voters in Orleans Parish approved the antigay provision.

I get the argument, but on balance I find myself coming down on the side of the decision to go to New Orleans.

The point of this blog post is to draw attention to some “over-reach” in the email Dan sent around. He says:

Well over 150 political scientists — including a former APSA
President, a former Vice President, former Council members, and a
former APSR Editor — have signed the document since it went online a
week ago. So far, the most LGBT-friendly schools are:

Oberlin College — 10 endorsers / 83% of the Oberlin department
Johns Hopkins University — 8 / 40%
College of William & Mary — 6 / 25%
University of Chicago — 5 / 17%
University of California-Irvine — 4 / 13%

The presumption that rates of expressed support for this boycott is a valid indicator of a Department’s “LBGT-friendliness” is a little strong. I emailed this observation to Dan, to which he replied:

No more so than the Association’s use of travel agents as experts to determine that New Orleans is “gay-friendly.”

Fair enough. But does one faulty inference mean another is warranted? Fight fire with fire, and all that, this is politics after all. But I can see reasonable people, reasonable “LBGT-friendly” people, disagreeing on the question of a New Orleans boycott.

## Saturday July 12, 2008

Filed under: computing — jackman @ 10:13 pm

Looks nice, looking forward to the real-time syncing across all my Mac platforms.

## Friday July 11, 2008

Filed under: computing — jackman @ 10:41 am

I am usually very happy with my now top-to-bottom Apple experience: since switching in 2000, I now own an Xserve, a MacPro, multiple MacBooks accumulated over the years, and an iPhone.

But today’s screw-up with the servers is very poor form by Apple (see also engadget and cnet), and do I wonder how the fanboy bloggers will spin this. John Gruber urged patience. Thanks for that.

You can’t prime the pump with massive hype about the new iPhone, the update to iPhone 2.0, the App store, MobileMe etc, and then have the phones essentially bricked because the wave of activations/updates can’t be handled by your servers. The people out there getting screwed today are (were?) your most enthusiastic/zealous customers.

Observations:

The App store was inaccessible at various times yesterday, and MobileMe was saying it was up, but I couldn’t access my account or iDisk due to what seemed like server overload. MobileMe is accessible from my System Prefs today.

There was plenty of blog traffic yesterday on alternative, unofficial locations for grabbing the iPhone 2.0 server update. That might be another way to go if the Apple server dramas continue.

## Tuesday July 8, 2008

Filed under: computing,statistics — jackman @ 5:18 pm

So this is an interesting gotcha in R (or at least I thought so). Suppose you have an object of class foo, where the “class” here is a class in the S3 sense. So you create a print method for the foo class, by writing a function print.foo. You create an object y, that has class foo. You pass that object to the print method. You’d like print to be able to say something like

Hello world, my name is y

Damned if I could write a print.foo function that would do that.

Here is one of my failed attempts:

> y <- 1:10
> class(y) <- "foo"
> print.foo <- function(x)
cat(paste("Hello world, my name is",
deparse(substitute(x))))
> y
Hello world, my name is structure(1:10, class = "foo")


You can see that I’ve tried to have object y print itself, so the generic print function has called print.foo to do that, but with the deparse(substitute(x)) trick not working the way it usually does.

On the other hand:

> myprint <- function(x)cat(paste("Hello world, my name is",
deparse(substitute(x))))
> myprint(y)
Hello world, my name is y


which is the desired behavior.

print is a generic function, which uses UseMethod for method dispatch:

> print
function (x, ...)
UseMethod("print")



So the object y gets handed down to print.foo from the generic print function via UseMethod. This is getting into parts of R that I don’t fully understand, but it looks like UseMethod is evaluating the object y before passing it down to print.foo. Hence substitute doesn’t work as it (usually?) does. Weird.

On the other hand, check out this:

> summary.foo <- function(object){
cl <- match.call()
z <- list(call=cl)
class(z) <- "summary.foo"
return(z)
}

> print.summary.foo <- function(x)
cat(paste("Hello world my name is",x$call$object,"\n"))

> summary(y)
Hello world my name is y


Update (after talking with Jan de Leeuw):

Jan points out that for the example above print(y) works as it should. The issue seems to be related to the way R’s command line parser works. The documentation (the R Language Definition) says its a “read-eval-print loop”. Which prompted Jan to say that “the question is really if an object evaluates to itself”.

## Monday July 7, 2008

Filed under: flight nerdery — jackman @ 6:31 pm

5 weeks, 43,000 miles. Not especially looking forward to any of it, although SIN-LHR-SIN will be in a SQ A380. All the US originating or US bound stuff is UAL (awful Y class experience in their 744s SFO-SYD-SFO, even C class leaves a lot to be desired).

### ideal point estimation and memory usage

Filed under: computing,statistics — jackman @ 10:23 am

Some recent traffic on R-SIG-Mac. Its not really a Mac problem, but worth a thought.

MCMC has the potential to violate one of the first objectives of statistics, and that is to take a big pile of numbers and make a smaller pile of numbers. Since you can try to run/save as many MCMC iterations as your computer can store (or can’t store, see below), you can easily wind up with a bigger pile of numbers than you started with. Hence, some wisdom needs to come into play. To wit:

What I’m doing is very simple: I’m running an one dimensional item
response model, similar to the ones use in psychology and educational
testing data via Markov Chain Monte Carlo Methods.

model_m12<- ideal(rollcall_m2, maxiter = 500 000 000, thin = 1000,
burnin = 5000,
store.item = TRUE, normalize=T,
priors=list(xp=1e-12,xpv=1e-12,bp=1e-12,bpv=1e-12), verbose=T)

# my data matrix is provided by the rollcall object, but it has just
155*17 dimensions: rollcall_m2

# the number of interactions [iterations - SDJ] is maxiter/thin= 500,000

# store.item=true is the main source of the problem: it’s store the
discrimination
# parameter, which consumer a large amount of memory.
Unfortunately, I need this information.

So, if R can access up to 3.5 Gb how can I fix the problem. I’m sure
lot’s of mac users will be also interested in increasing its memory
allocation capabilities in R.

I would wonder about the need for 500000 MCMC samples.

Also I assume 17 discriminant parameters so 500000*17*8=68M or 136M
with the difficulty, which seems much less than 1.2G.

Ken

To which I replied

Hi

I am the author of the pscl package in which the ideal() function
resides.

I agree that 5e8 iterations seems like an awful lot, even thinned by
1e3 down to 5e5 stored iterations. I’d try thinning that out some
more, if you really need that many iterations. I’ve seen some of
these rollcall data that do require many iterations to get the
standard MCMC convergence diagnostics to look reasonable: e.g., the
item parameters for very lop-sided rollcalls, or the latent trait for
a legislator/test-taker with an “extreme” voting history/response
profile. But even there I’d say “many” \approx 1e6, and there is
certainly no need to save them all.

also, do note that there is an option in the ideal() function to dump
the output of the MCMC algorithm to file, rather than trying to store
it all in memory: see ?ideal and the file argument. If you are
generating a massive amount of MCMC output this option might help you
manage it in a more sane way (say, summarizing it in chunks, either of
the parameters or of the saved iterations, etc).

and not a R-sig-mac point, but alternative parameterizations can help
with these very slow mixing analyses: but at that point you’re looking
at BUGS/JAGS and friends.

Regards

– Simon Jackman

## Tuesday July 1, 2008

Filed under: Australian Politics,politics — jackman @ 3:14 pm

Wearing a T-shirt that the NSW police don’t like might get you arrested, in and around World Youth Day, an event organized by the Catholic Church that will see the Pope coming to Sydney etc. Unbelievable. SMH, ABC, and according to The Australian, “Strip searches okayed for WYD“.

Julian Morrow from the Chaser tells it how it is. Maybe I’ve lived in the United States under the protection of the 1st amendment for too long, but the whole thing is outrageous. As Morrow hints, one wonders if the police will be intelligent in the way they choose to enforce/ignore these restrictions.

And its lovely legal footwork by the NSW government as well. None of this went through Parliament, at least in this form. These are regulations that were gazetted on June 25, declaring many Sydney area locations as “a World Youth Day declared area”. The cover sheet from the relevent section of the Gazette appears below as a thumbnail (click to enlarge); PDF available here or excerpt here.

The language is remarkable: the regs empower

police officers and authorised members of the State Emergency Service and
the Rural Fire Service to direct a person within a World Youth Day declared area to
cease engaging in conduct that is a risk to the safety of the person or others, causes annoyance or inconvenience to participants in a World Youth Day event or obstructs a World Youth Day event

“Causes annoyance”?!?