Monday, June 01, 2009

wget in Ubuntu

Archived some classical materials of a master's course Create a dir first then cd thisfolder then run the following in terminal. greenlinux4r@greenlinux4r-desktop:~/Desktop/DavidThissenPSY840$ sudo wget -r -l 2 -np http://www.unc.edu/courses/2007spring/psyc/840/001/

Wednesday, May 27, 2009

R on the cluster

Running Bayesian models on Ubuntu using WinBUGS in R. A downside of it is that WinBUGS window will not close automatically. Running the same bugs code using loop works in windows system. Dr. Gleman suggested to use OpenBUGS on Linux system through version=2 option. It allows the code run on back stage. But insalling OpenBUGS on linux is a little bit painful. Before jumping to OpenBUGS, I first tried to run some bugs jobs on HPCC cluster. loading modu R: @brody:~> module unload mvapich @brody:~> module load openmpi @brody:~> module load R @brody:~> R ~> library(Rmpi) # to get a code editor so you can try some code. This is not a good idea. Try code on local #computer may be preferable. > install.packages(Rcmdr) I failed to call it on the cluster. I may let it go and find another route. Now I am going to try JAGA. http://www-fis.iarc.fr/~martyn/software/jags/ It has been suggested to be used in linux. http://www.nabble.com/Re:-R-vs.-Bugs-p18060894.html

Saturday, May 16, 2009

Combine biased and unbiased samples

It appears on Statistical Science V21 N.4 2006 Nov. p517 biased sample: non-random sample/ convenient sample Graves et al (2006) developed a hypergeometric model with a bias parameter to identify the feature-prevalence in a population when convenient samples are used. MCMC was used and the prior on bias parameter was set as lognormal. Graves et al (2006) was on Technometrics.

Wednesday, January 14, 2009

Rmpi on a multiple-cpu pc under linux system

RMPI: An R package that can execute message passing interface, which allows parellel computaion in R enviroment. On an multiple cpu computer such as Dell insprion 530, on can run RMPI for parellel compution. Suppose Rmpi has been installed completely in R following the instruction (rmpi README file). Open a Terminal, type greenlinux4r@greenlinux4r-desktop:~$ lamclean greenlinux4r@greenlinux4r-desktop:~$ lamboot -v LAM 7.1.2/MPI 2 C++/ROMIO - Indiana University n-1<6366> ssi:boot:base:linear: booting n0 (localhost) n-1<6366> ssi:boot:base:linear: finished greenlinux4r@greenlinux4r-desktop:~$ mpiexec -n 4 R --no-save -q master (rank 0, comm 1) of size 4 is running on: greenlinux4r-desktop slave1 (rank 1, comm 1) of size 4 is running on: greenlinux4r-desktop slave2 (rank 2, comm 1) of size 4 is running on: greenlinux4r-desktop slave3 (rank 3, comm 1) of size 4 is running on: greenlinux4r-desktop One master and three co-working CPUs have been activated for use. Now, run R code to let the co-working CPUS to identify themselves. mpi.remote.exec(paste("I am",mpi.comm.rank(),"of",mpi.comm.size())) $slave1 [1] "I am 1 of 4" $slave2 [1] "I am 2 of 4" $slave3 [1] "I am 3 of 4" All co-working CPUS can be closed and Rmpi can be exited using > mpi.close.Rslaves() [1] 1 > mpi.quit([saving=yes/no]) type in yes to save workplace, otherwise no.