Displaying 1 result from an estimated 1 matches for "chol1".
Did you mean:
chol
2007 Apr 05
1
Generate a serie of new vars that correlate with existingvar
...a matrix, these will be modified to meet the criteria
x234 <- scale(matrix( rnorm(ndistr*length(x1)), ncol=ndistr ))
# put all into 1 matrix for simplicity
x1234 <- cbind(scale(x1),x234)
# find the current correlation matrix
c1 <- var(x1234)
# cholesky decomposition to get independence
chol1 <- solve(chol(c1))
newx <- x1234 %*% chol1
# check that we have independence and x1 unchanged
zapsmall(cor(newx))
all.equal( x1234[,1], newx[,1] )
# create new correlation structure
newc<-diag(ndistr+1)
newc[1,-1]<- coefs
newc[-1,1]<- coefs
chol2 <- chol(newc)
finalx <- n...