Archive for June, 2011

Christmas in July

| Gabriel |

Has it been two years already? Holy moly, Stata 12 looks awesome.

The headline feature is structural equation modeling. It comes with a graphic model builder, which even an “only scripting is replicable” zealot like me can appreciate as it helps you learn complicated command syntax. (I feel the same way about graphs). I had actually been thinking of working SEM into my next paper and was thinking through the logistics of getting a copy of M+, learning the syntax (again), etc. Now I can do it within Stata. I look forward to reading more papers that use SEM without really understanding the assumptions.

Probably the most satisfying new feature to me though is contour plots. Ever since I got interested in writing simulations a few years ago, I have been wanting to make heat maps in Stata. I’ve spent many hours writing code that can pipe to gnuplot and, not being satisfied with that, I (with some help from Lisa) have spent yet more time working on another script that can pipe to the wireframe function in R’s lattice library. Now I’m very happy to say that I will not finish writing this ado-file and submitting it to SSC as Stata 12 contains what looks to be really good native heat plots.

I’m thinking the set of commands I will feel most guilty about not using more often, is margin plots, which extends the margin command from Stata 11. In addition to the headline new features there’s a bunch of little stuff, including fixes to get more compatibility between the estimation commands and the ancillary commands (e.g., better “predict” support for count models and “svy” support for “xtmixed”). Also, Windows users should be pleased to hear that they can now do PDFs natively.

[Update: Also see Jeremy’s post on Stata 12. He closes with a pretty funny metaphor of stats packages to cell phone brands.]

Advertisement

June 27, 2011 at 12:46 pm 7 comments

The Case of the Missing Co-Blogger

| Gabriel |

I was at the ASQ workshop at HEC Paris and who should walk past me and do a double-take but my erstwhile co-blogger, Pierre. Unfortunately this was at the second to last session of the workshop but we got to talk for about an hour as he gave me a ride back to Paris. (Despite the name, HEC Paris is in les exurbs and is two trains and an intermittently running bus from Paris).

Pierre recently started as an assistant professor at HEC, which is a great job for any economic sociologist but especially for a Parisian. (Likewise, I’m from LA — giving codeandculture a 2 for 2 rate for getting an R1 job in your hometown). Although we email a couple times a year (mostly when I’m begging him for help with R), this was the first time I’d seen Pierre since he was the discussant on a seminar talk I gave at Princeton two years ago. (That talk btw was an early version of the first half of my book, which is almost done).

We the management here at codeandculture miss Pierre and invite him to post again whenever he’s got some bit of code he wants to document or whatever other occasion may warrant a post. Although I’ve done about 100 times more posts on this blog than Pierre, he really hits above his weight on page views. (Yes, I read the “site stats,” I’ve also googled myself, so what). Week after week, all three of Pierre’s posts on how to do really basic but surprisingly difficult things in R get search traffic from somebody googling some variant of “how do I do this really basic thing in R?” Over time this adds up so by page views Pierre is something like 5% of the site.

June 15, 2011 at 6:54 pm

A nous, l’ivresse meilleure des chants joyeux!

| Gabriel |

As is well known to most sociologists of culture, there has been a steep decline in consumption of traditional high culture. You can look at data like Survey of Public Participation in the Arts to see a pretty steep decline in taste for classical music and opera, much of which appears to be cohort-based rather than period or age based. Hence a series of NEA reports on the aging arts audience.

Enter the curious fact that even though we increasingly don’t actually listen to classical music or opera, we still admire people who do as is observable in the lab as a fairly substantial halo effect (h/t Robin Hanson). This suggests that in some sense we are leaving money on the table, cultural capital wise. An interesting question is why we don’t take up this cultural arbitrage opportunity?

One answer would be that it’s simply too hard for most people to make themselves like fine art, even if they wanted to in some sort of deliberate calculation. This would parallel the observation that returns to education continue to increase but college and high school graduation rates have stalled as we reach deeper into the talent pool. Whatever the merits for formal education, I have a hard time buying this for music since (a) lots of classical and opera is intrinsically pretty accessible and (b) a few generations ago classical and opera was much more popular, including among people with little formal education. Similarly, a lot of pop music is not intrinsically accessible, in the sense that it is musically complex and behaves as an addiction good / acquired taste.

Another possibility for the “leaving cultural capital on the table” paradox, and one I find far more plausible, is that music serves as a signal of social membership. In this conception expressing interest in classical or opera would strike most people as a stuck-up affectation whereas consuming pop music of the appropriate kind reaffirms solidarity with the sub-group. This is basically the model described in qualitative work on cultural capital and the working class. Failure to adopt a positive stigma would thus parallel the actual adoption of negative stigma. For instance,  Fryer and Levitt’s explanation for distinctively black names is basically that they are costly (and therefore credible) signaling of group solidarity. In the same way, adopting a taste for classical music or opera would be seen in many social circles, including those of many affluent people, as a pretentious affectation that implies disloyalty to the group.

[The title of this post means “for us, we prefer the greater drunkenness of joyful songs.” Click through to hear it in context. (the song starts at 3:23). Or buy an earlier recording for a buck.]

June 2, 2011 at 4:37 am

Which of my cites is missing?

| Gabriel |

I was working on my book (in Lyx) and it drove me crazy that at the top of the bibliography was a missing citation. Finding the referent to this missing citation manually was easier said than done and ultimately I gave up and had the computer do it. These suggestions are provided rather inelegantly as a “log” spread across two languages. However you could pretty easily work them into an argument-passing script written in just one language. Likewise, it should be easy to modify them for use with plain vanilla LaTeX if need be.

First, I pulled all the citations from the book manuscript and all the keys from my Bibtex files.

grep '^key ' book.lyx | sort | uniq -u | perl -pe 's/^key "([^"]+)"/$1/' > cites.txt
grep '^\@' ~/Documents/latexfiles/ghrcites_manual.bib | perl -pe 's/\@.+{(.+),/$1/' > bibclean.txt
grep '^\@' ~/Documents/latexfiles/ghrcites_zotero.bib | perl -pe 's/\@.+{(.+),/$1/' >> bibclean.txt

Then in Stata I merged the two files and looked for Bibtex keys that appear in the manuscript but not the Bibtex files. [Update, see the comments for a better way to do this.] From that point it was easy to add the citations to the Bibtex files (or correct the spelling of the keys in the manuscript).

insheet using bibclean.txt, clear
tempfile x
save `x'
insheet using cites.txt, clear
merge 1:1 v1 using `x'
list if _merge==1

June 1, 2011 at 4:37 am 2 comments


The Culture Geeks