I want to show that population density in the US correlates to voting habits (see attached csv).
I have data by county from the '08 election and '08 population density. Using R its easy to look at them, but what test should I use / algorithm should I apply to find:
what the "critical" population density is,
how accurately it predicts the counties vote,
and how might I visualise the data best?
currently, just playing around i have:
Thanks!Code:library(ggplot2) ddply(out,.(winner),function(x) { mean=mean(x$pop_density_09) median=median(x$pop_density_09) min=min(x$pop_density_09) max=max(x$pop_density_09) iqr=IQR(x$pop_density_09) lower=median-iqr/2 upper=median+iqr/2 return(data.frame(mean,median,min,max,iqr,lower,upper)) }) ggplot(out,aes(x=winner,y=pop_density_08))+geom_boxplot()+scale_y_log10() ggplot(out,aes(x=pop_density_08))+geom_freqpoly(aes(y=..density..,colour=winner),binwidth=0.2)+scale_x_log10()
Justin
election_results_08.txt.zip
|
|