Dear R HPC People:

I currently have a few functions to run a simulation study, which works fine in R.  

Now I've decided to try to run this on the cluster here.

My functions look like this:

chowsim <- function(n1=10,phi1=0.5) {
	w <- matrix(0,nrow=n1,ncol=1)
	for(ii in 1:n1) {
	x1 <- arima.sim(list(order=c(1,0,0),ar=phi1),360)
	y1 <- arima.sim(list(order=c(1,0,0),ar=phi1),360)
	newone <- chow1(x=x1,y=y1,m=3)
	mse <- sum((x1-newone)^2)/360
	w[ii,1] <- mse
	}
	zzz <- list(mean=mean(w[,1]),sd=sd(w[,1])/sqrt(360))
	return(zzz)
}


chow1 <- function(x,y,m=3) {
	nm <- length(x)
	n <- nm/m
	xq <- yq <- matrix(0,nrow=n,ncol=1)
	c1 <- (1/m)*cdgen(n,m)
	xq <- c1 %*% x
	yq <- c1 %*% y
	vv <- c1 %*% t(c1)
	vvi <- solve(vv)
	xvx <- t(xq) %*% vvi %*% xq
	xvxi <- solve(xvx)
	beta <- xvxi %*% t(xq) %*% vvi %*% yq
	res1 <- yq - xq %*% beta
	cv1 <- t(c1) %*% vvi
	newy <- x %*% beta + cv1%*%res1
	return(newy)
}




cdgen <- function(n,m) {
	x <- rep(1,m)
	nm <- n*m
	cd <- matrix(0,nrow=n,ncol=nm)
	xg <- seq(from=1,by=m,length=n)
	xh <- seq(from=m,by=m,length=n)
	for(i in 1:n) {
		cd[i,xg[i]:xh[i]] <- x
	}
	return(cd)
}




My big question is:  I want to run n1 simulations, where n1 can go up to 10,000.  How do I fix this to run n1 sims, without regard to which slaves get the functions, please?

Thanks, 
Erin


Erin M. Hodgess, PhD
Associate Professor
Department of Computer and Mathematical Sciences
University of Houston - Downtown
mailto: hodgesse@uhd.edu


	[[alternative HTML version deleted]]

