What am I doing wrong for my R code?

romsek

MHF Helper
Nov 2013
6,725
3,030
California
I don't even understand what they are asking you to do.

What is a "path of sample means" ?
 
Jul 2015
603
15
United States
For 1 path:
$\bar{X_1}, \bar{X_2}, \bar{X_3},..., \bar{X_{40}}$

where $\bar{X_1} = X_1, \bar{X_2}= \frac{X_1 + X_2}{2},....., \bar{X_{40}}= \frac {X_1 + X_2 + ...+ X_{40}}{40}$

so I want 10 paths of theses.
 
Last edited:
Jul 2015
603
15
United States
dont know why the '40' is all glitchy.
 
Dec 2014
153
117
USA
For 1 path:
$\bar{X_1}, \bar{X_2}, \bar{X_3},..., \bar{X_{40}}$

where $\bar{X_1} = X_1, \bar{X_2}= \frac{X_1 + X_2}{2},....., \bar{X_{40}}= \frac {X_1 + X_2 + ...+ X_{40}}{40}$

so I want 10 paths of theses.

dont know why the '40' is all glitchy.
enclose the 40 in brackets

X_{40}
 

romsek

MHF Helper
Nov 2013
6,725
3,030
California
For 1 path:
$\bar{X_1}, \bar{X_2}, \bar{X_3},..., \bar{X_{40}}$

where $\bar{X_1} = X_1, \bar{X_2}= \frac{X_1 + X_2}{2},....., \bar{X_{40}}= \frac {X_1 + X_2 + ...+ X_{40}}{40}$

so I want 10 paths of theses.
It looks like a single path exhausts all your data. Do they want you to do this with 10 different sets of data?
 
Jul 2015
603
15
United States
I assume so,
essentially professor says she want this picture in the R Simulation. SO instead of m=100, m=10 for my case.
 

Attachments

romsek

MHF Helper
Nov 2013
6,725
3,030
California
It looks like you are just overwriting your initial assignment of the array m.
The first time through you go through all 40 data values.
The second time through you just go through 10 of them overwriting m

I really don't understand the intent of your code. If you intend to just repeat filling the mean array 10 times then you'll need to generate new data each time.
Further you'll have to store all this in 10 different mean arrays if you are to plot them all on the same graph.
 

romsek

MHF Helper
Nov 2013
6,725
3,030
California
This is mathematica rather than RStudio but let me know if this is what you are after.

Clipboard01.jpg
 
Jul 2015
603
15
United States
yes this is what I am after.