# Stage one
Corrs1DTB5H6 <-readLowTriMat("Corrs1_DTB5H6.dat", no.var=14)
n1_dtb5h6 <-c(369,432,364,101,241,304,266,197,637,82,44,46,216,500,819,164,
397,341,279,770,150,170,368,245,546,198,232,232,278,249,107,663,221)
rem1DTB5H6<-tssem1(Corrs1DTB5H6, n1_dtb5h6, method="REM", RE.type = "Zero", acov = "weighted")
summary(rem1DTB5H6)
# Stage two
PhiDTB5H6d1<-matrix(c(1,"0.3*cor1","0.3*cor2","0.3*cor1",1,"0.3*cor3","0.3*cor2","0.3*cor3",1),ncol=3, nrow=3)
PsiDTB5H6d1<-Diag(c("0.2*e1","0.2*e2","0.2*e3","0.2*e4","0.2*e5","0.2*e6","0.2*e7","0.2*e8","0.2*e9","0.2*e10","0.2*e11","0.2*e12","0.2*e13","0.2*e14"))
SDTB5H6d1<-bdiagMat(list(PsiDTB5H6d1, PhiDTB5H6d1))
dimnames(SDTB5H6d1)[[1]]<-dimnames(SDTB5H6d1)[[2]]<-c("M","N","P","5O","5C","5E","5A","5N","6H","6E","6X","6A","6C","6O","DT","Alpha","Beta")
SDTB5H6d1
LambdaDTB5H6d1<-matrix(c(".3*DT_M",".3*DT_N",".3*DT_P",0,0,0,".3*DT_5A",0,".3*DT_6H",rep(0,2),".3*DT_6A",rep(0,6),".3*Alpha_5C",0,".3*Alpha_5A",".3*Alpha_5N",0,".3*Alpha_6E",0,".3*Alpha_6A",
".3*Alpha_6C",rep(0,2),".3*Beta_Nar",0,".3*Beta_5O",0,".3*Beta_5E",rep(0,4),".3*Beta_6X",rep(0,2),".3*Beta_6O"),ncol=3, nrow=14)
ADTB5H6d1<-rbind(cbind(matrix(0,ncol=14,nrow=14),LambdaDTB5H6d1), matrix(0,ncol=17,nrow=3))
dimnames(ADTB5H6d1)[[1]]<-dimnames(ADTB5H6d1)[[2]]<-c("M","N","P","5O","5C","5E","5A","5N","6H","6E","6X","6A","6C","6O","DT","Alpha","Beta")
ADTB5H6d1
FDTB5H6d1<-create.Fmatrix(c(1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0), as.mxMatrix=FALSE)
FDTB5H6d1
randomDTB5H6d1<-tssem2(rem1DTB5H6, Amatrix=ADTB5H6d1, Smatrix=SDTB5H6d1, Fmatrix=FDTB5H6d1, intervals="LB")
summary(randomDTB5H6d1)