I want perform monte-carlo simulations for 12 iterations with mean varying from 5 to 60 by an interval of 5. As an output of the following code I want each simulation result in a different columns as a data frame. For instance, if I want to perform 10,000 simulations for each set of mean and std.dev, the resultant dataframe will have 12 columns and 10000 rows. The code is:
df<-data.frame()
for (i=5; i<=60; i=i+5)
{
{
cvsq=1
mcs=rnorm(10000,i,(i*cvsq))
op$i<-data.frame(mcs)
}
df<-cbind(op)
}
df
The results from this code is a data frame with two columns with simulation results for 60 and 5 only.
for(i in seq(5, 60, 5))
... – Edward