Dear members,

I was trying to simulate W which is iid and depends on X and Y. 

Here are 2 methods:

Method 1:
x<-rnorm(100)
y<-rnorm(100)
w<-rnorm(100, 2x+y,1)

Method 2:
x<-rnorm(100)

y<-rnorm(100)

w<-2x+y+rnorm(100,0,1)



Are these methods comparable? 

Since x and y are vectors, the term 2x+y would return a vector. It seems that, 
given Method 1, each element of W would come from a different population with 
means depending on the value of x and y. Is that true? Or is Method 1 equally 
acceptable as Method 2 in creating W?

I'd really appreciate clues to this puzzle! Thanks!

K.





      
        [[alternative HTML version deleted]]

______________________________________________
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.

Reply via email to