Create bibtex from a list of text references
Some prefer to manually cite and reference documents that they work on. I am not one of those people. This method, especially when working collaboratively, often results in repeating the same double-check for references and style formatting over and over and.....
I much prefer to use a reference manager like Zotero which makes it unbelievably easy to get your references into. Most times, you can just drop a PDF in and then find the reference data based on info in the PDF. But, more about Zotero in a later post perhaps. For now, what do you do when you receive a huge list of references in APA/MLA/etc. format and want to add them to your reference manager?
For this task I've used a tool from Makino Takaki fairly successfully a few times now to convert a list of text references to BibTeX and then import into Zotero. It's not foolproof and you'll have to double-check in the import but it's a start.
I'm hoping that someone with more time available than myself will take his source code and tweak it to improve this tool.
Getting javascript to run in a WordPress blog entry
It's not as easy as it looks to get javascript to run from inside a WordPress post. For a recent post, I wanted to run a one-off javascript so I didn't want to change the header.php file in my theme. Instead I found this info on the WordPress codex on how to call javascript from inside the <body> tags.
Also the javascript that I was originally working with used
<body onload="init()">
to start the javascript when the page loaded but this wouldn't work from a WordPress blog entry. So I had to change my javascript from:
function init() {
something();
goes();
here();
}
to:
window.onload = function init() {
something();
goes();
here();
}
and then I call the init() function in my blog post using:
<script type="text/javascript">
init();
</script>
*Important*
I can to change my WordPress user settings to disable the visual text editor since it was adding/stripping various parts of the html and breaking it.
Mapping data on the web using Mapbox & OpenLayers
This post is mostly a note to myself covering some of the research I've been doing over the past day with mapping data for the web. I've found a number of really nice interactive mapping tools that I'm looking into including Mapbox, OpenLayers, Polymaps and Google Maps API. Although they look nice, I've been avoiding Flash based tools. Mostly because I don't know Actionscript and also because I think html5/javascript is where technology is headed in the near future.
Background
Over the past two years, the Global Ocean Economics Project that I've been working for has generated/collected some interesting global data. The data is organized very simply into a longitudinal format with countries as the cross-sectional identifier. The head of this data would look something like this:
| Country | Year | Data |
| Canada | 2000 | 100 |
| Canada | 2005 | 200 |
| USA | 2000 | 200 |
| USA | 2005 | 400 |
For now I'll ignore the time element of the data and focus simply on displaying a cross-section on a global map. I'll consider displaying time-series on the map later.
Mapbox
This appears to be a strong contender for my final product although it appears to be geared towards an audience a little higher in terms of technical efficiency.
I was first tipped off to Mapbox after falling for the data displays on the new World Bank data site. The map on the front page gets its message across while remaining very clean and simple. After looking at this page's source code I saw that they called scripts from mapbox.com so I checked it out and after reading a little on that site I was able to produce this:
The code necessary to use the World Light tileset above can be downloaded here. Also at that link are instructions for working with Drupal and Google Maps API.
The next step is to add data and make it look more like this app from the National Democratic Institute.
OpenLayers
OpenLayers is an open source javascript library for making 'slippy' maps. I believe it is the brawn behind Mapbox, however, the documentation is a little vague for my liking and it will take some more time before I can comment on this further.
Polymaps
This looks to be very nice. Good set of examples and the documentation seems useful. It's also nice to see that they are dedicated to using SVG, which will likely be very useful in the future of the web. As a user of Inkscape, I'm happy to see more support for SVG on the web. For the time being I've decided not to pursue Polymaps any further because I fear hitting some walls in terms of SVG being incompatible with some browsers (I'm looking at you IE6!).
Google Maps API
Why leave Google to last? Normally the GOOG would be the first place I look, but I was under the impression that Google Maps was Flash only. Turns out that I was prematurely turned off since they do have non-flash version, however, at the moment I feel that I've made more headway with other options so I'll stick to that.
future research
At the moment all the data files are static so there is no need to concern myself with connecting the map to an analysis engine like Stata (or R via Rapache). However, in the future I'd like to investigate how to make such interactive maps dynamic in that they take output from Stata scripts and plot them on the web. This could be done automatically to do something like:
- Download monthly crime data
- Run some regressions
- Report the results on an interactive map
Done for now
Like I said earlier, this is mostly a note to myself to collect some links and my progress researching this topic. But, if you happen to read all the way through this and have any comments or can suggest a new direction for me to take, please do so below.
Taxi cabs and drunk driving
Okay, a follow-up to my earlier discussion of restrictions to cab drivers. An interesting idea to consider is the unintended effect of keeping cab prices artificially high through limiting taxi licenses. As price of cab increases the number of people driving drunk (because it costs too much) will increase and so will the number of drunk-driving related fatalities. Lame excuse or not, high prices for taxis / public transport will affect the decision to drive drunk for some people out there.
How much does it cost to take a cab? According to this web site, a three-mile cab ride will cost you about $8 plus tip in most major cities. After a tip, that is about $3 per mile — not too different than the implied cost per mile of driving drunk.
via Google Reader (781).
When giving a friend a ride to work is illegal
One of the strange things about law in Canada (and other places too) is that there are certain things that are legal when done for free but illegal when money changes hands. The oft-cited example is sex but also includes organs (becoming a donor is admirable but selling your kidney would land you in jail) and children (you can put your child up for adoption but selling one would be illegal as well as morally repugnant for most).
Eric at the Freakonomics blog points out another common action that is legal when done freely but illegal if you are paid for it. He says:
"the simple act of driving passengers around is a crime — when it is done for cash."
The law requires taxi cab drivers to have a permit to transport people for money and these permits are, in most cases, heavily restricted. Is it to protect consumers from riding with sketchy folks or in shoddy vehicles or just a way to ensure nice profits for cab drivers?
The cab story is interesting because
- it's weird when you really think about it that it can be legal to get a ride with a friend to work but if you offer some money for gas you are a criminal and;
- there are real implications for cities that suffer traffic congestion and/or inadequate public transit.
Regarding point 2, opening up restrictions to cab drivers could have many positive benefits for cities with clogged roads and poor transit options. Think about the possibilities if you had the option to cram yourself onto an over-packed bus or pay a couple dollars to flag a ride from a fellow motorist - with or without the on-duty sign on the roof.
Statistical analysis Q&A website
Earlier I mentioned the website StackOverflow.com which is a great way to get help with programming questions. Now on the website Area51 there is a proposal to create a similar site for questions related to statistical analysis. My hope is that the site would be a great place to find help answer questions like:
- What is the difference between standard deviation and variance?
- How do I use a data series in regression that doesn't follow a normal distribution?
Click the link to express your support for the site if interested.
A new source for free economic data
This has the potential to be a great new source of data.
After an brief initial browse through I get the feeling that there is a lot here but it's not exactly easy to search. Nonetheless, it's movement in the right direction - open data.
via Network of European Economists Online Dataverse - IQSS Dataverse Network.
Your relationship to data and openness
As an economist my view of data I use is generally some variation of "it's just data" That is, data is just one input among many that I'll use to create something. I didn't think too much about data other than to be frustrated when acquiring the data necessary for a given project is more than a trivial matter.
I've worked with many people in several different fields and I was, to be honest, more than a little surprised to find that many people, even academics, will go to great lengths to guard their data from use by others. At first I was merely frustrated by those who keep their data behind walls; if there is one thing that hinders progress and innovation it is when information is kept behind a wall.
But, I've come to (I hope) a better understanding of why such walls are constructed at all. Economists are intensive users of data but rarely create it so we have a difficult understanding those who do collect/create data. Those who create data, by going out and measuring the weight of various wildlife, or interviewing people about their consumption habits likely do not see themselves as just data sources. Rather, they feel that they are creators of something of value and they feel a deep connection to their work. When someone comes along and asks them for data it is not just data to them, it is their creation.
As economists, and other social scientist, we have a duty to understand the connection that some have with their data and respect that. Of course, this is not to say that I've changed my tune and data should be kept behind walls or encrypted on disks in building basements. Data wants to be free and it is most useful when it is freely and easily accessed. I hope that when users of data, such as myself and other social scientists, understand that the creators of data can have a deep connection to their works, we will be able to increase data openness and availability.
Open data can save Canadian taxpayers
A very good case for open data is made by David Eaves on his personal website. David recounts a story where a consultant who was hired to analyze charitable giving in Toronto stumbled upon something he didn't expect; donations to illegal charities were rampant in the Toronto area and had gone un-noticed by the Canada Revenue Agency (CRA). In this case, it is estimated that more than $3.2 billion has been saved since 2007 because the fraud was discovered by an analyst outside the government.
Now this is in no way an criticism of the CRA. As David writes, sometimes the person looking at the data may lack the context to identify that something was amiss in the data. This is not the fault of the analysts at the CRA in any way. No matter the skill of our public servants, there are times when things will fall through the cracks.
But, this is a problem with the manner in which we treat government data. The chances of these errors decreases with the number of people looking over the data. David explains how open data could be of great benefit to Canada saying that:
"[f]or many data sets, citizens should not have to make a request. Nor should we have to answer questions about why we want the data. It should be downloadable in its entirety. Not trapped behind some unhelpful search engine. When data is made readily available in machine readable formats, more eyes can look at it. This means that someone on the ground, in the community like, say, Toronto who knows the sector, is more likely to spot something a public servant in another city might not see because they dont have the right context or bandwidth. And if that public servant is not allowed to talk about the issue, then they can share this information with their fellow citizens.This is the power of open data: The power to find problems in complicated environments, and possibly even to prevent them from emerging."
Well said David! In Canada we have a long way to go before we reach the level of data openness of our neighbours to the south. However, I see glimmers of hope in projects such as Vancouver's Open Data Catallogue and Toronto's open data.
Case Study: How Open data saved Canada $3.2 Billion via [FlowingData]
A few tips on using powerpoint effectively
I'm not the biggest fan of powerpoint but it does seem likely that we can add this to the 'death & taxes' category - they are always going to be with us. Now, that doesn't mean that we are doomed to suffering through hours of text crammed into bullet points. Visit noteandpoint.com for some excellent examples of beautiful and effective powerpoint presentations.
My favourite example from the site is by the team at The Economist...and not just because it's The Economist either. This deck is simple yet seems to communicate the message to me. Even without the aid of a speaker, I feel like I've learned a little about the importance of brand marketing through recessions. If I were in marketing this might even be a message that I would care about. For more tips on how to stifle the yawns at your next presentation you may want to try some of the following: