Consider the data below,
n=3
phi0=1
phi1 <- 0.1
phi2 <- 0.2
W2=runif(n,0,1)
W3=runif(n,0,1)
W <- cbind(W2,W3)
phi <- rbind(phi0,phi1,phi2)
rho <- 0.4
sigma1 <- exp(as.numeric(model.matrix(~W) %*% phi))
sigma2=1
library(MASS)
#Sigma <- ???
mu <- rep(0,2)
v <- mvrnorm(n, mu, Sigma)
sigma1 is my vector of variance.
I want to generate a bivariate vector v=(v1,v2) of length n with normal bivariate distribution. In such a way that the i-th line of v has a bivariate normal distribution of mean mu=(0,0), correlation rho=0.4 and variance sigma=(sigma1, 1) where sigma1 receives the value of the i-th line sigma1. How can I proceed?
Aucun commentaire:
Enregistrer un commentaire