1
2 N <- 100;
3 x <- numeric(N);
4 y <- numeric(N);
5 x[1] <- -100;
6 y[1] <- -100;
7 for (i in 2:N) {
8 x[i] <- rnorm(1, 2 + (y[i - 1] - 3) / 6, sqrt(115 / 3))
9 y[i] <- rnorm(1, 3 + (x[i] - 2) / 4, sqrt(115 / 2))
10 }
11 library(mixtools)
12 plot(y ~ x);
13 mu <- c(2, 3);
14 Sigma <- matrix(c(40, 10, 10, 60), ncol = 2)
15 ellipse(mu, Sigma);
16
No comments:
Post a Comment