Reputation: 421
Here they use ei
to denote the random normal error, can any one explain why they use:
rnorm(length(xi),0,1)
to express this:
ei = rnorm(length(xi),0,1)
yi = sin(2*pi*xi)+ei
Upvotes: 1
Views: 52
Reputation: 25395
See the documentation for rnorm, we can use that to explain your statement:
ei = rnorm(length(xi),0,1)
length(xi)
because you want an error term for each observation.0,1
because you want the errors to be random normal (mean 0, standard deviation 1)Hope this helps.
Upvotes: 3