R/lower.tri.to.corr.mat.R

Defines functions lower.tri.to.corr.mat

Documented in lower.tri.to.corr.mat

lower.tri.to.corr.mat <-
function(corr.vec=NULL,d){
if(length(corr.vec)!=(d*(d-1)/2)){
stop("Vector of correlations is misspecified, dimension is wrong!\n")}
corr.mat = diag(d)
corr.mat [ lower.tri(corr.mat,diag=FALSE)]<-corr.vec
corr.mat = corr.mat + t(corr.mat)
diag(corr.mat)=1
return(corr.mat)
}

Try the BinNor package in your browser

Any scripts or data that you put into this service are public.

BinNor documentation built on March 6, 2021, 1:08 a.m.