R/simBinCorr.R

Defines functions simBinCorr

Documented in simBinCorr

simBinCorr <-
function(ordPmat, CorrMat, no.rows, steps=0.025){

conformity.Check(ordPmat, CorrMat)
p=find.binary.prob(ordPmat) # range of p is checked here
pvec=p$p

Mlocation=p$Mlocation
del.next=CorrMat
change=1
iteration=0
cat("calculating the intermediate binary correlations. \n"); 
while ( sum(change>0.001) >0) {
iteration=iteration+1
ep0 = generate.binary( no.rows, pvec, del.next)
Mydata= BinToOrd(pvec, ordPmat, Mlocation, ep0)
if (iteration<15){del.next = del.next + ( CorrMat - Mydata$Corr )*0.9}
else {del.next = del.next + ( CorrMat - Mydata$Corr )*steps}
change = abs(CorrMat- Mydata$Corr)
if(iteration%%40==0){cat("\n")}
cat("."); 
}
cat("\n required ", iteration, " iterations to calculate intermediate binary correlations. \n"); 
return(list(del.next=del.next, Mlocation=Mlocation, pvec=pvec) )
}

Try the MultiOrd package in your browser

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

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