structcop: Simulation and maximum likelihood for structured factor...

Description Usage Arguments Details Value References See Also Examples

Description

Simulation and maximum likelihood for structured nested and bi-factor copulas

Usage

1
2
3
4
simnestfact(nn,grsize,cop,param)
simbifact(nn,grsize,cop,param)
f90str1nllk(param,dstruct,iprfn=F) # nested-factor
f90str2nllk(param,dstruct,iprfn=F) # bi-factor

Arguments

nn

sample size

grsize

vector of group sizes for mgrp groups with sum(grsize)=d

cop

number code for a copula model: 1 for Gaussian/normal, 2 for Student t, 3 for Gumbel, 5 for Frank; 10 for Gumbel/BB1 for simnestfact; 9 for BB1/Frank for simbifact

param

parameter vector; length is d+mgrp+1(cop==2)

dstruct

structure that includes $quad for the gauss-legendre nodes and weights, $copname for the model, $data for data set of dependent U(0,1), $grsize for grsize. For t-factor model, also $nu for degree of freedom parameter. Also $repar is a code for reparametrization (check examples).

iprfn

flag for printing of function value and derivatives

Details

f90str1nllk: "t", "tbb1" (t for group latent to global latent, BB1 for observed to group latent), "tgum", "frank", "gumbel", "frkgum", "frkbb1", "gumbb1", "tgum",

f90str2nllk: "frank", "gumbel", "gumfrk", "bb1frk", "bb1gum", "t" "tapprox" (latter uses monotone interpolation for the Student t cdf)

The order of BB1 parameters for all of the models with a BB1 component is theta1,theta2,...thetad,delta1,....deltad, with thetas>0 and deltas>1.

This is different for BB1 parameters for the 1-factor BB1 and 2-factor BB1/Frank, where it is theta1,delta1,theta2,delta2,...,thetad.deltad.

The difference is due to how to handle the f90 code.

Value

data matrix of dimension nn x d for simnestfact() and simbifact() with U(0,1) or N(0,1) or t(df) margins.

$fnval, $grad, $hess for f90str1nllk and f90str2nllk.

References

Krupskii P and Joe H (2013). Structured factor copula models: theory, inference and computation.

See Also

factorcopmle factorcopsim mvtfact

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
 
gl=gausslegendre(25)
grsize=c(4,4,3)
d=sum(grsize)
n=500
# nested-factor copula
mgrp=length(grsize)
set.seed(123)
parne=c(rep(4,3),rep(6,4),rep(6.5,4),rep(7,3))
udatne=simnestfact(n,grsize,cop=5,parne)
dstrfrk=list(data=udatne,copname="frank",quad=gl,repar=0,grsize=grsize)
npar=mgrp+d
outn= pdhessminb(rep(3,npar),f90str1nllk, ifixed=rep(FALSE,npar), dstrfrk, 
  LB=rep(0,npar), UB=rep(30,npar), mxiter=30, eps=5.e-5,iprint=TRUE)
# bi-factor copula
set.seed(123)
parbi=c(rep(4,11),rep(6,4),rep(6.5,4),rep(7,3))
udatbi=simbifact(n,grsize,cop=5,parbi)
npar=2*d
dstrfrk=list(data=udatbi,copname="frank",quad=gl,repar=0,grsize=grsize,pdf=0)
nllk=f90str2nllk(parbi,dstrfrk)
outb=pdhessminb(c(rep(2,d),rep(3,d)),f90str2nllk,ifixed=rep(FALSE,npar),dstrfrk,
  LB=rep(0,npar), UB=rep(20,npar), mxiter=30, eps=5.e-5,iprint=TRUE)

YafeiXu/CopulaModel documentation built on May 9, 2019, 11:07 p.m.