library(preprocessCore) rows <- 11 times.Cols <- NULL for (cols in 2:500){ y <- matrix(rnorm(rows*cols),rows,cols) times.Cols <- c(times.Cols,system.time(Results <- rcModelPLM(y))[3]) } cols <- 11 times.Rows <- NULL for (rows in 2:500){ y <- matrix(rnorm(rows*cols),rows,cols) times.Rows <- c(times.Rows,system.time(Results <- rcModelPLM(y))[3]) } png("Simulation1_0.99.20.png",height=800,width=800) plot(2:500,times.Rows,col="red",type="l",main="Simulation 1 Results",xlab="Number of Rows or Columns",ylab="Time in seconds") lines(2:500,times.Cols,col="blue") legend(0,2.0,c("Increasing Cols holding rows fixed","Increasing rows holding cols fixed"),col=c("blue","red"),lty=1) dev.off() times.matrix <- rep(0,25^2) for (rep in 1:10){ cat(rep,"\n") cur.times.matrix <- NULL for (cols in seq(10,250,10)){ for (rows in seq(10,250,10)){ y <- matrix(rnorm(rows*cols),rows,cols) cur.times.matrix <- c(cur.times.matrix,system.time(Results <- rcModelPLM(y))[3]) } } times.matrix <- cur.times.matrix + times.matrix } times.matrix <- times.matrix/10 png("Simulation2a_0.99.20.png",height=800,width=1000) par(bg="blue",col="white",col.axis="white",col.lab="white",col.main="white") layout(matrix(c(1,2),ncol=2),widths=c(0.8,0.2)) image(seq(10,250,10),seq(10,250,10),log2(matrix(times.matrix,25,25)),col=terrain.colors(100),xlab="Number of rows",ylab="Number of cols",zlim=c(-12,log2(1.25)),main="Runtimes varying number of rows and columns") contour(seq(10,250,10),seq(10,250,10),matrix(times.matrix,25,25),add=TRUE,nlevels=20) image(t(matrix(seq(2^(-12),1.25,len=50),ncol=1)),col=terrain.colors(100),xaxt="n",yaxt="n") axes.where <- ( seq(-12,log2(1.25), len=21) -- 12)/(log2(1.25)--12) axes.what <- round(2^seq(log2(2^(-12)),log2(1.25),len=21),4) axis(2,axes.where,axes.what) dev.off() png("Simulation2b_0.99.20.png",height=800,width=800) par(bg="blue",col="white",col.axis="white",col.lab="white",col.main="white") par(mfrow=c(1,2)) matplot(seq(10,250,10),matrix(times.matrix,25,25),type="l",col=heat.colors(25),ylab="Time in seconds",xlab="Number of Rows",main="Increasing rows holding cols fixed") matplot(seq(10,250,10),t(matrix(times.matrix,25,25)),type="l",col=heat.colors(25),ylab="Time in seconds",xlab="Number of Cols",main="Increasing cols holding rows fixed") dev.off() rows <- 11 times.manyCols <- NULL for (cols in seq(10000,10,length=11)){ cat(cols,"\n") y <- matrix(rnorm(rows*cols),rows,cols) times.manyCols <- c(times.manyCols,list(system.time(Results <- rcModelPLM(y))[3])) } png("Simulation3_0.99.20.png",height=800,width=800) plot(seq(10,10000,length=11),rev(do.call("c",times.manyCols)),xlab="Number of cols",ylab="Time in seconds",main="Running time for matrix with 11 rows and variable number of columns",type="l") dev.off()