Skip to content

Instantly share code, notes, and snippets.

View Protonk's full-sized avatar
🗯️
Before the hinge

Adam Hyland Protonk

🗯️
Before the hinge
View GitHub Profile
@Protonk
Protonk / structure.md
Last active August 29, 2015 14:09
draft ideas

Feminism

Establishing feminist critique as pushing against cultural resentment

"Prominent feminist critique — present in every other relevant medium, but new to games — has elicited massive backlash and threats to women working in the field."

"He was a seaman, but he was a wanderer, too, while most seamen lead, if one may so express it, a sedentary life. Their minds are of the stay-at-home order, and their home is always with them—the ship; and so is their country—the sea. One ship is very much like another, and the sea is always the same. In the immutability of their surroundings the foreign shores, the foreign faces, the changing immensity of life, glide past, veiled not by a sense of mystery but by a slightly disdainful ignorance; for there is nothing mysterious to a seaman unless it be the sea itself, which is the mistress of his existence and as inscrutable as Destiny. For the rest, after his hours of work, a casual stroll or a casual spree on shore suffices to unfold for him the secret of a whole continent, and generally he finds the secret not worth knowing. The yarns of seamen have a direct simplicity, the whole meaning of which lies within the shell of a cracked nut."

Heart of Darkness, Joseph Conrad.

@Protonk
Protonk / gist:712312
Created November 23, 2010 19:09
PPP and GDP relationships
#The following code requires a few packages to be installed, namely animation, WDI, and ggplot2.
#You can install them by typing install.packages("ggplot2"), inserting the package name. This
#requires an internet connection, because it is downloading a package from a mirror.
#Loads a library to access World Bank data automatically.
library(WDI);
#Loads a graphics library which makes nicer graphs than base R.
library(ggplot2);
#How does this change across years?
@Protonk
Protonk / gist:712327
Created November 23, 2010 19:15
WDI PPP start
#The following code requires a few packages to be installed, namely animation, WDI, and ggplot2.
#You can install them by typing install.packages("ggplot2"), inserting the package name. This
#requires an internet connection, because it is downloading a package from a mirror.
#Loads a library to access World Bank data automatically.
library(WDI);
#Loads a graphics library which makes nicer graphs than base R.
library(ggplot2);
#How does this change across years?
@Protonk
Protonk / gist:712329
Created November 23, 2010 19:15
WDI PPP Plots
#Plots
overall.plot<-qplot(log(GDP.per),lambda,data=GDP.giant,geom="point",alpha=I(0.3))+stat_smooth(method="lm");
byregion.plot<-qplot(log(GDP.per),lambda,data=GDP.giant,colour=region,geom="point",alpha=I(0.3),log="x")+facet_wrap(~region)+scale_y_continuous(limits=c(0,4))+scale_x_continuous('')+opts(aspect.ratio = 0.5);
lambda.year.plot<-qplot(year,lambda,data=GDP.giant,colour=region,geom="smooth")+scale_y_continuous(limits=c(0,2));
@Protonk
Protonk / gist:712330
Created November 23, 2010 19:16
WDI Beta over Time
#Build a dataframe for the value of Beta Across the years
i<-0
beta.years<-matrix(0,2,30);
#This is a control structure which calculates a linear model for each year in the dataset and fills
#in the point estimate for the slope and the stardard error of that estimate into a matrix which
#we turn into a data frame.
for(i in sort(unique(GDP.giant$year))) {#
beta.years[1,i-min(unique(GDP.giant$year))+1]<-coef(summary(lm(lambda~log(GDP.per),data=subset(GDP.giant,year==i))))[2,1]#
beta.years[2,i-min(unique(GDP.giant$year))+1]<-coef(summary(lm(lambda~log(GDP.per),data=subset(GDP.giant,year==i))))[2,2]
}
@Protonk
Protonk / taxes.R
Created December 2, 2010 06:04
A largely fruitless attempt at circle plotting
library(WDI)
library(ggplot2);
taxes.df<-WDI(country="all",indicator=c("GC.TAX.TOTL.GD.ZS","NY.GDP.MKTP.KD.ZG","NY.GDP.PCAP.KD"),start=2001,end=2009,extra=TRUE);
names(taxes.df)[4:6]<-c("Tax.Revenue","GDP.Growth","GDP")
taxes.df<-subset(taxes.df,taxes.df$region != "Aggregates")
mean.taxes.df<-ddply(taxes.df, .(country),summarise,growth=mean(GDP.Growth,na.rm=TRUE),tax=mean(Tax.Revenue,na.rm=TRUE),GDP=mean(GDP,na.rm=TRUE));
taxes.plot<-ggplot(mean.taxes.df,aes(tax,growth,size=GDP))+geom_point(colour="light green")+geom_point(alpha=0.4)+scale_x_continuous("Taxes as a Percentage of GDP",limits=c(0,40))+scale_y_continuous("GDP Growth Rate")+scale_area("GDP per Capita",to=c(1,15));
@Protonk
Protonk / growth path.R
Created December 2, 2010 18:03
Just a simple time series
library(WDI)
library(ggplot2)
growth.df<-WDI(country="all",indicator="NY.GDP.MKTP.KD.ZG",start=1961,end=2009,extra=TRUE)
growth.df<-subset(growth.df,growth.df$region != "Aggregates")
qplot(year,NY.GDP.MKTP.KD.ZG,data=growth.df,group=country,geom="line",alpha=I(0.1))+scale_y_continuous("GDP Growth");
@Protonk
Protonk / Differences and spread.R
Created December 4, 2010 21:08
A first crack at behavior of GDP growth
library(WDI)
library(ggplot2)
#Need it for GLS later
library(nlme)
growth.df<-WDI(country="all",indicator="NY.GDP.MKTP.KD.ZG",start=1961,end=2009,extra=TRUE);
growth.df<-subset(growth.df,growth.df$region != "Aggregates")
growth.df<-growth.df[,c(2:4)]
names(growth.df)<-c("country","year","growth")
growth.df$country<-as.factor(growth.df$country)
@Protonk
Protonk / growth time series.R
Created December 5, 2010 19:20
Ended up not needing this for the previous post
library(WDI)
growth.df<-WDI(country="all",indicator="NY.GDP.MKTP.KD.ZG",start=1961,end=2009,extra=TRUE);
growth.df<-subset(growth.df,growth.df$region != "Aggregates")
growth.df<-growth.df[,c(2:4)]
names(growth.df)<-c("country","year","growth")
growth.df$country<-as.factor(growth.df$country)
#TS stuff
pre.ts<-cast(melt.data.frame(growth.df,id.vars=c("country","year")),year~country);
growth.ts<-ts(pre.ts,start=1961,end=2009,frequency=1)