Results matching “R”

Alex Tabarrok has an interesting discussion of saving strategies. Alex writes:

There are people who don't save much because they have very low incomes, their behavior does not seem to be in error, especially when we take into consideration the various welfare programs that will cover people in their old age. . . . So let's focus on people with moderate to high incomes. . . . Over confidence and in particular the idea that we are special and will live a long life suggests the error is saving too much. . . . Availability bias probably also suggests we save too much - we see people who saved too little in the street but the ones who saved too much are dead and gone. . . . I do not know which error is more prevalent but if we are to be neither spendthrift nor miser we need to recognize both types of error.

My guess is that Alex is a little too optimistic about people's savings strategies, given all the credit card debt out there. Also, as some of his commenters note, it's easy for people to get used to a particular spending pattern, and it's easier to ramp it up than to scale it down. So, for psychological purposes, it might be better to plan for a gradually increasing standard of living than something completely flat over time.

But I'm sympathetic with Alex's general point that both kinds of errors are relevant. It reminds me of when I asked the students in my decision analysis class to raise their hands if they'd never missed a flight. I then said to them: You go to the airport too early! A retrospective rather than a prospective analysis but still essentially correct, I think.

Imputation for longitudinal data

Rey De Castro writes:

I have a longitudinal data set that needs imputation, but the problem doesn't seem to resemble a typical imputation situation. So I'm casting about for a reasonably defensible approach that I can implement without tremendous custom-programming effort. My question concerns Bayesian approaches to imputation.

The Situation: I have longitudinal data for each of a group of schoolchildren. Each observation in the series is a multilevel class indicator of several canonical locations (i.e., indoor-home, indoor-school, outdoors, commuting) where the child reported being present during a particular 15-minute interval. Essentially, it's a series giving each child's location over time at 15-minute intervals. There are ~100 children, and each child's series is very long: ~2000 observations.

Video of Zoubin Ghahramani's lecture

Tutorial for writing R packages

Alan Lenarcic sent along this. He writes, "The amount of strange Windows settings you have to set is a little daunting."

The American (League) Dynasty

Every year, the best players (or at least many of the best players) from Major League Baseball's American League play their counterparts in the National League in the All-Star Game. They played last night; the American league won in the 15th inning. Here's who won, from 1965 (when I was born) to the present, with 1965 at the left and 2008 at the right.

NNNNNNNNNNNNNNNNNNANNANAAAAAANNNAAAAATAAAAAA

The "T" indicates a tie (in 2002): unlike regular games, there is no requirement that the All-Star Game continue until somebody wins, and pitchers are reluctant to pitch too many innings and potentially hurt themselves.

I was born into an era in which the National League won every game. Now, the American League wins (or, at least, doesn't lose) every game. This is happening in a sport where even bad teams beat good teams occasionally, so it's really mystifying. It would be possible to explain a small edge for one league or the other, that persists for a few years --- the league with the best pitcher will have an advantage, for example, and that pitcher can play year after year --- but these effects can't come close to explaining the long runs in favor of one team or another. Predicting next year's winner to be the same as this year's winner would have correctly predicted 80% of the games in my lifetime...and that's if we pretend the National League won the tie game in 2002. (If we pretend the American League won it, it's 84%).

What would be a reasonable statistical model for baseball All-Star games, and why isn't it something close to coin flips?

R is too strongly typed

I fit a multilevel model in R and called it M2, then innocently put together some coefficients in order to make a prediction:

a.hat <- fixef(M2)["(Intercept)"] + fixef(M2)["u.full"]*u + ranef(M2)$county

Then I tried

a.hat[26]

and got the following response:

Error in `[.data.frame`(a.hat, 26) : undefined columns selected

OK, OK, I had to go back and change the original line to:

a.hat <- fixef(M2)["(Intercept)"] + fixef(M2)["u.full"]*u + unlist (ranef(M2)$county)

This is a pain, because sometimes it's "as.vector," sometimes it's "as.numeric," sometimes it's something else. It's so hard sometimes to just access the data. R is so strongly typed now that I have to waste a lot of time simply extracting things from objects that I already have sitting in memory.

Dept of silly graphs

Bill Harris points to this:

directv.png

Bill writes:

I've always felt that Joe Queenan has gone straight downhill since "If You're Talking to Me, Your Career Must Be in Trouble," but, following this link from Fabio Rojas, I see an interesting recent article from Queenan. I didn't know he did serious stuff too. (Yes, I know that Queenan's claims are debatable--in particular, I'm not sure where he would put fit Stravinsky's work (up to the mid-1920s) in his system--but he makes interesting points.) Mainly, I'm just interested to see that he's writing something closer to his earlier standards.

What is faster, Winbugs or Openbugs?

Sandra McBride writes:

My current model (in Winbugs) runs very slowly on my very slow laptop, so I am getting a new desktop. Here are some questions in the hopes of speeding up my model:

Is Winbugs or Openbugs multithreaded? (Then I'd buy a quad core rather than a duo core)

When using from within R, is Openbugs faster than Winbugs in general?

My reply: I don't know, but I've heard that JAGS is the fastest. I'm not sure if R2WinBUGS is set up to run JAGS, but if not, it could be done (right, Yu-Sung)? Also, I would think that in a parallelized implementation of R, it would be straightforward for R2WinBUGS to run 4 chains and send one to each of 4 processors; however, I don't know that this has actually been implemented.

In any case, I'm hoping that not too far in the future we'll have some a version of Bugs that is much faster, at least for the sorts of hierarchical regression models that Bugs currently chokes on.

"Frenchman"?

Do people really still use this word? From the context, Cowen appears to be using it to mean "French person" rather than "French man," so maybe he is being ironic? I admit to some nostalgia for various old-fashioned ethinic descriptors that aren't exactly offensive but still don't really get used anymore, such as Chinaman, Jewess, Turk. Something like an old Sam Spade novel where "the Turk" comes out of an alley with a knife, or whatever. Recently I've been hearing Latinos (Hispanics) refer to themselves as "Spanish," which is kind of cool.

OK, time to get back to work.

Popularity and readability

Seth had this discussion where he quoted Nassim Taleb's Black Swan book, to which someone commented that Taleb's books are "unreadable," to which Seth responded:

If The Black Swan is “so unreadable” why has it been so popular?

Now this is an interesting question. Not so much about The Black Swan (which I liked) but about the more general question of whether a bestseller must be readable. Obviously, readability helps, but are popular books "readable"? I can think of two issues:

1. Books such as "A Brief History of Time" or, to take Michael Kinsley's famous example, "Deadly Gambits," which people buy but never get around to reading.

2. Books which seem supremely readable when they come out but don't age well. A lot of bestsellers are like that, I imagine. If you go back to a bestseller list from decades ago, I think you'd see books that would not be so easy to read today. What I'm getting at is that "readability" is not just a property of the book, it also depends a lot on the reader.

Vector autoregression

Yefin Dain writes:

Integrate this, pal

socparticles.png

I copied this image over here, certain that I'd be able to add a witty remark of my own, but I give up.

538

Julie Rehmeyer has a nice article up about Nate Silver's election models. A nice motivator for all the quantitatively minded students out there.

Opening Day

Nathan Yau writes,

I recently put up a visualization showing the spread of walmarts over time, ... I'm wondering if you know of any other "opening dates" data (starbucks, for example)? I'm itching to put some more data into my code.

Here are some hilarious (if you're a statistician) sketches from Stephen Senn:

Robustnik "These are the three laws of robustics. First law: get a computer. second law: get a bigger computer. Third law: what you really need is a much bigger computer." Favourite reading: I Robust, by Isaac Azimuth.

Frequency Freak
" Did you randomise? OK: so far so good. Now what would you have said if the third value from the left had been the second from the right. Hold on a minute. Are you sure you haven't looked at this question before?" Favourite reading: Casino Royale.

Bog Bayesian
" All you need is Bayes. It's the answer to everything. If only Adolf and Neville could have exchanged utility functions at Munich we could have saved the world a whole lot of bother round about the middle of the last century." Favourite reading: The Hindsight Saga.

Subset Surfer
"OK, so the egg's rotten but parts of it are excellent." Favourite reading: Europe on $5 a day.

Gibbs Sampler
" First catch your likelihood. Take one Super Cray, a linear congruential generator, any prior you like and if the whole thing isn't done to a turn within three days my name's not Gary Rhodes." Favourite reading: Mrs Beaton

Complete Consultant
" First we test the randomisation. Then we look for homogeneity between centres. Then we run the Shapiro-Wilks over it and if you like we'll throw in a Kolmogorov-Smirnov at no extra cost. Then we test for homogeneity of variance and look for outliers and even if that's OK we'll do a Mann-Whitney anyway just to be on the safe side. All this will be fully documented in a report with our company logo on every page." Favourite reading: The Whole Earth Catalogue.

Mr Mathematics
"I just don't see the problem. All you have to do is define the null hypothesis precisely, define the alternative hypothesis precisely, choose your type I error rate and use the most powerful test." Favourite reading: Brave New World.

Bootstrapper
"Look, this is the way to build the football team of the future. You choose a player. You put him back in the pool. You choose again. Do that long enough and if you don't eventually get a team which has Becks in it three times my name's not Sven Goran Erikson." Favourite reading: Bradley's Shakksperrr.

Unconditional Inferencer
"It's true that all the engines are on fire and the captain has just died from a heart attack but there's no need to worry because averaged over all flights air travel is very safe." Favourite reading: Grimm's Fairy Tales

And many more:

Bovine contentment, then and now

In the Playroom today, I came across a book called "A Design for Scholarship," a collection of speeches from 1935-1936 by Isaiah Bowman, president of Johns Hopkins University. Flipping through, I came across this quote:

If you wish to live in bovine contentment, the University is no place for you.

Things sure have changed, huh?

The Graduate Junction

Esther Dingley sent an email about this site which is intended to help graduate students share research ideas. I'm not sure where it falls in the spectrum from Facebook to Wikipedia, but perhaps it will be useful. Looking up some of my own research interests, I found nothing for "statistics" or "political science," but there was a group for "social networks."

More graphical propaganda

John Sides reproduces this graph showing Kenyan election results:

kenyaexitpoll.PNG

What a horrible graph! The re-coloring and re-ordering of the wedges makes the difference between "official results" and "poll" seem much greater than they are.

As in my earlier example of PDA (propaganda data analysis), I have no comments on the merits of the case (for example, what can you learn from a poll taken six months after the election)--I'm just weighing in on the graphical presentation.

Multilevel models with interactions

John Kastellec writes:

Let's say you wanted to estimate a multilevel model with an interaction in the individual-level model, say:

Pr(y=1) = logit-1(B0 + B1X + B2Z + B3XZ)

and you wanted to allow the interaction effect to vary by group. Would the correct procedure be to allow all the coefficients to vary by group, then interpret the main and interactive effects as you would normally (i.e. for each group)?

Yup.

David Ross writes,

Capital punishment and recidivism

Greg Mankiw writes,

Cass Sunstein and Justin Wolfers say we don't really know whether or not capital punishment deters crime.

Maybe so, but it does solve the problem of recidivism.

He links to a news article that refers to an excellent article by Wolfers and Donohue. But I don't think Mankiw is correct about capital punishment solving recidivism. A key aspect of the death penalty in the U.S. is how rare it is for prisoners to actually be executed. I don't see how you solve the problem of recidivism by executing on the order of a hundred people a year. And, given that already our best estimate is that a person who is sentenced to death has a two-thirds chance of having that sentence reversed by a higher court, it's hard for me to believe that the rate of executions can be increased very much.

Henry presents another example of more educated voters being more ideological:

Graph of inequality by political information

The above graph (from Larry Bartels) shows the probability that liberals or conservatives agree with the statement that income inequality between rich and poor people has increased. The two groups diverge in their attitudes as they get more information.

Democrats can get things wrong, too

The above is an example where conservatives with high information levels get things wrong. Just as balance, here's an example (also from Larry Bartels) where Democrats are the ones in error. The example is in chapter 8 of our forthcoming red state, blue state book:

Even objective features of the economy are viewed through partisan filters. For example, a survey was conducted in 1988, at the end of Ronald Reagan’s second term, asking various questions about the government and economic conditions, including, “Would you say that compared to 1980, inflation has gotten better, stayed about the same, or gotten worse?” Amazingly, over half of the self-identified strong Democrats in the survey said that inflation had gotten worse and only 8% thought it had gotten much better, even though the actual inflation rate dropped from 13% to 4% during Reagan’s eight years in office.

Regroove

Stephen Burt's recent article on Philip K. Dick was quoted with approval by Jenny Davidson, but I wasn't impressed. For one thing, Jack Isidore regrooves tires, he doesn't retread them. Also, I don't think Burt did a good job at addressing how funny Dick's books are--even Scanner, which is so serious, is also hilarious. Finally, I don't get the bit at the end of Burt's essay where he speculates on other science fiction writers whose work could be collected in the Library of America. Maybe Dick would be better characterized with authors such as James Jones who create recognizable worlds using whatever literary tools they happen to have at hand.

P.S. Link above fixed.

In response to some of the questions about our graphs on state liberalism/conservatism:

- A lot of surveys don't include Alaska and Hawaii. I guess in the days of face-to-face surveys these places were too far to go to, and even for telephone surveys you have to deal with time zones.

- I can't remember the sample sizes, but in the small states they're not huge, so you can't take seriously the exact ordering of all the states in the graphs. When David gets back in town we can take a look at the uncertainty in these estimates.

- Could we look at dispersions as well as averages within each state? Yes, but I don't know that we'd get much out of this; dispersion measures are notoriously noisy.

- We show positive numbers as conservative and negative numbers are liberal because the number line goes from left to right.

- Yes, it would be interesting to look at other issue dimensions such as foreign policy.

- Some people asked what exactly was in our scales. From page 195 of our red-state, blue-state book:

Andrew Sullivan links to this news article which links to this research article by Stamos Karamouzis and Dee Wood Harper called "An Artificial Intelligence System Suggests Arbitrariness of Death Penalty":

Matching with multilevel data

Chris Weiss writes with a question about propensity score matching with multilevel data:

How to set tuning parameters

Here's the title/abstract for my talk at the R conference in August:

Many statistical methods of all sorts have tuning parameters. How can default settings for such parameters be chosen in a general-purpose computing environment such as R? We consider the example of prior distributions for logistic regression.

Logistic regression is an important statistical method in its own right and also is commonly used as a tool for classification and imputation. The standard implementation of logistic regression in R, glm(), uses maximum likelihood and breaks down under separation, a problem that occurs often enough in practice to be a serious concern. Bayesian methods can be used to regularize (stabilize) the estimates, but then the user must choose a prior distribution. We illustrate a new idea, the "weakly informative prior," and implement it in bayesglm(), a slight alteration of the existing R function. We also perform a cross-validation to compare the performance of different prior distributions using a corpus of datasets.

The title is "Bayesian generalized linear models and an appropriate default prior," and it's based on this paper with Aleks, Grazia, and Yu-Sung.

Patent absurdity

Jouni writes,

Here is a link (see also here) to a patent on Bayesian linear regression. Yes, they call their algorithm an "invention."
A simple yet powerful Bayesian model of linear regression is disclosed for methods and systems of machine learning. Unlike previous treatments that have either considered finding hyperparameters through maximum likelihood or have used a simple prior that makes the computation tractable but can lead to overfitting in high dimensions, the disclosed methods use a combination of linear algebra and numerical integration to work a full posterior over hyperparameters in a model with a prior that naturally avoids overfitting. The resulting algorithm is efficient enough to be practically useful. The approach can be viewed as a fully Bayesian version of the discriminative regularized least squares algorithm.

Now, hurry up and patent Bayesian nonlinear regression before they do it.

Jouni continues:

Maybe we all should be submitting our papers to the patent office instead of journals? Perhaps they would probably be more easily accepted?

It's all fun and games until they sue your a$$. . . .

Little blogs and big blogs

In our blog we get useful comments about R programming, data sources, the philosophy of science, and even suggestions for book covers. But every now and then we get mentioned by big blogs, and then I'm reminded what real blog commenters are like.

Sudhir Venkatesh mentioned us in the Freakonomics blog. Among the 27 comments were:

A legal mystery

Maybe someone can explain this to me?

Our publisher is putting together our new book (no, not Red State, Blue State, I'm talking about our next book, A Quantitative Tour of the Social Sciences), and we need a cover design. Now. Any ideas? Free book to the person with the best idea. And anybody with a particularly good idea, I'll take to lunch. (Or maybe Jeronimo, my coeditor, will take you to lunch if you're in Houston...)

Some background: The book has sections on history, economics, sociology, political science, and psychology, and each section has a different author (or set of authors). It's not a statistics book; rather, it's a set of discussions and case studies, giving the reader (most likely a student of one of the social sciences) a sense of how to think like a historian, economict, sociologist, etc. It's based on a course I created for our Quantitative Methods in Social Science program at Columbia. Anyway, there will be plenty of time for book promotion later; now, I'm just trying to give you enough information to come up with a good cover design for us.

Here's the table of contents:

Here's a graph of the 50 states (actually, I think Alaska and Hawaii are missing), showing the average economic and social ideology of adults within each state. Each of these is scaled so that negative numbers are liberal and positive are conservative; thus, people in Massachusetts are the most liberal on economic issues and people in Idaho are the most conservative:

econ.soc.all.png

West Virginians are on the liberal side economically but are extremely socially conservative, whereas Vermont is about the same as West Virginian on the economic dimension but is the most socially liberal of all the states. Coloradans are economically conservative (on average) but socially moderate (or, perhaps, socially divided; these are averages only).

How do these rankings fit with our usual rankings of states? Here's a plot showing average economic and social ideology for each state, plotted vs. George W. Bush's vote share in 2000:

econ.soc.vote.png

Democrats and Republicans separately

The next step is to break these voters down into Democrats and Republicans (based on self-reported party identification and following the usual practice among political scientists of throwing the "leaners" into the regular party categories). In the graph below, each state is shown twice: the avg social and economic ideologies of Democrats in the state are shown in blue, the avgs for Republicans in red.

econ.soc.png

We made these graphs during the primary election season, and one thing we noticed was that South Carolina ("SC") is in the middle of the pack among Democrats and among Republicans, but it's one of the most conservative states overall. My take on this: South Carolina is a strongly Republican state, and the moderates in South Carolina are likely to identify as Republican. This pulls the Republican average to the left (as they includes the moderates) and also pulls the Democratic average to the left (as they are not including so many moderates).

But the big thing we see from the graph immediately above is that Democrats are much more liberal than Republicans on the economic dimension: Democrats in the most conservative states are still much more liberal than Republicans in even the most liberal states. On social issues there is more overlap (although in any given state, the average Republican is more conservative than the average Democrat).

Details on data

David Park and I made these graphs from the Annenberg pre-election survey from 2000 (with its huge sample size), creating indexes based on issue opinions, giving each respondent an economic and social ideology score. We scaled these so that each had a national average of 0 and standard deviation of 0.5. (We used these scales in our Red State, Blue State book, but these particular graphs never made it into the book.)

P.S.

Yes, I know the graphs could be better. We made them a few months ago and haven't organized them into any final form.

P.P.S. More info here.

Paternalistic software

This is ok, but I like my solution better.

John Cook's theory of why the t distribution was discovered at a brewery:

Beer makers pride themselves on consistency while wine makers pride themselves on variety. That’s why you’ll never hear beer fans talk about a “good year” the way wine connoisseurs do. Because they value consistency, beer makers invest more in extensive statistical quality control than wine makers do.

(On the other hand, Seth thinks that "ditto foods" are so late-twentieth-century, and that lack of uniformity in taste is ultimately healthier.)

Ubs writes:

A TV journalist's career success is strongly correlated to how well-known he is to the audience, which in turn is strongly correlated to how much face time he gets. When you watch an interview on TV, if most of what you see are is person being interviewed, you won't remember the journalist so much. If more of your time is devoted to watching and hearing the interviewer talk, he'll be more recognizable next time. The latter probably does not make for a better interview, but it does make for a better chance of the journalist getting more gigs.

See here.

Recent changes in arm (arm > 1.1-8)

There are some changes in arm. Most of them are related to the big changes lme4 has made. If your arm version number is > arm_1.1.8, then you might want to read the followings (or if you are a reader of Data Analysis Using Regression and Multilevel/Hierarchical Models, you should read this):

Drew Conway pointed me to this article by Chris Anderson talking about the changes in statistics and, by implication, in science, resulting from the ability of Google and others to sift through zillions of bits of information. Anderson writes, "The new availability of huge amounts of data, along with the statistical tools to crunch these numbers, offers a whole new way of understanding the world. Correlation supersedes causation, and science can advance even without coherent models, unified theories, or really any mechanistic explanation at all."

Conway is skeptical, pointing out that in some areas--for example, the study of terrorism--these databases don't exist. I have a few more thoughts:

1. Anderson has a point--there is definitely a tradeoff between modeling and data. Statistical modeling is what you do to fill in the spaces between data, and as data become denser, modeling becomes less important.

2. That said, if you look at the end result of an analysis, it is often a simple comparison of the "treatment A is more effective than treatment B" variety. In that case, no matter how large your sample size, you'll still have to worry about issues of balance between treatment groups, generalizability, and all the other reasons why people say things like, "correlation is not causation" and "the future is different from the past."

3. Faster computing gives the potential for more modeling along with more data processing. Consider the story of "no pooling" and "complete pooling," leading to "partial pooling" and multilevel modeling. Ideally our algorithms should become better at balancing different sources of information. I suspect this will always be needed.

rps

Eddie Randolph writes,

I was wondering if you had any thoughts on the World Rock Paper Scissors Contest currently being held. Do you think it will be won by someone who plays intuitively, or a master strategist? If you think the strategist will win, do you think they will employ strategies from the book you pointed to in your blog?

My reply: I love rock-paper-scissors but I'm afraid I have no deep theories. I'd guess that it's pretty random, that whoever wins one year wouldn't have much better than a random chance of doing well the next year.

The popularity of statistics?

Jennifer pointed me to this site, which states that "white people hate math" but "are fascinated by 'the power of statistics' since the math has already been done for them." I'd like to believe this is true (the part about white people liking statistics, not the part about the math having already be done to them) but I'm skeptical. Everywhere I've ever taught, there have been a lot more math majors than stat majors, and I'm pretty sure this is true among the subset of students who are white. But it might be true that the business majors, the poli sci majors, the English majors, etc.--not to mention the people who don't go to college at all--prefer statistics to mathematics. Actually, I think most of these people should prefer statistics to mathematics. But I fear that a more likely reaction would be something like, "math is cool, statistics is boring."

P.S. I looked further down, and this "Stuff White People Like" site is just weird. "With few exceptions, white people are actually fond of almost any dictator not named Hitler"?? Huh? I mean, I can see that the site is a parody, but this is just weird.

Sunshine Hillygus and Todd Shields just came out with a book, "The Persuadable Voter: Wedge Issues in Presidential Campaigns," where they argue that "persuadable voters are not a homogeneous group of unsophisticated and indifferent policy moderates, as has often been believed. Rather, persuadable voters hold diverse policy preferences, making it less clear which candidate offers a better match." Hilligus and Shields point out that many many voters disagree with their party lines on important issues (see also my paper with Delia on this topic; correlations between party identification and individual issue attitudes have increased over the past few decades but are still only about 0.3 on a -1 to 1 scale).

The discussion of campaigns trying to exploit voters' cross-pressure reminds me of Dave Krantz's research on how people process information. Suppose you are evaluating hypotheses A and B, exactly one of which is true (for example, the suspect committed the crime or did not). You can imagine four kinds of evidence: (1) evidence supporting A, (2) evidence making A less likely, (3) evidence supporting B, and (4) evidence making B less likely. Dave et al. did some lab experiments manipulating these conditions, and found that people treat them differently: for example, people react differently if you give them evidence of the form (1)+(2), (1)+(3), or (2)+(4). Hillygus and Shields's work focuses this idea by considering an area--political campaigns--where there is a lot of effort being made on both sides to persuade people. Their recommendation to the news media is to look beyond broadcast ads and speeches, to monitor microtargeted messages and direct mail, to make it more difficult for a political campaign to send different messages to different audiences.

Boris forwarded to me this passage from The Audacity of Hope which was noted by Jim Geraghty:

Increasingly, I [Obama] found myself spending time with people of means - law firm partners and investment bankers, hedge fund managers and venture capitalists. As a rule, they were smart,interesting people, knowledgeable about public policy, liberal in their politics, expecting nothing more than a hearing of their opinions in exchange for checks. But they reflected, almost uniformly, the perspectives of their class; the top 1 percent or so of the income scale that can afford to write a $2,000 check to a political candidate. They believed in the free market and an educational meritocracy; they found it hard to imagine that there might be any social ill that could not be cured with a high SAT score. They had no patience with protectionism, found unions troublesome, and were not particularly sympathetic to those whose lives were upended by movements of global capital. Most were adamantly prochoice and were vaguely suspicious of deep religious sentiment...

I know that as a consequence of my fund-raising I became more like the wealthy donors I met, in the very particular sense that I spent more and more of my time above the fray, outside the world of immediate hunger, disappointment, fear, irrationality, and frequent hardship of the other 99 percent of the population - that is, the people I'd entered public life to serve.

Citation statistics

Juli sent me this article by Robert Adler, John Ewing, and Peter Taylor arguing that "impact factors" journals are overrated. I'm sympathetic to this argument because my articles are typically published in low-impact-factor journals (at least in comparison with psychology). I also like the article because it has lots of graphs, no tables. Here's a graph for ya:

impact.png

Adler et al. also criticize the so-called h-index and its kin; as they write, "These are often breathtakingly naive attempts to capture a complex citation record with a single number. Indeed, the primary advantage of these new indices over simple histograms of citation counts is that the indices discard almost all the detail of citation records, and this makes it possible to rank any two scientists. . . . Unfortunately, having a single number to rank each scientist is a seductive notion – one that may spread more broadly to a public that often misunderstands the proper use of statistical reasoning in far simpler settings."

Social networks' "value"?

Michael Arrington talks about a new model he created to assess the market value in online social networks. As hard as it can be to place a market value on a person, it's almost more complicated to place such a value on an online social network. Arrington looks at MySpace, Facebook, Bebo, Hi5, and LinkedIn, among other sites, and creates a model that includes the number of unique visitors the site gets, the number of worldwide users, and the site's total revenue.

He points out that one of the issues with his model is that each social networking site is different in its focus; I would add to this that each site has a very different user base. (He does point this out for LinkedIn, which is purely a place to connect virtually and not a site on which you can play games or babble back and forth.) I have profiles on all the sites I listed above (which is partially because I used to be a high school teacher and partially out of personal interest), but Facebook is definitely the only one I use with some regularity. There is obviously a lot of money to be made from advertising on the sites, which in turn might make some people interested in actually purchasing the sites, but it still seems shaky to equate any "values" between sites since they are all so different in nature. People on each site have different buying powers, people spend different amounts of time on each site, people go to each site with different motives, etc.

I should add here that I am part of one of Andrew's projects on political polarization, and we ran a survey on Facebook as part of that project. It's not cheap to target Facebook users; it is, however, a nice way to target users with specific interests because they list their interests in their profiles. Then again, Facebook users are overwhelmingly within the same age range and at a similar level of education, so it's not a hugely diverse or population-representative respondent group. We paid for it though, and maybe that's exactly the point.

Random imputation is a flexible and useful way to handle missing data (see chapter 25 for a quick overview), but it's typically taken as a black box. This partly is a result of confusion over statistical theory. Structural assumptions such as "missingness at random" cannot be checked from data--this is a fundamental difficulty--but this does not mean that imputations cannot be checked. In our recent paper, Kobi Abayomi, Mark Levy, and I do the following:

We consider three sorts of diagnostics for random imputations: displays of the completed data, which are intended to reveal unusual patterns that might suggest problems with the imputations, comparisons of the distributions of observed and imputed data values and checks of the fit of observed data to the model that is used to create the imputations. We formulate these methods in terms of sequential regression multivariate imputation, which is an iterative procedure in which the missing values of each variable are randomly imputed conditionally on all the other variables in the completed data matrix.We also consider a recalibration procedure for sequential regression imputations.We apply these methods to the 2002 environmental sustainability index, which is a linear aggregation of 64 environmental variables on 142 countries.

The article has some pretty pictures (and some ugly pictures too; hey, we're not perfect). I don't know how directly useful these methods are; I think of them as providing "proof of concept" model checking for imputations is possible at all, and I'm hoping this will spur lots of work by many researchers in the area. Ultimately I'd like people (or computer programs) to check their imputations just as they currently check their regression models.

This is another example of why defaults matter a lot.

I got an email of Evan Cooch forward by Matt, saying that there exists a trick to speed up R matrix caculation. He found that if we replace the default Rblas.dll in R with the proper one. It can boost R's speed in doing matrix caculation.

The file is here (This file only works under Windows). For Mac and Linux users, see here.

I just read an article on a faster Gibbs/slice sampler algorithm and it sparked the following thoughts:

1. Faster convergence is not just about speed, it's also about having confidence that your results are correct. The worst thing about not having a good algorithm is never knowing whether I've really fit the model I'm trying to fit. The next worst thing is that then I don't have the confidence to go to the next, more complicated, model I'd like to try.

2. The researchers run things for 10,000 iterations. In statistical simulation research, 10,000 is a small number of iterations. But in practice, 10,000 can take a long time. If the algorithm is as efficient as claimed, wouldn't 1000 be enough? This might sound silly but in big problems--or in routine analyses--you don't necessarily want to wait for 10,000.

Lots of stories for little kids have kings and queens, not many seem to have presidents, prime ministers, mayors, etc. I don't fully understand this. I mean, I see that these stories are traditional, or imitate traditional forms, and so it makes sense that you'd have a king or queen rather than a president. But there are lots of other traditional forms of government. You can see some examples in children's literature, but they're clearly exceptions. (For example, the wolves in The Jungle Book have a tribal council, and the animals in Winnie the Pooh don't have any government at all.) I guess what I'm asking is: How did the standard storybook world become codified, the world with a kingdom, a king and a queen living in a castle riding horses etc? Even in the late Middle Ages in Europe when, I suppose, such places really existed, there were lots of other, different, sorts of places nearby. How and when did the storybook kingdom became canonical? Maybe Jenny can answer this question--it seems to fall within her bailiwick.

P.S. More discussion in the comments to Mark Thoma's blog here. My favorite comment is the first one: "If Mr Gelman doesn't like kings and queens in childrens' stories maybe he should write some stories himself." You'd think that a commenter to an economics blog would've heard about the division of labor! I tell stories to kids, but I write for adults.

More to the point, there are lots and lots of stories without kings and queens, from "And to Think That I Saw It on Mulberry Street" on down. What struck me, though, was how kingdoms are canonical. For example, Sesame Street is filled with original stories--not folktales or anything like that--and by default they are often set in kingdoms.

Time trends in gasoline prices

Dan Lakeland posts this graph:

gasanalyzed.png

Markov mad libs

Drew Conway links to this site that simulates text for Garfield cartoons using a Markov model. I don't actually think these are funny, but it strikes me that they could be a good demo for a lesson on Markov chains.

The discussion here on the climate change attitude mystery reminded me of a funny thing about how we think when we classify people by education, or income, or religion.

James O'Brien writes,

Just wondering if you had any thoughts on testing a random intercepts model in multilevel logistic regression. In my present study, the results of a Wald test (which Twisk, for example, suggests as a kind of approximation for testing whether parameter variance is effectively zero), produce a p-observed of .06.

I've noticed in the MLWin manual as well, they argue that p<.1 for the Wald is evidence that slopes and intercepts (in that particular case) indeed vary. Are they perhaps willing to relax the cut-off because of the approximate nature of the test?

Am I perhaps missing something? Perhaps I need to go back to MLWin and do some bootstrapping.

My reply: I've been known to bootstrap (see my 1992 paper in the Journal of Cerebral Blood Flow and Metabolism, and my recent paper with Alessandra analyzing the storable votes data), but in this case I don't think you have to go to that level of effort.

The short answer is that these true variances are never zero (at least, not in social science applications); a non-significant test doesn't mean the variance is zero, it just means that the data are consistent with the zero variance model. So, if you want, you can keep the variance component in the model and ignore the test. Conversely, if the variance is low, it might not hurt you much to just exclude it from the model (i.e., to set it to zero). It depends what you're doing. If you're just including this variance component to help estimate some other parameter in the model, you can probably just get rid of it, but if you're specifically trying to compare particular coefficients here, or to make predictions for new groups, you better keep it in. In that case, you might want to do fully Bayes (something like the 8-schools model) so you're not conditioning on a particular imperfect estimate of that variance parameter.

This issue actually comes up a lot. Fortunately, it's when the variance parameter is least important (when it could in practice be replaced by zero) that it's trickiest to estimate. A rare bit of good news in statistical inference.

VP

A reporter asked me, "Do people run for VP, who in the past, how, has it worked or failed?"

My reply: I haven't looked at this recently, but I recall when studying election forecasting 15 years ago, that the estimated effect of VP choice was something like +3 percentage points in the VP's home state, so nothing huge.

What about national effects? In 1988, I recall that polls found that Bush alone (in a Bush vs. Dukakis matchup) did about 2 points better than Bush-Quayle vs. Dukakis-Bentsen. But this is probably an upper bound:
- Quayle was a horrible candidate
- And probably, when it came down to the voting booth, it's my guess that less than 2% of people decided not to vote for Bush on the basis of Quayle.

So probably the biggest effect of VP is that this is a person who's likely to become president. (I don't have the stats on this, but the total probability must be pretty high.) If I were choosing, I'd pick the person I'd most like as a future president and probably not worry so much about electoral calculations, fun though they are to think about.

I just finished two novels that both take place in London and were written by demographically similar authors. The Post-Birthday World is a book that I'd read an amusingly dismissive review of (I can't remember where; I thought it was the London Review of Books but it wasn't) but then I saw the paperback in the train station and flipped through it and it looked pretty good. It was indeed pretty good. I can't say that the characters really ever seemed like real people, but it was hard to put down and also thought-provoking. I liked that it moved slowly enough that the characters had a chance to mull things over. The Last Samurai was recommended to me by Rachel. I have to admit that I skipped all the parts of the book that were in foreign languages but I suppose they added to the atmosphere nonetheless. The two main characters seemed completely real, also the book was very funny. There was also some of that cool unreliable-narrator thing going on, where one of the two main characters (the adult one) seemed self-deluded. Highly recommended.

Friday the 13th study

Apparently, Friday the 13th is not unlucky, according to Dutch researchers: link to article.

I would like to see a parallel psychological study, to see if people are more careful on Friday the 13th, go out less, drive less (or just shorter distances) - and if people considering criminal activity hold off until the next day. I also wonder if there is an upswing in the types of "bad luck" they chose to survey on Saturday the 14th...

Non-spam comments with spam links

This entry received the following comment:

You can't compare each round as a parallel test because they move the tee boxes and hole locations every day. This makes the course much more difficult on some days and that is what separates the best from the worst.

a href="http://www.sporthaley.com" Women's Golf Clothing /a


(I've purposely unlinked the html.) Also, the commenter's name is given as "Women's Golf Clothing," and the above link is given as the referring url.

I don't know what to make of this sort of thing. It's hard for me to believe it's pure spam--could a bot really read the entry and make that comment? But what person would sign his or her comment as "Women's Golf Clothing"? We get this kind of semi-spam on the blog comments now and then, and I'm never sure what to think about it.

P.S. Just to be clear, here's another comment that clearly is 100% spam. It's for the blog entry on "Baby Names," it's by "baby boy," and it says, "I can think of "yang" names, you can never know." That's clearly spam, unlike the above comment which was human-generated.

Seeing Nate's discussion here on random walks, bounces, and trends, I was reminded of a paper that Joe Bafumi, David Park, and I wrote a few years ago.

Basically, general election opinion polls can be modeled well with a "mean reversion" model, in which the outcome is predictable and the polls will eventually converge to this predictable outcome. But journalists and observers tend to implicitly assume a "random walk" model which starts at the current position of the polls and then moves from there. Here's the paper, here's the abstract:

Scholars disagree over the extent to which presidential campaigns activate predispositions in voters or create vote preferences that could not be predicted. When campaign related information flows activate predispositions, election results are largely predetermined given balanced resources. They can be accurately forecast well before a campaign has run its course. Alternatively, campaigns may change vote outcomes beyond forcing predispositions to some equilibrium level. We find most evidence for the former: opinion poll data are consistent with Presidential campaigns activating predispositions, with fundamental variables increasing in importance as a presidential election draws near.

And here is a key graph showing votes becoming more predictable during the election campaign:

walk.png

Finally, here's my article with Gary from 1993, "Why are American Presidential election campaign polls so variable when votes are so predictable?" This article gives lots of evidence supporting the idea that people ultimately decide how to vote based on their enlightened preferences.

Here are my thoughts, to appear in the American Statistician:

1. Introduction
2. Teaching Bayesian statistics to social scientists, including a discussion of what is Bayesian about making graphs to get a better understanding of the deterministic part of a model
3. Other thoughts on teaching statistics to non-statisticians
4. A case study: the sampling distribution of the sample mean
5. Starting an (implicity) Bayesian applied regression course: two weeks of classroom activities
6. How is there time, in a course with class participation, to cover all the material?

1. Introduction

I was trying to draw Bert and Ernie the other day, and it was really difficult. I had pictures of them right next to me, but my drawings were just incredibly crude, more "linguistic" than "visual" in the sense that I was portraying key aspect of Bert and Ernie but in pictures that didn't look anything like them. I knew that drawing was difficult--every once in awhile, I sit for an hour to draw a scene, and it's always a lot of work to get it to look anything like what I'm seeing--but I didn't realize it would be so hard to draw cartoon characters!

This got me to thinking about the students in my statistics classes. When I ask them to sketch a scatterplot of data, or to plot some function, they can never draw a realistic-looking picture. Their density functions don't go to zero in the tails, the scatter in their scatterplots does not match their standard deviations, E(y|x) does not equal their regression line, and so forth. For example, when asked to draw a potential scatterplot of earnings vs. height, they have difficulty with the x-axis (most people are between 60 and 75 inches in height) and having the data consistent with the regression line, while having all earnings be nonnegative. (Yes, it's better to model on the log scale or whatever, but that's not the point of this exercise.)

Anyway, the students just can't make these graphs look right, which has always frustrated me. But my Bert and Ernie experience suggests that I'm thinking of it the wrong way. Maybe they need lots and lots of practice before they can draw realistic functions and scatterplots. They'll certainly need lots of practice to learn Bayesian methods.

Here's an amusing story. I can understand why the guy computed his test from scratch, but I agree with Dan that the two-page appendix is kind of over the top.

Too clever by half

I appreciate the effort, but I fear that the message that many have taken from Tufte is "graphs should be cool" rather than "graphs should be clear." As Yu-Sung put it, "I am still figuring out how to read it."

Andrew Oswald sent me this paper by Amanda Goodall, Lawrence Kahn, and himself, called "Why Do Leaders Matter? The Role of Expert Knowledge." Here's the abstract:

Why do some leaders succeed while others fail? This question is important, but its complexity makes it hard to study systematically. We draw on a setting where there are well-defined objectives, small teams of workers, and exact measures of leaders characteristics and organizational performance. We show that a strong predictor of a leader's success in year T is that person's own level of attainment, in the underlying activity, in approximately year T-20. Our data come from 15,000 professional basketball games and reveal that former star players make the best coaches. This expert knowledge effect is large.

My first thought upon seeing this paper was: What about Isiah Thomas? But a glance through reveals that their data end at 2004, before Isiah took up his Knicks coaching job.

More seriously, Goodall et al.'s findings seem to contradict the conventional wisdom in baseball that the best managers are the mediocre or ok players such as Earl Weaver and Casey Stengel rather than the superstars such as Ted Williams and Ty Cobb. I'd be interested to hear what the authors think about this.

Scatterplot, please! It's not just about an eye-catching result; it's about building confidence in your findings

I won't bother to give my comments on the tables and graphs (except to note that the figures are hard to read for many reasons, starting with the fact that these are bar graphs with lower bounds at 0.4 (?), 0.6 (??), etc.).

What I will say, though, is that I'd like to see a scatterplot, with a dot for each coach/team (four different colors for the four categories of coaches), plotting total winning percentage (on the y-axis) vs. winning percentage in the year or two before the coach joined the team (on the x-axis). This is the usual before-after graph, which can then be embellished with 4 regression lines in the colors corresponding to the four groups of coaches.

When reading such an analysis, I really, really want to see the main patterns in the data. Otherwise I really have to take the results on trust. This is related to my larger point about confidence building.

David Runciman writes,

Followed day by day, the race for the Democratic nomination has been the most exciting election in living memory. But viewed in retrospect, it is clear that it has been quite predictable. All the twists and turns have been a function of the somewhat random sequencing of different state primaries, which taken individually have invariably conformed to type, with Obama winning where he was always likely to win (caucus states, among college-educated and black voters, in the cities), and Clinton winning where she was likely to win (big states with secret ballots, among less well-educated whites and Hispanics, in rural areas).

"Predictable in retrospect"?? This seems like a contradiction. I agree with Runciman that there are patterns in the election results, but I'd only call it "predictable" if you actually predict it ahead of time, which I certainly didn't! He continues:

Hey . . . nice graph!

From Andrew Sullivan. More here. I love this stuff.

Following up on our link to an article about educational measurement, Eric Loken pointed me to this:

On the Criteria Corporation blog we [Loken] just posted a look at golf tournament scores. If you take the four rounds as if they were four repeats of the same test, or four parallel items on a test, the usual psychometric analyses would yield a terrible reliability coefficient. The problem of course is restriction of range of true scores among the world's best golfers. We figured since the US Open (this weekend) is sometimes called the Ultimate Test we'd offer a little psychometric analysis of golf.

Despite having published an article on golf, I know almost nothing about the sport--I've never actually played macro-golf--so I'll link to Eric's note without comment.

J. Michael Steele explains why he doesn't like the above saying (which, as he says, is attributed to statistician George Box). Steele writes, "Whenever you hear this phrase, there is a good chance that you are about to be sold a bill of goods."

We went by the pool in Central Park today and it was drained of water. Wha . . . ? It was only about 100 degrees out there today.

Aaahhhh, I see: "Pool Opens July 1st and closes after Labor Day". (Note also that in the picture on the website, the pool has no people in it. That's no coincidence: when there are people in it, it's jam-packed with people.)

OK, I have an idea: no A/C in city offices until the all the swimming pools open. If the city doesn't want to open the pool until July 1st, no problem: it's probably not so hot outside, and I'm sure the desk workers can make do with fans.

And, just in case they decide to do what they did in previous years and open up only half of the pool (I'm not kidding, they roped half the pool off so that a few zillion people were crammed into 50% of the space), then they can do the same thing in city offices: half of the offices can have A/C, half won't. I'm not sure what to do about the mayor. Maybe give him A/C half the time?

P.S. When open, the pool hours are from 11-3 and 4-7. Of course, this means that city offices should also be air conditioned only during these times.

Gal Elidan writes:

I am starting as a faculty next year in the statistics department at the Hebrew University, Israel. As it may be interesting to both the computer science and statistical community, I plan to give a course a course next year on Bayesian data analysis. My (still in its early stages) plan is to give a course based on your book along with some relevant topics/applications that have seen light in the computer science community in recent years (e.g. the Chinese restaurant process). I would greatly appreciate it greatly if you could share with me any material that you have used in the past in teaching this course. Since I have little experience estimating work load, I could use help in knowing how many problems you assigned each time.

My reply:

After seeing my note on education, partisanship, and views on climate change, Jason Reifler sent me this paper he wrote with Brendan Nyhan, which begins:

An extensive literature addresses citizen ignorance, but very little research focuses on misperceptions. Can these false or unsubstantiated beliefs about politics be corrected? Previous studies have not tested the efficacy of corrections in a realistic format. We [Nyhan and Reifler] conducted four experiments in which subjects read mock news articles that included either a misleading claim from a politician, or a misleading claim and a correction. Results indicate that corrections frequently fail to reduce misperceptions among the targeted ideological group. We also document several instances of a “backfire” effect in which corrections actually increase misperceptions among the group in question.

That's scary stuff!

P.S. Nice graphs. Tables 1-4 could be made into graphs too (by adapting coefplot()), but, still, the displays are pretty good.

David Dunson forwarded me this article for
a book that is coming out on Nonparametric Bayes in Practice. I think David's work is great but I keep encountering it in separate research articles and never in a single place which explains when to use each sort of model. I'll have to read the article in detail, but it seems like a good start. I suggested to David that he write a book but he pointed out that nobody reads books. But do people read articles in handbooks? I don't know. I guess what's really needed is a convenient software implementation for all of it. In the meantime, this article seems like the place to go.

More on coalition dynamics

Catherine Farry writes,

I'm late to the party on this one, but as I was catching up on my blog reading I came across your 18 April post ("Coalition Dynamics") and was a bit surprised to see that nobody spoke up in the comments about the actual political issue (as opposed to the model) addressed in the paper you criticize.

Really, we were just making our own independent decision. Just another example of unexplained group-level variance.

Um . . . no, "if the general election were held today" is not a particularly interesting question. The polls can move a lot in 5 months. Remember President Dukakis? See here (from our 1993 paper):

dukakis.png

The triangles on the right side of each plot are the actual election outcomes, and the little arrows on each graph show the dates of the Democratic and Republican conventions in each year. As you can see, polls this early are in many cases not even close to the outcome.

I'm sure that Dr. Tyson means well, and I'm a big fan of Nova, but, really, he should talk with some political scientists before glibly writing about politics and concluding, "The political analysts need to take it from here." We've taken it pretty far already, dude! Tyson has every right to speculate about politics--I wouldn't claim that you need some sort of political science affiliation as a "union card" to do political science research--but it would make sense to ask around a bit, right? I mean, if a couple of political scientists wrote a paper on astrophysics in a journal called Mathematical and Computer Modeling . . . well, before trumpeting it in the New York Times I'd first go up to the 10th floor and ask my friend David, the astronomer, whether it's for real.

New candidate for worst graph ever

Andrew Smith sends in this:

graph.jpg

He writes, "I think it beats the pie chart you referenced in your previous blog post! My brain still hurts trying to parse it."

In all seriousness: yes, a scatterplot would be better. And they gotta work on their axis labeling. "61.8?"

P.S. In contrast, the photographic height/weight chart is excellent.

Two-stage and multilevel regressions

Robert Rohrschneider writes:

I [Rohrschneider] am trying to gain an understanding of the pitfalls of multi-level analyses in my work which typically requires that I merge country data with surveys of individuals, usually in Europe. I wonder whether you could reduce my confusion about one issue of multilevel modeling in political science. It appears that the simple two-stage regression approach to multilevel data structures (i.e., a variant of which you and Jennifer Hill describe on p. 240 in your 2007 book) is gaining in popularity in political science.

We've chosen the winners of the ASC art contest!

Damn this is cool

Chris Zorn writes, http://graphics8.nytimes.com/packages/flash/politics/20080603_MARGINS_GRAPHIC/margins.swf

He's clearly a man of few words. I'll give it as a link. You can play with it, click on things, see all sorts of fun stuff.

What I'd really like to do is pipe this through a hierarchical model to smooth out the inevitable survey fluctuations. Also, it would be good to subtract off main effects. For example, in the graph below, are well-educated Arkansans particularly strong Clinton supporters, or is this just a combination of Arkansas being a Clinton state and small-sample fluctuation?

pretty.png

Anyway, I'm not complainin, just suggesting even more things that could be done with these data and this software. The first thing to do is to run it with the 2000 and 2004 exit polls. This app would go great with our Red State, Blue State book.

Writing as process

I don't know if I agree with this. I enjoy writing, but what I really enjoy is goofing off. If my books could write themselves, I'd choose that option.

But it is true (for me) that only through the writing does the content come out. I don't really know exactly what I want to say until I write it.

In their article, "High-Stakes Testing in Higher Education and Employment Appraising the Evidence for Validity and Fairness," Paul Sackett, Matthew Borneman, and Brian Connelly write:

As young adults complete high school in the United States, they typically pursue one of three options: continue their education, enter the civilian work force, or join the military. In all three settings, there is a long history of using standardized tests of developed cognitive abilities for selection decisions. In these domains, the tests themselves often are very similar. For example, Frey and Detterman (2004) reported a correlation of .82 between scores on the SAT, widely used for college admissions, and a composite score on the Armed Services Vocational Aptitude Battery.

The question is: are these tests any good? The authors say yes:

The authors review criticisms commonly leveled against cognitively loaded tests used for employment and higher education admissions decisions, with a focus on large-scale databases and meta-analytic evidence. They conclude that (a) tests of developed abilities are generally valid for their intended uses in predicting a wide variety of aspects of short-term and long-term academic and job performance, (b) validity is not an artifact of socioeconomic status, (c) coaching is not a major determinant of test performance, (d) tests do not generally exhibit bias by underpredicting the performance of minority group members, and (e) test-taking motivational mechanisms are not major determinants of test performance in these high-stakes settings.

Their key methodological point:

  1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48