## Iowa: Was the fix in? (a statistical analysis of the results)

January 4, 2012
By

Summary/TL;DR Either the first precincts to report were widely unrepresentative of Iowa as a whole, or something screwy happened. Background Yesterday was the first primary for the 2012 U.S. presidential elections. When I logged off the internet last night, the results in Iowa showed a dead heat between Ron Paul, Mitt Romney, and Rick Santorum.

## Mapping the Iowa GOP 2012 Caucus Results

January 4, 2012
By

Introduction On Tuesday January 3rd 2012 the Iowa Republican party held it’s presidential caucuses, with Mitt Romney beating Rick Santorum by 8 votes as of noon on Jan 4th. This was an exciting race with multiple lead changes and entrance polling showing many late undecideds and large gaps in candidate support by age and income.

## Long running R commands: unix screen, nohup and R

January 4, 2012
By

I wanted to write a quick post about a useful linux tool for using R. I sometimes have long running R sessions for model training. One solution that I have alluded to is to call your script with Rscript. The nohup command in linux with push this to the...

## New York Journalism Data Camp in February

January 4, 2012
By

New York Journalism Data Camp in February: ScraperWiki’s first US two dayJournalism Data Camp event in conjunction with the Tow Center for Digital Journalism at Columbia University and supported by the Knight Foundation on February 3rd and 4th 2012.

## Memoization in R : Illustrative example

January 4, 2012
By

I came across a nice problem at project euler that gave me sense of satisfaction that was unusual, I think that because I don't usually get the solutions right the first time as I did in this case. Anyhow, I shall try and decode the R codes that I...

## Example 7.17 in Introduction to Monte Carlo methods with R

January 4, 2012
By

I received the following email about Introducing Monte Carlo Methods with R a few days ago: Hallo Dr. Robert, I  am studying your fine book for myself. There´s a little problem in examples 7.17 and 8.1: in the R code a function “gu” is used and a reference given to ex. 5.17, but I cann´t

## Doing Bayesian Data Analysis now in JAGS

January 3, 2012
By

Around Christmas time I presented my first impressions of Kruschke’s Doing Bayesian Data Analysis. This is a very nice book but one of its drawbacks was that part of the code used BUGS, which left mac users like me stuck. … Continue reading →

## Plotting Doctor Who Ratings (1963-2011) with R

January 3, 2012
By

Introduction First day back to work after New Year celebrations and my brain doesn’t really want to think too much. So I went out for lunch and had a nice walk in the park. Still had 15 minutes to kill before my lunch break was over and so decided to kill some time with a quick web

## useR! 2012 Simple Abstract Helper

January 3, 2012
By

useR! 2012 has issued a call for abstracts! I've extended the WebSweave concept to offer a tool to create simple abstracts online, including those with markup, which may then be submitted at the conference website. Use the following link for the Simple Abstract Helper.

## Extract different characters between two strings of equal length

January 3, 2012
By

In the desperate effort of understanding the secret of life it may be too simplistic to just count the differences between two strings of equal length. You might as well want to know where they differ. You can do that recycling most of the function published in a previous post. You can use it to

## Coefplot: New Package for Plotting Model Coefficients

January 3, 2012
By

By Joseph Rickert Even to the practiced eye, looking at coefficients in R model summaries can be tedious. And, capturing information about the significance of coefficients from scores or maybe even hundreds of models in a way that makes writing the final report a bit easier is a time consuming and thankless task. Of course, once you know what...

## Parallel R (Linux User & Developer Issue 108)

January 3, 2012
By

In the 108. issue of Linux User & Developer was an article “Supercharge your R experience” about using parallel techniques to analyse large amounts of data with R. 4 page step-by-step tutorial shows the basics needed for installing needed packages … Continue reading →

## Baltimore gun offenders and where academics don’t live

January 3, 2012
By

Jeff recently posted links to data from cities and states. He and I wrote R code that plots gun offender locations for Baltimore. Specifically we plot the locations that appear on this table. I added locations of the Baltimore neighborhoods where most ...

## 2012, Turing year

January 3, 2012
By

Buying the special issue of La Recherche on “La révolution des mathématiques”, I discovered that this is the Alan Turing Year in celebration of the 100th anniversary of Turing‘s birth. The math department at the University of Leeds has a webpage on all the events connected with this celebration. From all over the World. (There

## Were markets exceptionally volatile in 2011?

January 2, 2012
By

2011 was a volatile year, no doubt about that, but was it exceptionally so from a historic point of view? To quantify the volatility, I used the Dow Jones Industrial average, which goes back to 1928 on Yahoo Finance: A volatile year no doubt, but once again confirming the fact that, in markets behaviour at

## Lesson 1: Overview of R Language & CloudStat School

January 2, 2012
By

This is the first lesson of CloudStat School, Lesson 1: Overview of R Language & CloudStat School. The objective of this lesson is introducing R Language and how you can be a R programmer or a data analyst through CloudStat School. At the end of this l...

## Voting Networks in the Danish Parliament

January 2, 2012
By

One of my Christmas presents was the book Beautiful Visualization. Chapter 8 by Andrew Odewahn is a very nice piece on visualizing the U.S Senate social graph. Odewahn basically builds an affinity network, where ties represent whether two senator have ...

## R resources

January 2, 2012
By

Earlier we spoke about PITCHfx resources, and now we will learn about R resources. Well, what is R? Straight from wikipedia:R is a programming language and software environment for statistical computing and graphics. The R lang...

## Monetary Policy & Credit Easing pt. 8: Econometrics Tests in R

January 2, 2012
By

Hello, folks its time to cover some important econometrics tests you can do in R.The Akaike information criterion is a measure of the relative goodness of fit of a statistical model.  If you have 10 models and order them by AIC, the...

## Example

January 2, 2012
By

Here is a little example of what I do. While learning R isn't easy, it can be very powerful and efficient once you get your feet wet. I intend for this example to whet  your appetite. This should take you less than 20 minutes. By the end, you will...

## Portfolio Optimization in R, Part 4 Redeux

January 2, 2012
By

So where did we mess up?  In the calculation of returns for the market cap weighted portfolio and the portfolio optimization portfolio, we simply took the starting weights (W0) and multiplied them by the relevant series of returns.resEqual = as.matrix(returns) %*% t(ret)andsubRes = as.matrix(subRes) %*% t(ret)To correct this, we have 2 options. Recalculate the weight at each time point assuming a starting weight. ...

## Portfolio Optimization in R, Part 4 Redeux

January 2, 2012
By

So where did we mess up? In the calculation of returns for the market cap weighted portfolio andthe portfolio optimization portfolio, we simply took the starting weights (W0)and multiplied them by the relevant series of returns.resEqual = as.matri...

## Plotting earthquake data

January 2, 2012
By

Since 4th September 2010 we have had over 2,800 quakes (considering only magnitude 3+) in Christchurch. Quakes come in swarms, with one or few strong shocks, followed by numerous smaller ones and then the ocasional shock, creating an interesting data … Continue reading →

## Market predictions for years 2011 and 2012

January 2, 2012
By

A review of market predictions and results for 2011, and a calibration for 2012 predictions (of 19 equity indices plus oil). Previously One year ago the post “Revised market prediction distributions” presented plots showing the variability of various markets assuming no market-moving forces. The follow-up post “Some market predictions enhanced some of those plots with … Continue reading...

## CloudStat School – The Introduction

January 1, 2012
By

CloudStat School is a not yet released open source project. The objective is to create an interactive R Learning Platform. The best way to learn R programming is doing while learning. In CloudStat School, you will see a console box at your top left han...

## Reproducible Research with R: Cost of energy and mutual shadows in a two-axis tracking PV system

January 1, 2012
By

Some days ago the journal Renewable Energy published my last paper “Cost of energy and mutual shadows in a …Continuar leyendo »

## Decoding a Substitution Cipher using Simulated Annealing

January 1, 2012
By
$Decoding a Substitution Cipher using Simulated Annealing$

My last post discussed a method to decode a substitution cipher using a Metropolis-Hastings algorithm. It was brought to my attention that this code could be improved by using Simulated Annealing methods to jump around the sample space and avoid some of the local maxima. Here is a basic description of the difference: In a

## R-Function to Source all Functions from a GitHub Repository

January 1, 2012
By

Here's a function that sources all scripts from an arbitrary github-repository. At the moment the function downloads the whole repo and sources functions kept in a folder named "Functions" - this may be adapted for everyones own purpose.# Script name: ...