User Tools

Site Tools


lab:projects:12bayesian_random_coefficients_lcsm:r_codes_to_run_the_simulation
for (r in 1:1000){
  ## copy data
  from.file<-paste('/pscratch/zzhang4/Private/LCSM/data/simdata-N',NSIM,'-T',TSIM,'-',r,'.txt', sep='')
  to.file<-paste('/pscratch/zzhang4/Private/LCSM/analysis/N',NSIM,'T',TSIM,'/data.txt', sep='')
  file.copy(from.file, to.file,overwrite =TRUE)
  
  runtry<-try(system('/pscratch/zzhang4/Private/bugs/bin/OpenBUGS  < script.txt > out.txt'))
  if (class(runtry) != "try-error"){
  	## save the output
  	## copy the DIC
  	to.file<-paste('/pscratch/zzhang4/Private/LCSM/results/N',NSIM,'T',TSIM,'/DIC-',r,'.txt', sep='')
  	file.copy('out.txt', to.file)
  	## copy the coda file
  	to.file<-paste('/pscratch/zzhang4/Private/LCSM/results/N',NSIM,'T',TSIM,'/CODA-',r,'.txt', sep='')
  	file.copy('codaCODAchain1.txt', to.file)
  }
  unlink('data.txt')
  unlink('out.txt')
  unlink('codaCODAchain1.txt')
  unlink('codaCODAindex.txt')
}
lab/projects/12bayesian_random_coefficients_lcsm/r_codes_to_run_the_simulation.txt · Last modified: 2016/01/24 09:48 by 127.0.0.1