User Tools

Site Tools


lab:projects:15fexible_error:process_results
## dealing with student t distribution simulation results
library(coda)

newbind<-function(x,y){
	nx<-nrow(x)
	ny<-nrow(y)
	rmax<-max(nx,ny)
	cmax<-ncol(x)+ncol(y)
	temp<-array(NA, c(rmax, cmax))
	temp[1:nx, 1:ncol(x)]<-x
	temp[1:ny, (ncol(x)+1):cmax]<-y
	temp
}


allres<-list()
R <- 100

for (r in 1:R){
	ncoda<-read.table(paste('histnorm',r,'.txt', sep=''))
	tcoda<-read.table(paste('histt',r,'.txt', sep=''))
	ncoda<-ncoda[2:ncol(ncoda)]
	tcoda<-tcoda[2:ncol(tcoda)]
	ncoda<-as.mcmc(ncoda)
	tcoda<-as.mcmc(tcoda)
	norm.sum<-summary(ncoda)
	t.sum<-summary(tcoda)
	temp.norm<-cbind(norm.sum$statistics[,1:2], norm.sum$quantiles[,c(1,5)], geweke.diag(ncoda)$z,effectiveSize(ncoda) )
	temp.t<-cbind(t.sum$statistics[,1:2], t.sum$quantiles[,c(1,5)], geweke.diag(tcoda)$z,effectiveSize(tcoda) )
	temp.bind<-newbind(temp.norm, temp.t)
	allres[[r]]<-temp.bind
}
lab/projects/15fexible_error/process_results.txt · Last modified: 2016/01/24 09:48 by 127.0.0.1