29 April 2008
Last week on the New York Times' "Well" blog, Tara Parker-Pope blogged about a study that appeared to show that a mother's diet can affect the sex of her child. Yes, the father's sperm determines the gender of a particular embryo, but the story is that the mother's nutritional intake can affect how likely a given embryo is to go to term. At any rate the study is based on survey data in which mothers of boys report eating more around the time of conception than mothers of girls.
I can't really pass judgment on the study itself -- I haven't had time to read the thing -- but as someone who is pretty obsessed with (and professionally involved in) criticizing causal inferences drawn from observational studies, I found it pretty entertaining to read the comments. I admit I did not read all 409 of them. But on the whole they fell into five categories:
1. Credulous, prepared to integrate conclusions into own understanding of the world: "Interesting article…so maybe my eating all that 'crap and vitamins' will help me conceive a boy!!"
2. Generally dismissive: "Unmitigated rubbish! Another 'scientific study' that will be repudiated in two years."
3. Skeptical based on measurement error: "Surveying the diets of women who are 14 weeks pregnant and asking them to 'recall' what they had eaten earlier in pregnancy or preconception will not yield accurate data."
4. Skeptical based on unrealized observable implications: "Are there more daughters born to women in developing countries?" and "Seems to me that the obvious answer lies in genders of children born to diabetic mothers - whose bloodsugars are usually higher than the average nondiabetic woman."
5. Skeptical because of possibility of reverse causation: "Shouldn’t we be interested in the fact that the gender of the baby seems to be affecting the eating habits of the mother? That seems much more interesting to me."
For all I know, many of the perceptive comments in categories 4 and 5 came from professional statisticians, but my guess is that many of these people have never been involved in research in any serious way. In that sense I find it heartening to see so much careful public deliberation about research findings. My experience is that, while a sharp eye for research design can be taught and learned, most of the issues that occupy myself and other members of what Jim Snyder affectionately calls the "identification Taliban" -- the statisticians and social scientists who maraud around academia trying to put burkas on those who would interpret a cross-country regression causally -- are quite simple and widely understood. It seems like the most dangerously misguided people are the ones with 1 semester of econometrics and a working knowledge of Stata. It's as if you lose the common sense your mother taught you once you learn how to run a regression. (Disclosure: I was certainly a danger to myself and others at that stage.)
I find that the mass participation aspect of the web alternately exhilarates (StumbleUpon!) and depresses me (inane, racist YouTube comments!); reading the comments on that NYT blog entry was one of the happier experiences.
28 April 2008
Please join us for the final applied statistics workshop when Jamie Robins , Department of Epidemiology and Biostatistics, Harvard School of Public Health, will Present "Estimation of Direct Effects in different contexts: Pure and natural direct effects, Pathway-specific estimation, principal stratification, mendelian randomization, testing the exclusion restriction , and surrogate markers". Jamie will be sampling from the following papers during his talk:
The Applied Statistics workshop meets in room N-354, CGIS-Knafel 1737 Cambridge. The workshop begins at 12noon with a light lunch, with our presentations beginning at 1215 and usually ending around 130 pm.
24 April 2008
I am writing a short essay about the connection and distinction between indirect effect and interaction effect for a methodological class and find the following website very helpful to clarify some of the FAQs on that subject. The website is maintained by Professor Regina Branton at the Department of Political Science of Rice University.
Also check out the mediation item at Wikipedia and its great references.
22 April 2008
Update: Check out how my predictions fared! Two comparisons are given, one showing both maps in the same image and one as an animated GIF (kudos to the animation package in R).
Overall, my predictions did pretty well. Their overall correlation with the true vote shares was .89 -- leading to an R^2 of .79, just below the in-sample R^2. My biggest miss was Centre County, where I predicted that Clinton would edge out Obama. Instead, Obama won pretty convincingly, with over 60% of the vote. I also overestimated Obama’s support in some of the counties surrounding Philadelphia. Not sure what I can do to improve the model next time. If you have any ideas, leave a comment.
Original entry:This isn't my normal blogging day, but I wanted to show my final Pennsylvania prediction map. Later on I will update my post to include the true map in the same color scheme, so we can compare. I have updated the prediction model after everyone's suggestions last time.
The big problems last time were:
There were other comments, too, but not all of them could be addressed effectively (What else can I do besides predict on the county level? That's where we have data!) Well, I'm happy to say that for the latest model I pulled in lots more covariates from the census:
With all these, the model fits like a dream come true. R^2 = 0.82 and a residual standard error of 0.04 (i.e., +- 8% of Obama's true share). Here are the estimated coefficients (after pruning some variables based on the BIC):
The coefficients are pretty much as you expect: counties with more Blacks, young people and higher incomes vote for Obama. Poorer counties and counties where Kerry did well tend to go for Clinton. The only somewhat surprising part is the negative coefficient on male population. You would think counties with more females would go for Clinton. There's probably some confounder, because there were several counties in Ohio with 55% male populations who went for Clinton.
Anyway, I will update this post tomorrow comparing my predictions to the realized results.
a) 100 students take a class, and 50 pass.
b) Given that next time, 50 students pass the (identical) class, how many students, on average, were enrolled?
The "fallacy" is in assuming that the expected number of original enrollees is 100, when it must necessarily be greater than 100 due to the uncertainty in the estimation of passing the class. The article points out that it's ignorance of the prior distribution of passing students that's at fault for the "fallacy" - I argue that it's the prior distribution of one student passing a test that's the cause of the paradox.
Break the problem in two:
a) 100 students take a class, and 50 pass.
Assume for the moment that a student passes or fails the class independent of their peers (which is a reasonable assumption for the initial problem, dealing with the failure rate of vehicles.) Let's assume the standard noninformative prior case, that "half a student" passes and "half a student" fails (the Jeffreys prior) and that students are basically identical. Then the posterior distribution of the probability of passing the test is equivalent to a Beta(50.5,50.5) distribution.
b) Given 50 students passed, on average how many enrolled?
The number of students enrolled in the class for each one who passed is then 1/p - but the mean of 1/p (in this case, 2.02) is necessarily greater than 1/(the mean of p), 2. So the expected class size must be greater under these assumptions. So roughly 101 students enrolled.
The original authors, however, make a profound overestimation of the average of starting students, choosing a "posterior" distribution that yields a class size of 150. To get an expectation this big with this prior information, we would observe a posterior of Beta(2.0,2.0) - or, 1.5 students passing and 1.5 failing! Putting this in perspective, the most likely way I can see this happening is that students pooled their talents and produced 3 distinct final papers: one good, one bad, and one just good enough to get the professor to flip a coin.
It does, however, seem to explain why Harvard classrooms always seem to overflow chaotically at the beginning of each term.
P.S. The original authors call this the "backwards reasoning fallacy", even though Google says the name is better applied to startling schoolchildren deterministically rather than failing them stochastically. Resolving the namespace collision here, does this problem go by another name, or shall we go via Stigler and call it Gelman's paradox?
Update: We recently received this comment from the work's original author, as the comment system failed to post it. I've attached it verbatim. -AT, 8-12-08
I am the author of the original article and a colleague of mine alerted me to your posting on Andy Gellman's blog. You said (about my article):
"An interesting problem with an awful delivery."
You also said:
"I'd normally agree that someone's selling something with this, but the fact that the page was cosponsored by a university makes me wonder about their grossly exaggerated result."
For a start it would not have been too difficult for you to have found out who I was since my name is very clearly stated at the bottom of the article, and the web site provides full information about me. So it would have been nice for you to raise the concerns you have about the article with me directly rather than through the use of insulting comments on a third party web site.
As to the substance of your criticisms, you seem to have misunderstood the particular problem and context and have produced a different model, that does not address the very real example that we had to deal with. You say that
"The original authors ... make a profound overestimation of the average of starting students, choosing a "posterior" distribution that yields a class size of 150."
This is not what I did at all. I made it clear that the crucial assumption was the prior average class size. To illustrate the problem I chose an example in which the prior average was deliberately high, 180. The fact that this gives a posterior average class size of about 153 when the 50 passes is observed is exactly the point I wanted to emphasize. Your comment about us making a "profound overestimation" is quite simply nonsense. Part of the fallacy was to assume that the class size of 100 in the specific example was in any way representative of the average class size.
I suggest you read the article again and pay particular attention to the (real) vehicle example at the end. The model that I produced EXACTLY represented the real data.
You should also be aware that the aim of my probability puzzles/fallacies web page is to raise awareness of probability (and in particular Bayesian reasoning) to as broad an audience as possible. While I am pleased if other professional statisticians read it, it is not they who are the target. This means having to use a language and presentation style that does not fit with the traditional academic approach.
In fact, one thing I have discovered over the years is that too many academic statisticians tend to speak only to other like-minded academic statisticians. The result is that in practice (i.e. in the real world) potentially powerful arguments have been 'lost' or simply ignored due to the failure to present them in a way in which lay people can understand. I have seen this problem extensively first hand in work as an expert witness. For example, in a recent medical negligence case the core dispute was solved by a very straightforward Bayesian argument. However, this had been presented to the defence lawyers and expert physicians in the traditional formulaic way. Neither the lawyers nor the physicians could understand the argument, and the QC was adamant that he could not present it in court. We were brought in to check the validity of the Bayesian results and to provide a user-friendly explanation that would enable the lawyers and doctors to understand it sufficiently well to present it in court. The statisticians simply did not realise that what is simple to them may be incomprehensible to others, and that there are much better (visual) ways to present these arguments. We used a decision tree and all the parties understood it immediately because it was couched in term of real number of patients rather than abstract probabilities. Had we not been involved the (valid) Bayesian argument would simply have never been used.
Professor of Computer Science
Head of RADAR (Risk Assessment and Decision Analysis Research)
Computer Science Department
Queen Mary (University of London)
London E1 4NS.
Tel: 020 7882 7860
32-33 Hatton Garden
London EC1N 8DL
Tel: +44 (0) 20 7404 9722
Fax: +44 (0) 20 7404 9723
21 April 2008
Please join us this Wednesday when Jeff Gill--Department of Political Science and Director Center for Applied Statistics, Washington University St Louis-- will present "Circular Data in Political Science and How to Handle It", work that is joint with Dominik Hangartner. Jeff and Dominik provided the following abstract
There has been no attention to circular (purely cyclical) data in political science research. We show that such data exists and is generally mishandled by models that do not take into account the inherently recycling nature of some phenomenon. Clock and calendar effects are the obvious cases, but directional data exists as well. We develop a modeling framework based on the von Mises distribution and apply it to two datasets: casualties in the second Iraq war and suicides in Switzerland. Results clearly demonstrate the importance of circular regression models to handle periodic data.
A preliminary draft of their paper is available here
The authors also provided an example of circular data analyzed in their paper: the figure below shows the time at which different kinds of violent attacks occur in Iraq.
The applied statistics workshop meets at 12 noon in room N-354 of CGIS-Knafel (1737 Cambridge St), with a light lunch served. The presentations begin around 1215 and conclude at about 130 pm.
Please contact me with any questions
18 April 2008
In last week's debate in Philadelphia,
Last week's debate provides a small but interesting corpus to analyze the candidates' favorite linguistic formulations. Overall,
So all in all, the candidates spoke about the same number of words. But which words? We can test that using a basic corpus comparison method. In all, there were 1,971 unique words. For each of these, we test the hypothesis that the candidates spoke the word with equal probability, using a simple chi-squared test. Next we sort all words by their p-values so that the most differentially expressed words percolate to the top. Here are the top 20 words by p-value, along with their frequencies from Obama and Clinton.
Sometimes control words (I, it, etc.) are excluded from analysis, but here I thought it would be fun to leave them in so we could see each candidate's preferred constructions. Besides the points listed above, here are a few interesting notes:
- Clinton used the word "I" 205 times to Obama's 150
- Obama loves to start sentences with "That's:" "That's why I'm...", "That's what we're," etc.
- Obama loves the word "decade" -- evidently he used the phrase "decades after decades" several times
Of course, unigrams -- single words -- can only tell you so much. If we do the same analysis using bigrams, a few more bits of information drip out:
So Clinton always punctuates her thoughts with "you know," while Obama attributes his goals to the "American people."
It will be interesting when McCain gets into the mix with one of these two. I think it would be fun to construct a language model -- a model for the probability that each candidate spoke a certain sentence. Given the differences, I bet that given a sentence, it could easily figure out whether Obama, Clinton or McCain said it!
16 April 2008
The Journal of the American Medical Association published a piece today on ghostwriting of medical research. Thanks to the Vioxx lawsuits, the authors say that they found documents ``describing Merck employees working either independently or in collaboration with medical publishing companies to prepare manuscripts and subsequently recruiting external, academically affiliated investigators to be authors. Recruited authors were frequently placed in the first and second positions of the authorship list.’’ One of the exhibits uses a placeholder ``External author?’’ for the expert to be named. Obviously the idea that a pharmaceutical company is pre-writing clinical studies is as controversial as doctors possibly signing off on them without really being involved. A NYT article has some comments, and Merck has released a press statement.
15 April 2008
A few weeks ago I wrote a post sharing some code I wrote to generate sharp-looking PNG scatterplots from R using the Google Chart API. I think there are some nice uses of that (for example, as suggested by a commenter, to send a quick plot over IM), but here's something that I think could be much more useful: maps from R using Google Charts.
So, suppose you have data on the proportion of people who say "pop" (as opposed to "soda" or "coke") in each US state. (I got this data from Many-Eyes.) Once you get my code, you enter a command like this in R
googlemap(x = pct_who_say_pop, codes = state_codes, location = "usa", file ="pop.png")
and this image is saved locally as "pop.png":
To use this, first get the code via
which loads in a function named
googlemap, to which you pass
For optional parameters to affect the scale of the figure and its colors, see the source.
Another quick example:
Suppose you wanted to make a little plot of Germany's colonial possessions in Africa. This code
googlemap(x = c(1,1,1,1), location = "africa", codes = c("CM", "TZ", "NA", "TG"),file = "germans_in_africa.png")
returns this url
"http://chart.apis.google.com/chart?cht=t&chtm=africa . . . etc.
and saves this PNG on your hard drive:
The scatterplot thing before was something of a novelty, but I think this mapping functionality could actually be useful for generating quick maps in R, since the existing approaches are pretty annoying in my (limited) experience. The Google Charts API is not very flexible about labels and whatnot, so you probably won't be publishing any of these figures. But I expect this will serve very well for quick exploratory stuff, and I hope others do too.
I'd love it if someone wanted to help roll this into a proper
R package . . . .
14 April 2008
Please join us at the applied statistics workshop this Wednesday when Lee Fleming, Harvard Business School, will present “Mobility, Skills, and the Michigan Noncompete Experiment”. Lee provided the following abstract:
While prior research has considered the desirability and implications of employee mobility, less research has considered factors affecting the ease of mobility. This paper explores a legal constraint on mobility —employee noncompete agreements—by exploiting Michigan’s apparently-inadvertent 1985 reversal of its enforcement policy as a natural experiment. Using a differences-in-differences approach, and controlling for changes in the auto industry central to Michigan’s economy, we find that the enforcement of noncompetes indeed attenuates mobility. Moreover, noncompete enforcement decreases mobility most sharply for inventors with firm-specific skills, and for those who specialize in narrow technical fields. The results speak to the literature on mobility constraints while offering a credibly exogenous source of variation that can extend previous research.
The paper for the talk is available here
The applied statistics workshop meets at 12 noon in room N-354, CGIS-Knafel (1737 Cambridge St) with a light lunch. Presentations usually begin around 1215 and usually run until about 130 pm.
10 April 2008
When Professor Nicholas Christakis came by to give a talk on social networks and health two weeks ago, some commentator expressed concern about the sparseness of information contained in network graphs (not specifically regarding Nicholas’ research, which I believe was well-done). I do share the same concern with that commentator. So afterwards I did some preliminary search on the literature about visualization of network data and found several interesting pieces that may help clarify (or even exacerbate) part of the concern some of us are having with network graphs.
The first is the lecture notes Professor Peter V. Marsden wrote about visualization of network graphs in soc275. Here I just want to highlight a few points in his notes. (Words in quotes are taken from Professor Marsden’s lecture notes.)
1) Network graphs can be “referenced to known geographical/spatial/social locations of points”.
2) Aesthetic criteria are used to generate network graphs, for examples, to minimize crossing lines, to make lines shorter, … and “[to] construct plot such that close vertices are connected, positively connected, strongly connected, or connected via short geodesics”.
3) “Location of points reflects ‘social distances’”. … “Spatial configuration differs depending on what 'distance-generating mechanism' is assumed and built in to one’s data.”
4) Some often-used network graph generating algorithms include factor analysis, multidimensional scaling (MDS) and spring embedders, etc.
So the configuration of network graphs seems to a large degree dependent on researchers’ theoretical interests and can change according to the network measures (whether it is the number of clusters within network or overall network connectedness, etc.) that researchers are mostly interested in. In other words, before generating any network graphs, researchers have to be clear about what theoretical themes they aim to present through network graphs and then select corresponding network measures and generating algorithms. For those of you who want to follow up with this topic, there are several pieces recommended by Professor Marsden in his lecture notes that I think are good starting references. See below for more details.
1. Bartholomew, David J., Fiona Steele, Irini Moustaki, and Jane I. Galbraith. 2002. The Analysis and Interpretation of Multivariate Data for Social Scientists. London: Chapman and Hall/CRC. Chapters 3 and 4.
2. Freeman, Linton C. 2005. “Graphic Techniques for Exploring Social Network Data.” Chapter 12 in Carrington, Peter J., John Scott, and Stanley Wasserman. 2005. Models and Methods in Social Network Analysis. New York: Cambridge University Press.
3. Freeman, Linton C. 2000. “Visualizing Social Networks.” Journal of Social Structure 1. (Electronically available at http://www.cmu.edu/joss/content/articles/volindex.html)
9 April 2008
Via Dan Ariely's contribution to this Freakonomics post yesterday, I was lead to a fascinating paper on default options and behavior. The results on organ donation in Europe are particularly striking, as the authors show that large differences in organ donation rates in otherwise similar European nations (e.g. Sweeden and Denmark) may in large part be a consequence of whether organ donation is an opt-in or opt-out option on the drivers license application.
As the authors note, there are substantial public policy implications to research along these lines. For example here in the U.S., there is a growing chorus of policy gurus, including at least one major presidential candidate, pushing for policies such automatic retirement accounts. The idea is that rather than enacting more blunt mechanisms (e.g. mandates), we can implement policies that harness the inertia brought about by default options to achieve policy goals.
Update: In comments, Kieran Healy raises the important point that willingness to donate is not the same as actually donating, and that observed donation rates in European countries tend to be much closer together. Fair point!
However I would add that I'm not sure how helpful I find figure presented at the Crooked Timber link. The data points correspond to organ donation rates by year, but it's not a time series so there's no way to know which points correspond to which year. Furthermore, do all of these points correspond to only being on one side or the other of a change in informed consent law? Or did some of these countries change their informed consent policies during the 1990-2002 time frame? This would be important information to know, particularly if we're interested in whether these laws have any effect on actual organ donation. On my first glance at the paper provided I see that the same data are indeed put in a time series, but again I don't see any indication of when each country's policy was enacted and whether there were any shifts in policy during the study time frame. So, based on that it's hard to really make any kind of inference either way about whether the policies had no effect on actual donation rates.
For another take on this issue, here's a paper by IQSS member Alberto Abadie, which does find an effect of presumed consent laws. I'd be interested to hear Healy's take on this paper!
8 April 2008
Please join us this Wednesday (tomorrow) when Judith J. Lok, Harvard School of Public Health, Department of Biostatistics, will present " Optimal start of treatment based on time-dependent covariates". Judith provided the following abstract for her talk:
Using observational data, we estimate the effects of treatment regimes that start treatment once a covariate, X, drops below a certain level, x. This type of analysis is difficult to carry out using experimental data, because the number of possible values of x may be large. In addition, we estimate the optimal value of x, which maximizes the expected value of the outcome of interest within the class of treatment regimes studied in this paper. Our identifying assumption is that there are no unmeasured confounders.
We illustrate our methods using the French Hospital Database on HIV. The best moment to start Highly Active AntiRetroviral Therapy (HAART) in HIV positive patients is unknown. It may be the case that withholding HAART in the beginning is beneficial, because it postpones the time patients develop drug resistance, and hence might improve the patients' long term prognosis. However, it is unknown how long initiation of HAART can safely be postponed.
The paper for the talk can be found here
The applied statistics workshop meets at 12 noon in room N 354, CGIS Knafel (1737 Cambridge Street) with a light lunch. The presentation will begin at 1215pm and usually runs until 130 pm.
7 April 2008
Objectives: To determine whether parachutes are effective in preventing major trauma related to gravitational challenge. Design: Systematic review of randomised controlled trials. Data sources: Medline, Web of Science, Embase, and the Cochrane Library databases; appropriate internet sites and citation lists. Study selection: Studies showing the effects of using a parachute during free fall. Main outcome measure: Death or major trauma, defined as an injury severity score > 15. Results: We were unable to identify any randomised controlled trials of parachute intervention. Conclusions: As with many interventions intended to prevent ill health, the effectiveness of parachutes has not been subjected to rigorous evaluation by using randomised controlled trials. Advocates of evidence based medicine have criticised the adoption of interventions evaluated by using only observational data. We think that everyone might benefit if the most radical protagonists of evidence based medicine organised and participated in a double blind, randomised, placebo controlled, crossover trial of the parachute.
Funny how such a lampoon can trigger a flame war on the BMJ website. Makes me understand why Gary writes about Misunderstandings between experimentalists and
observationalists about causal inference...
5 April 2008
Dear students and colleagues,
We would like to invite you to attend the Political Economy Student Conference, to be held on April 17th in the NBER premises, in Cambridge, MA. The conference is an opportunity for students interested in political economy and other related fields to get together and discuss the open issues in the field, know what other people are working on, and share ideas. The program of the conference can be found at:
This year, some members of the NBER Political Economy Group will be joining us for the conference. We are sure that we will greatly benefit from their comments and suggestions during the discussions.
We hope that those of you interested will attend the conference. The success of the conference largely depends on students' attendance and participation. Given that we have limited seats for the conference, please e-mail leopoldo (at) mit (dot) edu as soon as possible if you are interested in attending so that we can secure a spot for you.
4 April 2008
Here are the results of the Pennsylvania Democratic primary, with Obama counties in purple and Clinton counties in Orange.
What, you say? The Pennsylvania primary hasn't happened yet? You're right. Enter statistics!
Consider this scatterplot of Kerry's 2004 vote share versus Obama's 2008 vote shares in Ohio counties. The result is something I call the Kerry-Obama smile: Obama does well in Kerry's best counties, where staunchly Democratic urban blacks are concentrated; and in Kerry's worst regions, presumably due to Obama's appeal to crossover Republicans. Clinton does best in the wide middle swath.
This motivates a very simple modeling idea: fit a curve to the scatterplot. Obviously, a quadratic in Kerry's share looks like a decent fit. That gives us the best-fit line shown on the plot. The R-squared is 0.16, representing an okay fit.
The next step is utterly useless, but utterly fun. We can use Ohio to predict Pennsylvania. In other words, given that we know how Kerry did in Pennsylvania counties in 2004, we can predict how well Obama will do in 2008 in every Pennsylvania county. Note that I first tweaked the model's intercept slightly in Obama's favor, so that the aggregate prediction matches the current polling average (showing Clinton up by 6.6%).
The bad news for Obama is that nearly all of Pennsylvania's counties fall in the middle of the smile. The image below compares Kerry in 2004 to the model's predictions for Obama in 2008. Obama is predicted to carry Philadelphia overwhelmingly, and to do well in some of the curvy, heavily Republican counties in the south-center of the state. Everywhere else, though, is Clinton country.
3 April 2008
The Economist recently had an interesting article on anti-terrorist
spending ("Feel safer now?", March-6 print edition). The piece reports
on research done by Todd Sandler and Daniel Arce on the costs and
benefits of different responses to terrorism (paper here). Terrorism creates a lot
of anxiety but (so the authors say) actually costs few lives and many
counter-measures might be ineffective, e.g. if terrorists just shift
attacks to easier targets in response. Sandler and Arce suggest most of
their spending scenarios are not cost-effective, but that political
cooperation could be worthwhile.
Not being an expert in this area, I suspect that the counterfactuals
involved must be extremely hard to defend given the scope of
transnational terrorism. Similarly the reported bounds are huge and the
underlying numbers should be up for debate. For example while skimming
through, I noticed that didn't see any accounting for psychological
stress of those not directly involved in an attack (e.g. the general
population), nor that of military personnel and families who implement
some of the counter-measures. Any views?
It's a day or so past April 1, but if you haven't seen this post [Edit: link fixed] over at Andrew Gelman's blog, it is worth a look. It's about as good an apologia from a "born-again frequentist" as you are likely to find. An exerpt:
I like unbiased estimates and I like confidence intervals that really have their advertised confidence coverage. I know that these aren't always going to be possible, but I think the right way forward is to get as close to these goals as possible and to develop robust methods that work with minimal assumptions. The Bayesian approach--to give up even trying to approximate unbiasedness and to instead rely on stronger and stronger assumptions--that seems like the wrong way to go.
Fortunately, Gelman's conversion experience appears to have ended after about a day...
2 April 2008
Late last year Google released the Google Chart API, which gives programmers access to a web service that renders charts. So this url
will produce a chart like this:
Try it yourself -- copy the url into your browser; change the text from "Hello World" to something else, etc. And the API supports bar plots, line charts, Venn diagrams (!) and even, recently, maps.
People have written libraries in various languages to provide interfaces to the API (here's a list of them), and tonight I hacked together a little R interface to the scatterplot charts. It's quite rough, but I'd be curious if anyone wants to extend it or can show anything cool with it.
From R, all you have to do is:
And then where you might say
> plot(1:9, c(4,2,4,3,6,4,7,8,5), cex = 1:9, xlim = c(0, 10), ylim = c(1,10))
you can use the same syntax with the
> googleplot(1:9, c(4,2,4,3,6,4,7,8,5), cex = 1:9, xlim = c(0, 10), ylim = c(1,10))
and get back a long url encoding those parameters
which, when entered into an address bar or embedded in an
img tag in a web page, gives you a figure like this:
It seems like this approach could provide a convenient way to publish a figure on the web in some circumstances, but setting aside the insufficiency of my R function, the graphics flexibility of the API isn't quite large enough yet (eg can't pass an axis label, ie
xlab in R). In most cases it seems like you'd just want to create a nice PNG in R or whatever and then publish that. But I'd love to hear if anyone finds a way to use this or thinks it'is worth extending further.