update sample means demo

This commit is contained in:
glmdev 2019-05-02 19:04:58 -05:00
parent 1e1560974e
commit 7c05303cda

View File

@ -2,7 +2,7 @@ if ( !is.loaded("mpi_initialize") ){
library(Rmpi)
}
number_of_plots = 5
number_of_plots = 10
nodes = mpi.universe.size()-1
mpi.spawn.Rslaves(nslaves=nodes)
@ -11,7 +11,7 @@ generate_plot <- function(filename){
samples = rep(NA, 100000)
for ( i in 1:100000 ){ samples[i] = mean(rexp(40, 0.2)) }
jpeg(paste('plots/', filename, '.jpg', sep=""))
jpeg(paste('plots/plot', filename, '.jpg', sep=""))
hist(samples, main="", prob=T)
lines(density(samples), col="darkblue", lwd=3)