Last data update: 2014.03.03

R: Estimation of the parameters of the bivariate distribution...
BiVarEstR Documentation

Estimation of the parameters of the bivariate distribution function of the Archimedean copula family.

Description

Estimation the parameters of the bivariate distribution function of the Archimedean copula family.

Usage

BiVarEst(Z, kopule = "gumbel", rodiny = c("weibull", "weibull"))

Arguments

Z

data frame with these columns:
Z[, 1:2] are numeric vectors.
Z[, 3] is an integer vector consisting of 0 or 1. Z[i, 3] = 0, if Z[i, 1] is censored.
Z[, 4] is an integer vector consisting of 0 or 1. Z[i, 4] = 0, if Z[i, 2] is censored.

kopule

a character string specifying the family of an Archimedean copula. Currently supported families are "gumbel", "clayton" and "frank".

rodiny

vector of length 2 of names of the marginal distributions. Names can be "weibull", "gamma", "norm" and "lnorm". "norm" is the name for the Normal distribution. "lnorm" is the name for the Lognormal distribution.

Details

The Weibull ("weibull") and the Gamma ("gamma") distributions have parameters shape and scale. The Normal ("norm") distribution has parameters mean and sd. The Lognormal ("lnorm") distribution has parameters meanlog and sdlog.

Value

A list with the following components:

par

best estimate of the parameter vector found by the nmkb function.

value

value of the likelihood at termination.

feval

number of times the likelihood was evaluated.

restarts

number of times the algorithm had to be restarted when it stagnated.

convergence

an integer code indicating type of convergence. 0 indicates successful convergence. Positive integer codes indicate failure to converge.

message

a text message indicating the type of convergence or failure.

Note

Vector par has the structure:
par[1:2] are parameters of the first marginal distribution.
par[3:4] are parameters of the second marginal distribution.
par[5] is the parameter of the copula.

Author(s)

Josef Brejcha

Examples

rodinka <- c("weibull", "norm")
kopule <- "frank"
xweib <- c(1.75, 145, 1.30, 80, 3.5)
BcG <- BiCopGen(x = xweib, rodiny = rodinka, rodina = kopule, No=30,
cens = TRUE, bicens = FALSE, digi = 2)
Nxyd <- data.frame(X=BcG$X, Y=BcG$Y, dX=BcG$dX, dY=BcG$dY)
Bivar <- BiVarEst(Nxyd, kopule = kopule, rodiny = rodinka)
Bivar
plot(Nxyd$Y, Nxyd$X, type="n", xlab="Y", ylab="X",
xlim=c(min(0, min(Nxyd$Y)), max(Nxyd$Y)),
ylim=c(min(0, min(Nxyd$X)),max(Nxyd$X)))
points(Nxyd$Y, Nxyd$X, col=ifelse(Nxyd$dX==1 & Nxyd$dY==1, "black",
ifelse(Nxyd$dX==0 & Nxyd$dY==1, "red", ifelse(Nxyd$dX==1 & Nxyd$dY==0,
"blue", "green"))), pch=20)
legend("topleft",c("dX, dY","1,1", "0,1", "1,0", "0,0"),
text.col=c("black", "black", "red", "blue", "green"), bty = "n")
grid(col = "grey50")

Results


R version 3.3.1 (2016-06-21) -- "Bug in Your Hair"
Copyright (C) 2016 The R Foundation for Statistical Computing
Platform: x86_64-pc-linux-gnu (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> library(BivarP)
Loading required package: dfoptim
Loading required package: survival
Loading required package: copula
> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/BivarP/BiVarEst.Rd_%03d_medium.png", width=480, height=480)
> ### Name: BiVarEst
> ### Title: Estimation of the parameters of the bivariate distribution
> ###   function of the Archimedean copula family.
> ### Aliases: BiVarEst
> ### Keywords: ~kwd1 ~kwd2
> 
> ### ** Examples
> 
> rodinka <- c("weibull", "norm")
> kopule <- "frank"
> xweib <- c(1.75, 145, 1.30, 80, 3.5)
> BcG <- BiCopGen(x = xweib, rodiny = rodinka, rodina = kopule, No=30,
+ cens = TRUE, bicens = FALSE, digi = 2)
> Nxyd <- data.frame(X=BcG$X, Y=BcG$Y, dX=BcG$dX, dY=BcG$dY)
> Bivar <- BiVarEst(Nxyd, kopule = kopule, rodiny = rodinka)
> Bivar
$par
[1]   2.818997 157.886425   4.983197  84.781779   6.971294

$value
[1] 155.0692

$feval
[1] 205

$restarts
[1] 0

$convergence
[1] 0

$message
[1] "Successful convergence"

> plot(Nxyd$Y, Nxyd$X, type="n", xlab="Y", ylab="X",
+ xlim=c(min(0, min(Nxyd$Y)), max(Nxyd$Y)),
+ ylim=c(min(0, min(Nxyd$X)),max(Nxyd$X)))
> points(Nxyd$Y, Nxyd$X, col=ifelse(Nxyd$dX==1 & Nxyd$dY==1, "black",
+ ifelse(Nxyd$dX==0 & Nxyd$dY==1, "red", ifelse(Nxyd$dX==1 & Nxyd$dY==0,
+ "blue", "green"))), pch=20)
> legend("topleft",c("dX, dY","1,1", "0,1", "1,0", "0,0"),
+ text.col=c("black", "black", "red", "blue", "green"), bty = "n")
> grid(col = "grey50")
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>