# Blog Archives

## Obama approval

July 12, 2009
By

Working some more with time series data. Here we have a graph of Obama job approval numbers, with two LOWESS-fit lines added for trending: Figure1. President Obama job approval, Jan 2009 - present.There's actually some pretty fancy stuff going on there, as the following code shows.polls lfit1 lfit2 plot (app~daten, ylim=c(40,80), xlim=c(-3,210),pch=16, col="gray",cex.lab=1.25,cex.axis=0.75,col.lab = "#777777", xlab="",ylab="Obama...

## Return

July 6, 2009
By

I'm back from vacation, so I'll post something substantive later today.

## Time series data

June 28, 2009
By

gdp attach(gdp)as.Date(date)plot(gdp~date, data=gdp,pch=16,xlab="",ylab="GDP (2000 dollars)")

## Conservatism of Congressional delegation and %Bush vote

June 27, 2009
By

Busy day today, so I'll just post this:plot(bush04 ~ cons_hr, type = "n",xlab="Mean ACU rating",ylab="2004 Bush vote",xlim=c(0,100),ylim=c(0,100),cex.lab=1.25,cex.axis=0.75,col.axis = "#777777",col.lab = "#777777")text(y=bush04,x=cons_hr, labels=statei...

## Filtering cases

June 26, 2009
By

Something that's very important to be able to do in data analysis and visualization is to filter out cases. Let's say you want to do identical analyses of two different groups, or of one group and then a subset of it. R can do this a little differently; instead of merely filtering out cases you can create an object...

## A bit about linear models

June 26, 2009
By

Before we delve into slightly more advanced plotting commands I want to talk a little about linear models, specifically, linear regression. In R this is very, very simple. For instance, in our 'states' data frame, we might want to look at median household income as a predictor of state education expenditures. The command lm calculates this for us. We'll...

## Reading data, and a graph

June 25, 2009
By

Using Microsoft Excel I'm collecting aggregate data, by state, of various social, political, and economic indicators. I export them into a tab-delimited file called 'states.txt' (pretty clever, I know.) I've got data on education expenditures, firearm deaths per capita, median household income, etc. I'd like to do some analysis and graphing of these data to see if there are...

## A start

June 24, 2009
By

I've decided that this summer I will finally break down and force myself to learn a little bit about using R. I currently use Stata, a very good program, but the idea of R is appealing since it's free under the GNU license. It has a large and active us...