Hello: I am a bit confused by this problem. Can anyone give me some advice on this I would greatly appreciate it. Thank you for all your help. Need to create a for loop that saves the estimate of pi from each 0f 100 separate iterations and store it in a numeric vector (of length 100). The for loop should be placed in a function that allows the user to vary the sample size, the simulation size, the integration limits and the input function. In addition construct a histogram of the estimates and include a red vertical line at pi. ex1.fcn<-function(x){ h<-4/(1+x^2) return(h) } n=1000 a=0 b=1 my.rand.x=runif(n,min=a,max=b) pi.MC = ((b-a)/n)*sum(ex1.fcn(my.rand.x))
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.