All these findings correspond with a substantial body of research in the economic literature, which, with the help of surveys, laboratory experiments, as well as field experiments showed that those who learn about markets (economists) or act in markets (businessmen) are lacking in … ‘pro-social behavior’ … I also use corruption as a proxy to show whether there are any differences in pro-social behavior between economists and non-economists, but unlike them, I observe behavior outside the artificial situation of a laboratory. By analyzing real world data of the U.S. Congress, I found that politicians holding a degree in economics are significantly more prone to engage in corrupt practices.
René Ruske, Does Economics Make Politicians Corrupt? Empirical Evidence from the United States Congress
Yet another PaperJS experiment. This one generates
Sparklines. It simply looks for canvases matching a specific CSS selector (canvas.sparkler by default), and draws a chart based on JSON-formatted data in the data-data attribute. Here, I'm displaying some unemployment data from Quandl.
What it's doing: Each node has a belief that matches its hue, represented
as an angle between 0 and 359 degrees. Every 25 frames (once a second or so), a node is chosen at random and given
a choice whether to speak; if it does (this is represented by a fading circle expanding from the node). Every other
node has a chance to hear the speaking node based on the distance between the speaker and the listener--the farther
you are from the speaker, the less likely you are to hear.
Once a node does hear another node, it will only care about what it's hearing under one of two conditions:
The hearer's beliefs (i.e. color) are similar to the speakers, in which case the hearer's beliefs will move slightly
closer to the speaker's; or
The hearer's beliefs are very different from the speakers, and its beliefs will move even further away from the
In either case, there is a small chance the hearer will subscribe to the speaker, which adds a line between the two and
means the hearer will always hear announcements from that speaker.
**NB:* This isn't designed--at least in this incarnation--to be a realistic simulation of anything. It's another
experiment with PaperJS.*
While migrating my blog recently from WordPress to Jekyll, I looked for easy ways to post RMarkdown documents to my blog. I ended up developing two options of my own (available on GitHub):
jekyll.R provides two R functions to let you add posts or drafts to your Jekyll blog direct from the RStudio console, by knit()ing an .Rmarkdown document into markdown with the YAML front-matter Jekyll expects. This is probably the best option for blogs.
rmarkdown_converter.rb is a Jekyll plugin that provides an Rmarkdown converter. This lets write your posts in RMarkdown and save them in your site's _drafts or _posts directory with the extension Rmd or Rmarkdown, just like you normally post standard markdown documents.
The downside here is that changes to your R environment (you get a new computer and don't reinstall all of the packages you had before, you upgrade R and one of the packages you used to use is no longer supported, etc.) can make it impossible to build your blog (or at least some posts). It might be more useful for some non-blog sites.
I've been experimenting lately with Paper.js, The Swiss Army Knife of Vector Graphics Scripting.
My first effort is below, an interactive (try selecting lines by clicking and dragging) parallel coordinate plot.
The plot below is displaying the state.x77 dataset
built in to R; I'll think of something more interesting to display with it eventually.
I've been asked to look into doing some kind of analysis of this Sexual Health Rankings data. The data's available as a spreadsheet providing data by state, so I'm using my preliminary, check-this-stuff-out phase, as an opportunity to check out R's xslx package and Stately.
xslx allows you to read and write Excel workbooks from R. Below, I use the high-level read.xslx function to read blocks of cells from worksheets as dataframes, which is quick and easy to work with.
Another Shiny app, this one taking data on U.S. unemployment from Quandl and generating graphs and tables describing it. I was mainly trying to update my Shiny knowledge based on the new(-ish) version 0.4.
This app is on GitHub, so it should be possible to run it with: