What am I doing wrong for my R code?

Jul 2015
631
17
United States
Romsek, would this be considered correct?
 

Attachments

romsek

MHF Helper
Nov 2013
6,758
3,041
California
yes this is what I am after.
well you need something like this pseudo code
for n=1 to 10
gen up a set of 40 points that are uniform[0,2]
for j = 1 to 40
put together means[n] the way you have such that m[n,j] = mean[1st j elements of data]
endfor
finalmean[n] = mean[n,40]
endfor
Plot the n means arrays
Do a histogram of finalmean and plot it

sigh it destroyed all my spacing.
 

romsek

MHF Helper
Nov 2013
6,758
3,041
California
Cant I just do for loop?
this isn't correct because the data generation lies outside the loop. You are just repeating the same procedure on the same data set over and over.
 

romsek

MHF Helper
Nov 2013
6,758
3,041
California
Romsek, would this be considered correct?
I think you have the right idea here but jeeze, put each analysis inside the outer loop. Don't treat the first analysis special as you have.
 
Jul 2015
631
17
United States
I'm not sure what you mean. Put each analysis inside the outer loop? :S? My TA told me to generate 1st path, then remaining paths do for loop. is there better way to do?
 

romsek

MHF Helper
Nov 2013
6,758
3,041
California
I'm not sure what you mean. Put each analysis inside the outer loop? :S? My TA told me to generate 1st path, then remaining paths do for loop. is there better way to do?
what? Just put all 10 inside a loop. Wth is wrong w/your TA.