# \donttest{
#------------------------------------------------
# Setting quadreture points
nq <- 5
gl <- gauss.quad.prob(nq)
#------------------------------------------------
# PTSD Data
#------------------ -----------------
data(PTSD)
ydat=PTSD
n=nrow(ydat)
d=ncol(ydat)
#------------------------------------------------
# Estimation
#------------------ -----------------
#selecting vine tree based on polychoric
rmat=polychoric0(ydat)$p
A.polychoric=selectFactorTrVine(y=ydat,rmat,alg=3)
#---------------- 1-factor tree ----------------
# 1-factor tree copula model
copf1 <- rep("frk",d)
coptree <- rep("frk",d-1)
cop <- c(copf1,coptree)
est1factortree <- mle1FactorTree(y=ydat, A=A.polychoric$VineTreeA, cop,
gl, hessian=FALSE, print.level=2)
#---------------- 2-factor tree ----------------
# 2-factor tree copula model
copf1 <- rep("frk",d)
copf2 <- rep("frk",d)
coptree <- rep("frk",d-1)
cop <- c(copf1,copf2,coptree)
est2factortree <- mle2FactorTree(y=ydat, A=A.polychoric$VineTreeA,
cop, gl, hessian=FALSE, print.level=2)
# }
Run the code above in your browser using DataLab