Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
x = 2+2
y = c(1,1,1,1,1,1,1,2,3,4)
resp = data.frame(id=1:5, name=c("piet", "jan", "klaas", "marie", "klaas"), iq=90:94)
topd = read.csv("data/income_topdecile.csv")
summary(topd)
mean(topd$France, na.rm = T)
topd
topd = topd[!is.na(topd$France), ]
topd = na.omit(topd)
topd
postwar = topd[topd$Year > 1945, c("Year", "France")]
goodyears = topd$Year > 1945
postwar = topd[goodyears, c("Year", "France")]
topd$Germany[topd$Year == 1980] = NA
pwm = mean(topd$Germany[topd$Year > 1945], na.rm = T)
topd$Germany[is.na(topd$Germany)] = pwm
postwar = topd[topd$Year > 1945,](
with(topd[topd$Year > 1945,], t.test(France, U.S., paired=T))
with(topd, t.test(France, U.S., paired=T))
t.test(postwar$France, postwar$U.S., paired = T)
topd
sdswe = sd(topd$Sweden)
# first row is measurement error
resp = resp[-1, ]
# remove outliers based on Z>1
threshold = mean(topd$Sweden) + sd(topd$Sweden)
topd$Sweden[topd$Sweden > threshold] = NA
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment