I am trying to simulate two data set for multiple linear regression. I want one data which is independent and identically distributed and the other is not. So far, I have done the following:
x1 <- rnorm(10000,11,.5) x2<-rnorm(10000,5,95) x3 <- rnorm(10000,5,.5) b1 <- 0.1 b2 <- 0.9 b3 <- 0.6 sigma <- 0.4 eps <- rnorm(x1,10000,sigma) y <- b1*x1 + b2*x2 + b3*x3 +eps Y<-as.matrix(y) X<-cbind(as.matrix(x1),as.matrix(x2),as.matrix(x3))
Does this satisfy the iid case? How to generate data that is not iid? For non iid case I am thinking of having autocorrelation.