#Foundations and Applications of Econometrics, Spring 2015, Pepared by Dr. I-Ming Chiu
#Accompany 368_Handout06.pdf
#Simulation of Table 6.2 (pp. 1)
rm(list=ls())
outcome = matrix(rep(0,400), 4, 100)
x = numeric()
y = numeric()
for (j in 1:100){
outcome[,j] = sample(c(0,1), 4, replace = T)
x = colSums(outcome[1:3,])
y = colSums(outcome)
}
counttable = table(x, y)
counttable
freqtable = prop.table(counttable)
freqtable
*The rest of the R codes needed for this handout will be presented in our meetings. I'll write the codes with you.