#Generating 99 pairs of datasets
for (i in 1:99) {
set.seed(i)
X1 <- rnorm(100, mean=3, sd=sqrt(10))
X2 <- rnorm(100, mean=-2, sd=sqrt(3))
X1sq <- X1^2
X2sq <- X2^2
X1X2 <- X1*X2
a <- exp(0.2*X1sq + 0.3*X2sq + 0.7*X1X2)
b <- 1 + exp(0.2*X1sq + 0.3*X2sq + 0.7*X1X2)
px3 <- a/b
Y <- rbinom(100, 1, px3)
newtest <- data.frame(X1, X2, Y)
}
Hi guys, essentially I would like to generate 99 pairs of data sets, via the loop function. And each new test should be a data frame consisting of new sets of values of X1, X2 and Y respectively.I am not sure if my loop written above is correct so I would like to seek help if possible!