rm(list=ls())
setwd("/Users/innoshuadmin/Dropbox/RDHeteroTest/RDMonoTest/simulationR1/mktable")
require(stargazer) 

nmodel=3
modelvec=c(0,nmodel,nmodel*2)
smvec=1:3
panel<-c("A","B")
for (ind in 1:2){
	load(paste("FRDpanel",panel[ind],"_model1.RData",sep=""))
	rej_DGP1<-cbind(rejincprop_ks[modelvec+1,smvec],rejdecprop_ks[modelvec+1,smvec],rejincprop_ks_gms[modelvec+1,smvec],rejdecprop_ks_gms[modelvec+1,smvec])
	load(paste("FRDpanel",panel[ind],"_model2.RData",sep=""))
	rej_DGP2<-cbind(rejincprop_ks[modelvec+2,smvec],rejdecprop_ks[modelvec+2,smvec],rejincprop_ks_gms[modelvec+2,smvec],rejdecprop_ks_gms[modelvec+2,smvec])
	load(paste("FRDpanel",panel[ind],"_model3.RData",sep=""))
	rej_DGP3<-cbind(rejincprop_ks[modelvec+3,smvec],rejdecprop_ks[modelvec+3,smvec],rejincprop_ks_gms[modelvec+3,smvec],rejdecprop_ks_gms[modelvec+3,smvec])	
	rej=rbind(rej_DGP1,rej_DGP2,rej_DGP3)
	rownames(rej) <- c("n=2000","n=4000","n=8000","n=2000","n=4000","n=8000","n=2000","n=4000","n=8000")
	stargazer(rej,digits=3,out = paste("simutable5",panel[ind],".tex",sep="")) 
}
