# What am I doing wrong for my R code?

#### math951

pictures down below

#### Attachments

• 66.5 KB Views: 10
• 202.2 KB Views: 11

#### romsek

MHF Helper
I don't even understand what they are asking you to do.

What is a "path of sample means" ?

#### math951

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:

#### math951

dont know why the '40' is all glitchy.

#### Cervesa

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
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?

#### math951

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

• 406.8 KB Views: 7

#### romsek

MHF Helper
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
This is mathematica rather than RStudio but let me know if this is what you are after.

#### math951

yes this is what I am after.