Upload
lenga
View
230
Download
1
Embed Size (px)
Citation preview
The mlCopulaSelection PackageOctober 15, 2006
Type Package
Title Copula selection and fitting using maximum likelihood
Version 1.3
Date 2006-08-12
Author Jesus Garcia and Veronica Gonzalez-Lopez
Maintainer Jesus Garcia <[email protected]>
Description Use numerical maximum likelihood to choose and fit a bivariate copula model (from alibrary of 40 models) to the data.
License GPL version 2.
R topics documented:clibmodel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2dcbb1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3dcbb10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4dcbb2 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5dcbb3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6dcbb4 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7dcbb5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8dcbb6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9dcbb7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 10dcbb8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 11dcbb9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 12llbb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13llbb1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 14llbb10 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15llbb1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 16llbb1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17llbb1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18llbb5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19llbb6 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 20llbb7 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21llbb8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22llbb9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23mlCopulaSelection-package . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24
1
2 clibmodel
mlcbb . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 25mlcbbsel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
Index 30
clibmodel Auxiliary function used by the function mlcbbsel
Description
Auxiliary function used by the function mlcbbsel
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
## The function is currently defined asfunction(param,x,y, model = c("CBB1", "CBB2", "CBB3", "CBB4", "CBB5", "CBB6", "CBB7","CBB8", "CBB9", "CBB10","CMM1", "CMM2", "CMM3", "CMM4", "CMM5", "CMM6", "CMM7", "CMM8", "CMM9", "CMM10","CBM1", "CBM2", "CBM3", "CBM4", "CBM5", "CBM6", "CBM7", "CBM8", "CBM9", "CBM10","CMB1", "CMB2", "CMB3", "CMB4", "CMB5", "CMB6", "CMB7", "CMB8", "CMB9", "CMB10")) {model <- match.arg(model)switch(model,
CBB1 = llbb1(param,x,y),CBB2 = llbb2(param,x,y),CBB3 = llbb3(param,x,y),CBB4 = llbb4(param,x,y),CBB5 = llbb5(param,x,y),CBB6 = llbb6(param,x,y),CBB7 = llbb7(param,x,y),CBB8 = llbb8(param,x,y),CBB9 = llbb9(param,x,y),CBB10 = llbb10(param,x,y),CMM1 = llbb1(param,1-x,1-y),CMM2 = llbb2(param,1-x,1-y),CMM3 = llbb3(param,1-x,1-y),CMM4 = llbb4(param,1-x,1-y),CMM5 = llbb5(param,1-x,1-y),CMM6 = llbb6(param,1-x,1-y),CMM7 = llbb7(param,1-x,1-y),CMM8 = llbb8(param,1-x,1-y),CMM9 = llbb9(param,1-x,1-y),CMM10 = llbb10(param,1-x,1-y),CBM1 = llbb1(param,x,1-y),CBM2 = llbb2(param,x,1-y),CBM3 = llbb3(param,x,1-y),CBM4 = llbb4(param,x,1-y),CBM5 = llbb5(param,x,1-y),CBM6 = llbb6(param,x,1-y),CBM7 = llbb7(param,x,1-y),
dcbb1 3
CBM8 = llbb8(param,x,1-y),CBM9 = llbb9(param,x,1-y),CBM10 = llbb10(param,x,1-y),CMB1 = llbb1(param,1-x,y),CMB2 = llbb2(param,1-x,y),CMB3 = llbb3(param,1-x,y),CMB4 = llbb4(param,1-x,y),CMB5 = llbb5(param,1-x,y),CMB6 = llbb6(param,1-x,y),CMB7 = llbb7(param,1-x,y),CMB8 = llbb8(param,1-x,y),CMB9 = llbb9(param,1-x,y),CMB10 = llbb10(param,1-x,y))
}
dcbb1 BB1 copula density function
Description
Calculate the value of the BB1 density.
Usage
dcbb1(theta, delta, u, v)
Arguments
theta Parameter theta of the BB1. (0<theta)
delta Parameter delta of the BB1. (1<delta)
u First coordenate where de density will be evaluated. (0<u<1)
v Second coordenate where de density will be evaluated. (0<v<1)
Value
value of de density BB1 for the parameters theta and delta on ( u , v )
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
4 dcbb10
Examples
res<-dcbb1(0.5,1.5,0.90,0.85)
## The function is currently defined asfunction(theta,delta,u,v){S<-u^(-theta)-1;T<-v^(-theta)-1;-10**(4)W<-S^(delta)+T^(delta);DuS<-(-theta)*u^(-theta-1);DuW<-delta*S^(delta-1)*DuS;DvT<-(-theta)*v^(-theta-1);DvW<-delta*T^(delta-1)*DvT;densi<-(-1/(theta*delta))*(-1/theta-1)*(1+W^(1/delta))^(-1/theta-2)*(1/delta)*W^(1/delta-1)*DvW*W^(1/delta-1)*DuW-(1/(theta*delta))*(1+W^(1/delta))^(-1/theta-1)*(1/delta-1)*W^(1/delta-2)*DvW*DuW}
dcbb10 BB10 copula density function
Description
Calculate the value of the BB10 density.
Usage
dcbb10(theta, delta, u, v)
Arguments
theta Parameter theta of the BB10, (0<theta<1).
delta Parameter delta of the BB10, (0<delta).
u First coordenate where de density will be evaluated. (0<u<1)
v Second coordenate where de density will be evaluated. (0<v<1)
Value
value of de density BB10 for the parameters theta and delta on ( u , v )
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
dcbb2 5
Examples
res<-dcbb10(1.5,1.5,0.75,0.6)
## The function is currently defined asfunction(theta,delta,u,v){S<-1-u^(1/delta);T<-1-v^(1/delta);W<-theta*S*T;C<-u*v*(1-W)^(-delta);DuS<-(-1/delta)*u^(1/delta-1);DuW<-theta*T*DuS;DvT<-(-1/delta)*v^(1/delta-1);DvW<-theta*S*DvT;DvuW<-theta*DuS*DvT;densi<-(1-W)^(-delta)+v*(-delta)*(1-W)^(-delta-1)*(-1)*DvW+u*delta*(1-W)^(-delta-1)*DuW+u*v*delta*(-delta-1)*(1-W)^(-delta-2)*(-1)*DvW*DuW+u*v*delta*(1-W)^(-delta-1)*DvuW}
dcbb2 BB2 copula density function
Description
Calculate the value of the BB2 density.
Usage
dcbb2(theta, delta, u, v)
Arguments
theta Parameter theta of the BB2, (0<theta).
delta Parameter delta of the BB2, (0<delta).
u First coordenate where de density will be evaluated. (0<u<1)
v Second coordenate where de density will be evaluated. (0<v<1)
Value
value of de density BB2 for the parameters theta and delta on ( u , v )
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
6 dcbb3
Examples
res<-dcbb2(0.5,0.5,0.75,0.6)
## The function is currently defined asfunction(theta,delta,u,v){k<-exp(theta*(u^(-delta)-1));t<-exp(theta*(v^(-delta)-1));S<-k+t-1;h<-(1/theta)*log(S);duk<--k*(theta*delta)*u^(-delta-1);dvt<--t*(theta*delta)*v^(-delta-1);duS<-duk;dvS<-dvt;duh<-(1/theta)*duS/S;dvh<-(1/theta)*dvS/S;dvuh<-(-1/theta)*duS*dvS/S^2;densi<-(1/delta)*(1+1/delta)*(1+h)^(-2-1/delta)*dvh*duh-(1/delta)*(1+h)^(-1-1/delta)*dvuh
}
dcbb3 BB3 copula density function
Description
Calculate the value of the BB3 density.
Usage
dcbb3(theta, delta, u, v)
Arguments
theta Parameter theta of the BB3, (0<theta).
delta Parameter delta of the BB3, (1<delta).
u First coordenate where de density will be evaluated. (0<u<1)
v Second coordenate where de density will be evaluated. (0<v<1)
Value
value of de density BB3 for the parameters theta and delta on ( u , v )
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
dcbb4 7
Examples
res<-dcbb3(1.5,1.5,0.75,0.6)
## The function is currently defined asfunction(theta,delta,u,v){W<-exp(theta*(-log(u))^(delta));P<-exp(theta*(-log(v))^(delta));S<-W+P-1;h<-(1/theta)*log(S);F<-exp(-h^(1/delta));duS<-exp((-log(u))^(delta)*theta)*(-theta*delta/u)*(-log(u))^(delta-1);dvS<-exp((-log(v))^(delta)*theta)*(-theta*delta/v)*(-log(v))^(delta-1);dvuh<-(-1/theta)/S^2*duS*dvS;duh<-(1/theta)*duS/S;dvh<-(1/theta)*dvS/S;densi<-F*(1/delta^2)*(h^(1/delta-1))^2*dvh*duh+F*(-1/delta)*(1/delta-1)*(h)^(1/delta-2)*(dvh)*(duh)+F*(-1/delta)*(h)^(1/delta-1)*dvuh}
dcbb4 BB4 copula density function
Description
Calculate the value of the BB4 density.
Usage
dcbb4(theta, delta, u, v)
Arguments
theta Parameter theta of the BB4, (0<theta).
delta Parameter delta of the BB4, (0<delta).
u First coordenate where de density will be evaluated. (0<u<1)
v Second coordenate where de density will be evaluated. (0<v<1)
Value
value of de density BB4 for the parameters theta and delta on ( u , v )
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
8 dcbb5
Examples
res<-dcbb4(1.5,1.5,0.75,0.6)
## The function is currently defined asfunction(theta,delta,u,v){VV<-(u^(-theta)-1)^(-delta);
WW<-(v^(-theta)-1)^(-delta);h<-VV+WW;S<-u^(-theta)+v^(-theta)-1;duh<-delta*theta*u^(-theta-1)*(u^(-theta)-1)^(-delta-1);dvh<-delta*theta*v^(-theta-1)*(v^(-theta)-1)^(-delta-1);duS<-(-theta)*u^(-theta-1);dvS<-(-theta)*v^(-theta-1);densi<-(1/theta)*(1/theta+1)*(S-h^(-1/delta))^(-1/theta-2)*(dvS+1/delta*h^(-1/delta-1)*dvh)*(duS+1/delta*h^(-1/delta-1)*duh)+(-1/theta)*(S-h^(-1/delta))^(-1/theta-1)*((-1/delta)*(1/delta+1)*(h)^(-1/delta-2)*dvh*duh)}
dcbb5 BB5 copula density function
Description
Calculate the value of the BB5 density.
Usage
dcbb5(theta, delta, u, v)
Arguments
theta Parameter theta of the BB5, (1<theta).
delta Parameter delta of the BB5, (0<delta).
u First coordenate where de density will be evaluated. (0<u<1)
v Second coordenate where de density will be evaluated. (0<v<1)
Value
value of de density BB5 for the parameters theta and delta on ( u , v )
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
dcbb6 9
Examples
res<-dcbb5(1.5,1.5,0.75,0.6)
## The function is currently defined asfunction(theta,delta,u,v){t<-(-log(u))^(-theta*delta)+(-log(v))^(-theta*delta);
dut<-(theta*delta/u)*(-log(u))^(-theta*delta-1);dvt<-(theta*delta/v)*(-log(v))^(-theta*delta-1);S<-(-log(u))^(theta)+(-log(v))^(theta);duS<-(-theta/u)*(-log(u))^(theta-1);dvS<-(-theta/v)*(-log(v))^(theta-1);h<-S-t^(-1/delta);duh<-duS+(1/delta)*(t)^(-1/delta-1)*(dut);dvh<-dvS+(1/delta)*(t)^(-1/delta-1)*(dvt);dvuh<--1/delta*(1/delta+1)*t^(-1/delta-2)*dut*dvt;densi<-exp(-h^(1/theta))*(1/theta)^2*(h^(1/theta-1))^2*dvh*duh+exp(-h^(1/theta))*(-1/theta)*(1/theta-1)*h^(1/theta-2)*dvh*duh+exp(-h^(1/theta))*(-1/theta)*h^(1/theta-1)*dvuh}
dcbb6 BB6 copula density function
Description
Calculate the value of the BB6 density.
Usage
dcbb6(t, d, u, v)
Arguments
t Parameter t of the BB6, (1<t).
d Parameter d of the BB6, (1<d).
u First coordenate where de density will be evaluated. (0<u<1)
v Second coordenate where de density will be evaluated. (0<v<1)
Value
value of de density BB6 for the parameters t and d on ( u , v )
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
10 dcbb7
Examples
res<-dcbb6(1.5,1.5,0.75,0.6)
## The function is currently defined asfunction(t,d,u,v){
t19 = (d*t*(-log(-(-u+1.)**t+1.))**(d-1.)*(-log(-(-v+1.)**t+1.))**(d-1.)*exp(-(-log(-(-u+1.)**t+1.))**d-(-log(-(-v+1.)**t+1.))**d)*exp(-(-log(-(-u+1.)**t+1.))**d-(-log(-(-v+1.)**t+1.))**d)**(1./d-1.)*(-u+1.)**(t-1.)*(-v+1.)**(t-1.)*(-exp(-(-log(-(-u+1.)**t+1.))**d-(-log(-(-v+1.)**t+1.))**d)**(1./d)+1.)**(1./t-1.))/(((-u+1.)**t-1.)*((-v+1.)**t-1.))-(t*(-log(-(-u+1.)**t+1.))**(d-1.)*(-log(-(-v+1.)**t+1.))**(d-1.)*exp(-(-log(-(-u+1.)**t+1.))**d-(-log(-(-v+1.)**t+1.))**d)**2*exp(-(-log(-(-u+1.)**t+1.))**d-(-log(-(-v+1.)**t+1.))**d)**(2./d-2.)*(-u+1.)**(t-1.)*(-v+1.)**(t-1.)*(1./t-1.)*(-exp(-(-log(-(-u+1.)**t+1.))**d-(-log(-(-v+1.)**t+1.))**d)**(1./d)+1.)**(1./t-2.))/(((-u+1.)**t-1.)*((-v+1.)**t-1.))+(d*t*(-log(-(-u+1.)**t+1.))**(d-1.)*(-log(-(-v+1.)**t+1.))**(d-1.)*exp(-(-log(-(-u+1.)**t+1.))**d-(-log(-(-v+1.)**t+1.))**d)**2*exp(-(-log(-(-u+1.)**t+1.))**d-(-log(-(-v+1.)**t+1.))**d)**(1./d-2.)*(-u+1.)**(t-1.)*(-v+1.)**(t-1.)*(1./d-1.)*(-exp(-(-log(-(-u+1.)**t+1.))**d-(-log(-(-v+1.)**t+1.))**d)**(1./d)+1.)**(1./t-1.))/(((-u+1.)**t-1.)*((-v+1.)**t-1.))}
dcbb7 BB7 copula density function
Description
Calculate the value of the BB7 density.
Usage
dcbb7(theta, delta, u, v)
Arguments
theta Parameter theta of the BB7, (1<theta).
delta Parameter delta of the BB7, (0<delta).
u First coordenate where de density will be evaluated. (0<u<1)
v Second coordenate where de density will be evaluated. (0<v<1)
Value
value of de density BB7 for the parameters theta and delta on ( u , v )
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
res<-dcbb7(1.5,1.5,0.75,0.6)
## The function is currently defined asfunction(theta,delta,u,v){WU<-(1-(1-u)^(theta))^(-delta);
WV<-(1-(1-v)^(theta))^(-delta);duWU<-(-delta*theta)*(1-(1-u)^(theta))^(-delta-1)*(1-u)^(theta-1);
dcbb8 11
dvWV<-(-delta*theta)*(1-(1-v)^(theta))^(-delta-1)*(1-v)^(theta-1);K<-WU+WV;duK<-duWU;dvK<-dvWV;S<-K-1;duS<-duK;dvS<-dvK;h<-1-S^(-1/delta);duh<-(1/delta)*S^(-1/delta-1)*duS;dvh<-(1/delta)*S^(-1/delta-1)*dvS;dvuh<-(1/delta)*(-1/delta-1)*(S)^(-1/delta-2)*(dvS)*(duS);densi<-(-1/theta)*(1/theta-1)*h^(1/theta-2)*dvh*duh-(1/theta)*h^(1/theta-1)*dvuh}
dcbb8 BB8 copula density function
Description
Calculate the value of the BB8 density.
Usage
dcbb8(theta, delta, u, v)
Arguments
theta Parameter theta of the BB8, (1<theta).
delta Parameter delta of the BB8, (0<delta<1).
u First coordenate where de density will be evaluated. (0<u<1)
v Second coordenate where de density will be evaluated. (0<v<1)
Value
value of de density BB8 for the parameters theta and delta on ( u , v )
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
12 dcbb9
Examples
res<-dcbb8(1.5,0.5,0.75,0.6)
## The function is currently defined asfunction(theta,delta,u,v){S<-1-(1-delta*u)^(theta);T<-1-(1-delta*v)^(theta);K<-(1-(1-delta)^(theta))^(-1);W<-1-K*S*T;DuS<-theta*delta*(1-delta*u)^(theta-1);DuW<--K*T*DuS;DvT<-theta*delta*(1-delta*v)^(theta-1);DvW<--K*S*DvT;DvuW<--K*DuS*DvT;densi<--delta^(-1)*(1/theta)*(1/theta-1)*W^(1/theta-2)*DvW*DuW-delta^(-1)*(1/theta)*W^(1/theta-1)*DvuW}
dcbb9 BB9 copula density function
Description
Calculate the value of the BB9 density.
Usage
dcbb9(theta, delta, u, v)
Arguments
theta Parameter theta of the BB9, (1<theta).
delta Parameter delta of the BB9, (0<delta).
u First coordenate where de density will be evaluated. (0<u<1)
v Second coordenate where de density will be evaluated. (0<v<1)
Value
value of de density BB9 for the parameters theta and delta on ( u , v )
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
llbb 13
Examples
res<-dcbb9(1.5,1.5,0.75,0.6)
## The function is currently defined asfunction(theta,delta,u,v){S<-delta-log(u);T<-delta-log(v);W<-S^(theta)+T^(theta)-delta^(theta);C<-exp(-W^(1/theta)+delta);DuS<--1/u;DuW<-theta*S^(theta-1)*DuS;DvT<--1/v;DvW<-theta*T^(theta-1)*DvT;densi<-C*(1/theta^2)*(W^(1/theta-1))^2*DvW*DuW+C*(-1/theta)*(1/theta-1)*W^(1/theta-2)*DvW*DuW}
llbb Auxiliary function used by the function mlcbbsel
Description
Auxiliary function used by the function mlcbbsel
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
## The function is currently defined asfunction(param,u,v, model = c("CBB1", "CBB2", "CBB3", "CBB4", "CBB5", "CBB6", "CBB7","CBB8", "CBB9", "CBB10","CMM1", "CMM2", "CMM3", "CMM4", "CMM5", "CMM6", "CMM7", "CMM8", "CMM9", "CMM10","CBM1", "CBM2", "CBM3", "CBM4", "CBM5", "CBM6", "CBM7", "CBM8", "CBM9", "CBM10","CMB1", "CMB2", "CMB3", "CMB4", "CMB5", "CMB6", "CMB7", "CMB8", "CMB9", "CMB10")){n<-sum(u>=-1)ss<-c(1:n)*0s<-0.for(i in 1:n) { ss[i]<-log(cbbmodel(param[1],param[2],u[i],v[i],model)) }res<-ss}
14 llbb1
llbb1 BB1’s log-likelihood function
Description
Calculate the log-likelihood for the BB1 density.
Usage
llbb1(param, u, v)
Arguments
param bidimensional vector with parameters c(theta,delta) (0<theta and 1<delta)
u vector with the first coordenate of the bivariate data
v vector with the second coordenate of the bivariate data (same size asu)
Details
(u,v) margins must have Uniform(0,1) marginal distribution
Value
BB1’s log-likelihood function for the sample
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
# The data:u <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)v <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# The log-likelihoodr<-llbb1(c(0.5,1.5),u,v)
## The function is currently defined asfunction(param,u,v){n<-sum(u>=-1)s<-0.for(i in 1:n) { s<-s+log( dcbb1(param[1],param[2],u[i],v[i]) );if(is.nan(s)) {break};}if(is.finite(s)) {res<-s} else {res<- -10**(64)}}
llbb10 15
llbb10 BB10’s log-likelihood function
Description
Calculate the log-likelihood for the BB10 density.
Usage
llbb10(param, u, v)
Arguments
param bidimensional vector with parameters c(theta,delta) (0<theta<1 and 0<delta)
u vector with the first coordenate of the bivariate data
v vector with the second coordenate of the bivariate data (same size asu)
Details
(u,v) margins must have Uniform(0,1) marginal distribution
Value
BB10’s log-likelihood function for the sample
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
# The data:u <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)v <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# The log-likelihoodr<-llbb10(c(0.5,1.5),u,v)
## The function is currently defined asfunction(param,u,v){n<-sum(u>=-1)s<-0.for(i in 1:n) { s<-s+log(dcbb10(param[1],param[2],u[i],v[i]));if(is.nan(s)) {break}; }if(is.finite(s)) {res<-s} else {res<- -10**(64)}}
16 llbb1
llbb1 BB2’s log-likelihood function
Description
Calculate the log-likelihood for the BB2 density.
Usage
llbb2(param, u, v)
Arguments
param bidimensional vector with parameters c(theta,delta) (0<theta and 0<delta)
u vector with the first coordenate of the bivariate data
v vector with the second coordenate of the bivariate data (same size asu)
Details
(u,v) margins must have Uniform(0,1) marginal distribution
Value
BB2’s log-likelihood function for the sample
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
# The data:u <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)v <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# The log-likelihoodr<-llbb2(c(0.5,1.5),u,v)
## The function is currently defined asfunction(param,u,v){n<-sum(u>=-1)s<-0.for(i in 1:n) { s<-s+log(dcbb2(param[1],param[2],u[i],v[i]));if(is.nan(s)) {break}; }if(is.finite(s)) {res<-s} else {res<- -10**(64)}}
llbb1 17
llbb1 BB3’s log-likelihood function
Description
Calculate the log-likelihood for the BB3 density.
Usage
llbb3(param, u, v)
Arguments
param bidimensional vector with parameters c(theta,delta) (0<theta and 1<delta)
u vector with the first coordenate of the bivariate data
v vector with the second coordenate of the bivariate data (same size asu)
Details
(u,v) margins must have Uniform(0,1) marginal distribution
Value
BB3’s log-likelihood function for the sample
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
# The data:u <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)v <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# The log-likelihoodr<-llbb3(c(1.5,1.5),u,v)
## The function is currently defined asfunction(param,u,v){n<-sum(u>=-1)s<-0.for(i in 1:n) { s<-s+log(dcbb3(param[1],param[2],u[i],v[i]));if(is.nan(s)) {break}; }if(is.finite(s)) {res<-s} else {res<- -10**(64)}}
18 llbb1
llbb1 BB4’s log-likelihood function
Description
Calculate the log-likelihood for the BB4 density.
Usage
llbb4(param, u, v)
Arguments
param bidimensional vector with parameters c(theta,delta) (0<theta and 0<delta)
u vector with the first coordenate of the bivariate data
v vector with the second coordenate of the bivariate data (same size asu)
Details
(u,v) margins must have Uniform(0,1) marginal distribution
Value
BB4’s log-likelihood function for the sample
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
# The data:u <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)v <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# The log-likelihoodr<-llbb4(c(0.5,1.5),u,v)
## The function is currently defined asfunction(param,u,v){n<-sum(u>=-1)s<-0.for(i in 1:n) { s<-s+log(dcbb4(param[1],param[2],u[i],v[i]));if(is.nan(s)) {break}; }if(is.finite(s)) {res<-s} else {res<- -10**(64)}}
llbb5 19
llbb5 BB5’s log-likelihood function
Description
Calculate the log-likelihood for the BB5 density.
Usage
llbb5(param, u, v)
Arguments
param bidimensional vector with parameters c(theta,delta) (1<theta and 0<delta)
u vector with the first coordenate of the bivariate data
v vector with the second coordenate of the bivariate data (same size asu)
Details
(u,v) margins must have Uniform(0,1) marginal distribution
Value
BB5’s log-likelihood function for the sample
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
# The data:u <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)v <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# The log-likelihoodr<-llbb5(c(1.5,1.5),u,v)
## The function is currently defined asfunction(param,u,v){n<-sum(u>=-1)s<-0.for(i in 1:n) { s<-s+log(dcbb5(param[1],param[2],u[i],v[i]));if(is.nan(s)) {break}; }if(is.finite(s)) {res<-s} else {res<- -10**(64)}}
20 llbb6
llbb6 BB6’s log-likelihood function
Description
Calculate the log-likelihood for the BB6 density.
Usage
llbb6(param, u, v)
Arguments
param bidimensional vector with parameters c(theta,delta) (1<theta and 1<delta)
u vector with the first coordenate of the bivariate data
v vector with the second coordenate of the bivariate data (same size asu)
Details
(u,v) margins must have Uniform(0,1) marginal distribution
Value
BB6’s log-likelihood function for the sample
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
# The data:u <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)v <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# The log-likelihoodr<-llbb6(c(1.5,1.5),u,v)
## The function is currently defined asfunction(param,u,v){n<-sum(u>=-1)s<-0.for(i in 1:n) { s<-s+log(dcbb6(param[1],param[2],u[i],v[i]));if(is.nan(s)) {break}; }if(is.finite(s)) {res<-s} else {res<- -10**(64)}}
llbb7 21
llbb7 BB7’s log-likelihood function
Description
Calculate the log-likelihood for the BB7 density.
Usage
llbb7(param, u, v)
Arguments
param bidimensional vector with parameters c(theta,delta) (1<theta and 0<delta)
u vector with the first coordenate of the bivariate data
v vector with the second coordenate of the bivariate data (same size asu)
Details
(u,v) margins must have Uniform(0,1) marginal distribution
Value
BB7’s log-likelihood function for the sample
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
# The data:u <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)v <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# The log-likelihoodr<-llbb7(c(1.5,1.5),u,v)
## The function is currently defined asfunction(param,u,v){n<-sum(u>=-1)s<-0.for(i in 1:n) { s<-s+log(dcbb7(param[1],param[2],u[i],v[i]));if(is.nan(s)) {break}; }if(is.finite(s)) {res<-s} else {res<- -10**(64)}}
22 llbb8
llbb8 BB8’s log-likelihood function
Description
Calculate the log-likelihood for the BB8 density.
Usage
llbb8(param, u, v)
Arguments
param bidimensional vector with parameters c(theta,delta) (1<theta and 0<delta<1)
u vector with the first coordenate of the bivariate data
v vector with the second coordenate of the bivariate data (same size asu)
Details
(u,v) margins must have Uniform(0,1) marginal distribution
Value
BB8’s log-likelihood function for the sample
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
# The data:u <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)v <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# The log-likelihoodr<-llbb8(c(1.5,0.5),u,v)
## The function is currently defined asfunction(param,u,v){n<-sum(u>=-1)s<-0.for(i in 1:n) { s<-s+log(dcbb8(param[1],param[2],u[i],v[i]));if(is.nan(s)) {break}; }if(is.finite(s)) {res<-s} else {res<- -10**(64)}}
llbb9 23
llbb9 BB9’s log-likelihood function
Description
Calculate the log-likelihood for the BB9 density.
Usage
llbb9(param, u, v)
Arguments
param bidimensional vector with parameters c(theta,delta) (1<theta and 0<delta)
u vector with the first coordenate of the bivariate data
v vector with the second coordenate of the bivariate data (same size asu)
Details
(u,v) margins must have Uniform(0,1) marginal distribution
Value
BB9’s log-likelihood function for the sample
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
# The data:u <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)v <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# The log-likelihoodr<-llbb9(c(1.5,1.5),u,v)
## The function is currently defined asfunction(param,u,v){n<-sum(u>=-1)s<-0.for(i in 1:n) { s<-s+log(dcbb9(param[1],param[2],u[i],v[i]));if(is.nan(s)) {break}; }if(is.finite(s)) {res<-s} else {res<- -10**(64)}}
24 mlCopulaSelection-package
mlCopulaSelection-packageCopula selection and fitting using maximum likelihood
Description
Use numerical maximum likelihood to choose and fit a bivariate copula model (from a library of 40models) to the data. The copula models in the library correspond to BB1, BB2,...,BB10 from Joe,H., (1997) and its 90, 180 and 270 degree rotations.
Details
Package: mlCopulaSelectionType: PackageVersion: 1.3Date: 2006-08-12License: GPL version 2.
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
Maintainer: Jesus Garcia <[email protected]>
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
# The Data (the margins are uniform)U <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)V <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# find the maximun likelihood estimatesres<-mlcbbsel(U,V)#the best fitting copula model:res$copmax#the parameters for the best fitting copula model:res$parmax#the log-likelihood of the best fitting copula model with those parameters:res$llmax
mlcbb 25
mlcbb Auxiliary function used by the function mlcbbsel
Description
Auxiliary function used by the function mlcbbsel
Author(s)
Jesus Garcia, IMECC-UNICAMP and Veronica Gonzalez-Lopez, IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hall.
Examples
## The function is currently defined asfunction(u,v,thetamin,deltamin,thetamax,deltamax, copulamodel=c("CBB1","CBB2" , "CBB3","CBB4","CBB5","CBB6", "CBB7","CBB8", "CBB9", "CBB10","CMM1", "CMM2", "CMM3", "CMM4", "CMM5", "CMM6", "CMM7", "CMM8", "CMM9", "CMM10","CBM1", "CBM2", "CBM3", "CBM4", "CBM5", "CBM6", "CBM7", "CBM8", "CBM9", "CBM10","CMB1", "CMB2", "CMB3", "CMB4", "CMB5", "CMB6", "CMB7", "CMB8", "CMB9", "CMB10")){PMAX<-0
DMAX<-20TMAX<-20if(missing(deltamax)){deltamax<- DMAX}if(missing(thetamax)){thetamax<- TMAX}
if(missing(deltamin) && copulamodel=="CBB1"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CBB2"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CBB3"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CBB4"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CBB5"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CBB6"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CBB7"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CBB8"){deltamin<-0.005};if(missing(deltamax) && copulamodel=="CBB8"){deltamax<-0.995};if(deltamax==DMAX && copulamodel=="CBB8"){deltamax<-0.995}if(missing(deltamin) && copulamodel=="CBB9"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CBB10"){deltamin<-0.005};
if(missing(deltamin) && copulamodel=="CMM1"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CMM2"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CMM3"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CMM4"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CMM5"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CMM6"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CMM7"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CMM8"){deltamin<-0.005};if(missing(deltamax) && copulamodel=="CMM8"){deltamax<-0.995};if(deltamax==DMAX && copulamodel=="CMM8"){deltamax<-0.995}if(missing(deltamin) && copulamodel=="CMM9"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CMM10"){deltamin<-0.005};
26 mlcbb
if(missing(deltamin) && copulamodel=="CBM1"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CBM2"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CBM3"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CBM4"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CBM5"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CBM6"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CBM7"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CBM8"){deltamin<-0.005};if(missing(deltamax) && copulamodel=="CBM8"){deltamax<-0.995};if(deltamax==DMAX && copulamodel=="CBM8"){deltamax<-0.995}if(missing(deltamin) && copulamodel=="CBM9"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CBM10"){deltamin<-0.005};
if(missing(deltamin) && copulamodel=="CMB1"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CMB2"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CMB3"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CMB4"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CMB5"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CMB6"){deltamin<-1.005};if(missing(deltamin) && copulamodel=="CMB7"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CMB8"){deltamin<-0.005};if(missing(deltamax) && copulamodel=="CMB8"){deltamax<-0.995};if(deltamax==DMAX && copulamodel=="CMB8"){deltamax<-0.995}if(missing(deltamin) && copulamodel=="CMB9"){deltamin<-0.005};if(missing(deltamin) && copulamodel=="CMB10"){deltamin<-0.005};
if(missing(thetamin) && copulamodel=="CBB1"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CBB2"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CBB3"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CBB4"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CBB5"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CBB6"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CBB7"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CBB8"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CBB9"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CBB10"){thetamin<-0.005};if(missing(thetamax) && copulamodel=="CBB10"){thetamax<-0.995};if(thetamax==TMAX && copulamodel=="CBB10"){thetamax<-0.995}
if(missing(thetamin) && copulamodel=="CMM1"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CMM2"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CMM3"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CMM4"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CMM5"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CMM6"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CMM7"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CMM8"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CMM9"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CMM10"){thetamin<-0.005};if(missing(thetamax) && copulamodel=="CMM10"){thetamax<-0.995};if(thetamax==TMAX && copulamodel=="CMM10"){thetamax<-0.995}
mlcbbsel 27
if(missing(thetamin) && copulamodel=="CBM1"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CBM2"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CBM3"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CBM4"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CBM5"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CBM6"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CBM7"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CBM8"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CBM9"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CBM10"){thetamin<-0.005};if(missing(thetamax) && copulamodel=="CBM10"){thetamax<-0.995};if(thetamax==TMAX && copulamodel=="CBM10"){thetamax<-0.995}
if(missing(thetamin) && copulamodel=="CMB1"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CMB2"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CMB3"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CMB4"){thetamin<-0.005};if(missing(thetamin) && copulamodel=="CMB5"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CMB6"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CMB7"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CMB8"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CMB9"){thetamin<-1.005};if(missing(thetamin) && copulamodel=="CMB10"){thetamin<-0.005};if(missing(thetamax) && copulamodel=="CMB10"){thetamax<-0.995};if(thetamax==TMAX && copulamodel=="CMB10"){thetamax<-0.995}
n<-sum(u>=-1)m<-5inct<-(thetamax-thetamin)/(m+1)incd<-(deltamax-deltamin)/(m+1)PMAX <- -10**(250)for (tet in 1:m){ for (del in 1:m){teta <- thetamin + tet*inctdelta <- deltamin + del*incd
pvalor<-clibmodel(c(teta,delta),u,v,model=copulamodel)
if (pvalor>PMAX) { PMAX <- pvalor; tlmax<- teta ; dlmax <- delta }} }
result<-optim(c(tlmax,dlmax), method = "L-BFGS-B" , clibmodel,lower = c(thetamin,deltamin), upper = c(thetamax,deltamax) , control=list(fnscale=-1), x=u , y=v , model = copulamodel )
}
mlcbbsel Function for maximum likelihood copula selection and fitting
28 mlcbbsel
Description
Use numerical maximum likelihood to choose and fit a bivariate copula model (from a library of 40models) to the data.
Usage
mlcbbsel(U, V)
Arguments
U vector with the first coordenate of the bivariate data
V vector with the second coordenate of the bivariate data (same size asU)
Details
(U,V) margins must have Uniform(0,1) marginal distribution
Value
It return a LIST with,
copmax the best fitting copula model. The copula models in the library correspond toBB1, BB2,...,BB10 from Joe, H., (1997) and its 90, 180 and 270 degree rota-tions.
parmax the maximum likelihood estimates of the parameters for the best fitting copula
llmax the log-likelihood on the estimated parameters for the best copula
todo contain a matrix with the maximum likelihood ressults for all the copula models.The first column is the copulamodel number (from 1 to 40), the second columnis the maximum log-likelihood for that particular model and the third and fourthcolumn contain the parameters values for which that maximum log-likelihoodwas attained.
Author(s)
Jesus Garcia. IMECC-UNICAMP and Veronica Gonzalez-Lopez. IMECC-UNICAMP
References
Joe, H., (1997). Multivariate Models and Dependence Concepts. Monogra. Stat. Appl. Probab. 73,London: Chapman and Hal l.
Examples
# The Data (the margins are uniform)U <- c( 0.43, 0.1, 0.2, 0.33, 0.24, 0.29, 0.14, 0.4, 0.39, 0.8, 0.63, 0.16, 0.24, 0.14,0.71, 0.39, 0.48, 0.29, 0.38, 0.37)V <- c(0.01, 0.26, 0.2, 0.36, 0.34, 0.43, 0.27, 0.61, 0.08, 0.25, 0.72, 0.15, 0.14, 0.12, 0.74, 0.18, 0.58, 0.15, 0.34, 0.13)# find the maximun likelihood estimatesres<-mlcbbsel(U,V)#the best fitting copula model:res$copmax#the parameters for the best fitting copula model:res$parmax#the log-likelihood of the best fitting copula model with those parameters:
mlcbbsel 29
res$llmax
## The function is currently defined asfunction(U,V){
model=c("CBB1","CBB2" , "CBB3","CBB4","CBB5","CBB6", "CBB7","CBB8", "CBB9", "CBB10","CMM1", "CMM2", "CMM3", "CMM4", "CMM5", "CMM6", "CMM7", "CMM8", "CMM9", "CMM10","CBM1", "CBM2", "CBM3", "CBM4", "CBM5", "CBM6", "CBM7", "CBM8", "CBM9", "CBM10","CMB1", "CMB2", "CMB3", "CMB4", "CMB5", "CMB6", "CMB7", "CMB8", "CMB9", "CMB10")
respmodel=c("CBB1","CBB2" , "CBB3","CBB4","CBB5","CBB6", "CBB7","CBB8", "CBB9", "CBB10","180 degree rotation of CBB1","180 degree rotation of CBB2" , "180 degree rotation of CBB3","180 degree rotation of CBB4","180 degree rotation of CBB5","180 degree rotation of CBB6", "180 degree rotation of CBB7","180 degree rotation of CBB8", "180 degree rotation of CBB9", "180 degree rotation of CBB10","90 degree rotation of CBB1","90 degree rotation of CBB2" , "90 degree rotation of CBB3","90 degree rotation of CBB4","90 degree rotation of CBB5","90 degree rotation of CBB6", "90 degree rotation of CBB7","90 degree rotation of CBB8", "90 degree rotation of CBB9", "90 degree rotation of CBB10","270 degree rotation of CBB1","270 degree rotation of CBB2" , "270 degree rotation of CBB3","270 degree rotation of CBB4","270 degree rotation of CBB5","270 degree rotation of CBB6", "270 degree rotation of CBB7","270 degree rotation of CBB8", "270 degree rotation of CBB9", "270 degree rotation of CBB10")
ncop<-1
TODOCOP <-c(1:40)TODOPV <-c(1:2)*0TODOTET <-c(1:2)*0TODODEL <-c(1:2)*0PVMAX<- -10**(100)pmax<-10
n<-sum(U != -10**200)
for(nmodel in 1:40){RES <- mlcbb(U,V,copulamodel=model[nmodel])PV <- RES$valuePAR<- RES$parif (PV>PVMAX) {PVMAX<-PV;PARMAX<-PAR;COPMAX<-nmodel;LLMAX<-PV}TODOPV[nmodel]<- PVTODOTET[nmodel] <-PAR[1]TODODEL[nmodel] <-PAR[2]}
ORDEN<-order(TODOPV,TODOCOP,decreasing= TRUE)
TODO<-matrix(c(1:40*4)*0,40,4)
TODO[,1]<-respmodel[TODOCOP[ORDEN]]TODO[,2]<-TODOPV[ORDEN]TODO[,3]<-TODOTET[ORDEN]TODO[,4]<-TODODEL[ORDEN]
result <- list(todo=TODO,copmax=respmodel[COPMAX],parmax=PARMAX,llmax=LLMAX)}
Index
∗Topic documentationmlCopulaSelection-package, 23
∗Topic internalclibmodel, 1llbb, 12mlcbb, 24
∗Topic miscdcbb1, 2dcbb10, 3dcbb2, 4dcbb3, 5dcbb4, 6dcbb5, 7dcbb6, 8dcbb7, 9dcbb8, 10dcbb9, 11llbb1, 13, 15–17llbb10, 14llbb5, 18llbb6, 19llbb7, 20llbb8, 21llbb9, 22mlcbbsel, 26
clibmodel, 1
dcbb1, 2dcbb10, 3dcbb2, 4dcbb3, 5dcbb4, 6dcbb5, 7dcbb6, 8dcbb7, 9dcbb8, 10dcbb9, 11
llbb, 12llbb1, 13, 15–17llbb10, 14llbb2 (llbb1), 15llbb3 (llbb1), 16
llbb4 (llbb1), 17llbb5, 18llbb6, 19llbb7, 20llbb8, 21llbb9, 22
mlcbb, 24mlcbbsel, 26mlCopulaSelection
(mlCopulaSelection-package),23
mlCopulaSelection-package, 23
30