Description Usage Arguments Value See Also Examples
Simulation for R-vine copulas, bivariate copulas in the same parametric family for each tree; current version assume each bivariate copula family is permutation symmetric
1 2 3 4 5 6 7 8 9 | cvinesim(p,parmat,qcond,pcond) # same pcond for all trees
dvinesim(p,parmat,qcond,pcond,iprint=F) # same pcond for all trees
rvinesim0(p,A,parmat,qcond,pcond,iprint=F) # same pcond for all trees
rvinesim1(p,A,parmat,qcondnames,pcondnames,iprint=F)
rvinesim2(p,A,parvec,np,qcondnames,pcondnames,iprint=F)
rvinesimvec(nsim,A,parvec,np,qcondnames,pcondnames,iprint=F)
# common pair-copula family for each tree
rvinesimvec2(nsim,A,ntrunc,parvec,np,qcondmat,pcondmat,iprint=F)
# can be different pair-copula family for each edge of vine
|
p |
vector of length d, e.g. runif(d) |
nsim |
sample size for simulation |
A |
dxd vine array with 1:d on diagonal, or ntrunc x d vine array as only ntrunc rows are used |
ntrunc |
truncation level between 1 and d-1 |
qcond |
function for inverse conditional cdf C_{U|V}^{-1}(u|v) |
pcond |
function for conditional cdf C_{U|V}(u|v) |
qcondnames |
names of inverse conditional cdf functions C_{U|V}^{-1}(u|v), for trees 1,...,ntrunc (so ntrunc=length(qcondnames) for these implementations) |
pcondnames |
names of conditional cdf functions C_{U|V}(u|v), for trees 1,...,ntrunc |
qcondmat |
matrix of names of conditional quantile functions for trees 1,...,ntrunc |
pcondmat |
matrix of names of conditional cdfs for trees 1,...,ntrunc |
parmat |
dxd matrix: for rvinesim1, where all bivariate copula families have 1 parameter, parameter in parmat[ell,j] for ell<j is the parameter of the copula associated with A[ell,j] |
parvec |
vector: for rvinesim2 and rvinesimvec, with the union of the parameters associated with the copulas in A[ell,j], j=ell+1,...,d. ell=1,...,ntrunc |
np |
dxd matrix: for rvinesim2 and rvinesimvec, the dimension of the vector for the copulas in A[ell,j], j=ell+1,...,d. ell=1,...,ntrunc; the function will determine parvec[ip1:ip2] for the copula associated with A[ell,j] |
iprint |
print flag for intermediate results |
vector of length d of values on (0,1) for cvinesim, dvinesim, rvinesim0, rvinesim1 and rvinesim2.
data matrix (each element between 0 and 1) of dimension nsimxd for rvinesimvec
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
d=5
C=Cvinearray(d); D=Dvinearray(d)
p=c(.4,.5,.6,.4,.7)
parmat=matrix(c(0,2,3,4,5,0,0,6,6,3,0,0,0,4,3,0,0,0,3,3,0,0,0,0,2),5,5,byrow=TRUE)
cvinesim(p,parmat,qcondfrk,pcondfrk)
rvinesim0(p,C,parmat,qcondfrk,pcondfrk) # same as above line
dvinesim(p,parmat,qcondfrk,pcondfrk)
rvinesim0(p,D,parmat,qcondfrk,pcondfrk) # same as above line
#
d=7
qcondnames=rep("qcondfrk",3)
pcondnames=rep("pcondfrk",3)
parvec=c(2,3,4,5,6,6, 3,4,3,3,3, 2,2,2,2)
np=matrix(0,d,d)
np[1,2:d]=1; np[2,3:d]=1; np[3,4:d]=1
A3=vnum2array(d,300)
nsim=10
uu1=matrix(0,nsim,d)
for(i in 1:nsim)
{ pp=runif(d)
uu1[i,]=rvinesim2(pp,A3,parvec,np,qcondnames,pcondnames,iprint=FALSE)
}
print(summary(uu1))
print(cor(uu1))
# vectorized rvinesim
uu2=matrix(0,nsim,d)
uu2=rvinesimvec(nsim,A3,parvec,np,qcondnames,pcondnames,iprint=FALSE)
print(summary(uu2))
print(cor(uu2))
# BB1/Frank
qcondnames3=c("qcondbb1","qcondfrk","qcondfrk")
pcondnames3=c("pcondbb1","pcondfrk","pcondfrk")
parvec=c(.8,2,.7,1.6,.3,2.1,.6,1.5,.9,2.3,.9,2.4, 3,4,3,3,3, 2,2,2,2)
np2=matrix(0,d,d)
np2[1,2:d]=2; np2[2,3:d]=1; np2[3,4:d]=1
uu3=rvinesimvec(nsim,A3,parvec,np2,qcondnames3,pcondnames3,iprint=FALSE)
print(uu3)
# version with different pair-copula on different edges
d=4
D=Dvinearray(d)
np=matrix(0,d,d)
np[1,2:d]=1; np[2,3:d]=1; np[3,4:d]=1
qcondnames=c("qcondgum","qcondfrk","qcondfrk")
pcondnames=c("pcondgum","pcondfrk","pcondfrk")
parvec=c(2.0,2.2,1.6, 1.5,1.5, 0.3)
set.seed(1234)
rvinesimvec(2,D,parvec,np,qcondnames,pcondnames,iprint=FALSE)
pcondmat=matrix(c("",rep("pcondgum",3),"","",rep("pcondfrk",2),
"","","","pcondfrk",rep("",4)),4,4,byrow=TRUE)
qcondmat=matrix(c("",rep("qcondgum",3),"","",rep("qcondfrk",2),
"","","","qcondfrk",rep("",4)),4,4,byrow=TRUE)
set.seed(1234)
rvinesimvec2(2,D,ntrunc=3,parvec,np,qcondmat,pcondmat,iprint=FALSE) #as above
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.