# \donttest{
#------------------------------------------------
# Setting quadreture points
nq <- 25
#------------------------------------------------
# PTSD Data
#------------------ -----------------
data(PTSD)
ydat=PTSD
d=ncol(ydat);d
n=nrow(ydat);n
#vine tree structure
#selecting vine tree based on polychoric corr
rmat=polychoric0(ydat)$p
A.polychoric=selectFactorTrVine(y=ydat,rmat,alg=3)
A.polychoric=A.polychoric$VineTreeA
#------------------------------------------------
# M1 1-factor tree - M2 1-factor tree
tau.m1 = rep(0.4,d*2-1)
copnames.m1 = rep("bvn",d*2-1)
tau.m2 = rep(0.4,d*2-1)
copnames.m2 = rep("rgum",d*2-1)
vuong.1factortree = vuong_FactorTree(models=1, ydat,
A.m1=A.polychoric, tau.m1, copnames.m1, tau.m2,
copnames.m2,A.m2=A.polychoric,nq)
#------------------------------------------------
# M1 2-factor tree - M2 2-factor tree
tau.m1 = rep(0.4,d*3-1)
copnames.m1 = rep("bvn",d*3-1)
tau.m2 = rep(0.4,d*3-1)
copnames.m2 = rep("rgum",d*3-1)
vuong.2factortree = vuong_FactorTree(models=2, ydat,
A.m1=A.polychoric, tau.m1, copnames.m1, tau.m2,
copnames.m2,A.m2=A.polychoric,nq)
#------------------------------------------------
# M1 1-factor tree - M2 2-factor tree
tau.m1 = rep(0.4,d*2-1)
copnames.m1 = rep("bvn",d*2-1)
tau.m2 = rep(0.4,d*3-1)
copnames.m2 = rep("rgum",d*3-1)
vuong.12factortree = vuong_FactorTree(models=3, ydat,
A.m1=A.polychoric, tau.m1, copnames.m1, tau.m2,
copnames.m2,A.m2=A.polychoric,nq)
# }
Run the code above in your browser using DataLab