Last data update: 2014.03.03

R: Student's t Copula
CopulaStudentR Documentation

Student's t Copula

Description

Functions for copula density, generating random variates and fitting

Usage

dcopula.t(Udata, df, Sigma, log = FALSE)
rcopula.t(n, df, Sigma)
fit.tcopula(Udata, method = c("all", "Kendall", "Spearman"),
            startdf = 5, ...)

Arguments

df

numeric, degrees of freedom.

log

logical, whether log density values should be returned.

method

character, method for fitting.

n

integer, count of random variates

Sigma

matrix, correlation matrix

startdf

numeric, initial DF value.

Udata

matrix, dimension n \times d, where d is the dimension of the copula and n is the number of pseudo-uniform values.

...

ellipsis, arguments are passed down to nlminb().

Details

If in the call to fit.tcopula(), method = "all", then all parameters are estimated, i.e., the degrees of freedom and the dispersion parameters (initial values from Spearman correlations). In case of either method = "Kendall" or method = "Spearman", the corresponding rank correlations are used and the optimization is only carried out with respect to the degrees of freedom parameter. The initial value for the DF is given by startdf. See pages 197 and 229–236 of QRM.

Value

A vector of density values of length n for dcopula.t(). A matrix of random variates for rcopula.t(). A list object containing parameter estimates and details of fit for function fit.tcopula().

See Also

nlminb

Examples

ll <- c(0.01,0.99)
#create perspective plot for bivariate density:
BiDensPlot(func = dcopula.t, xpts = ll, ypts = ll, df = 4,
           Sigma = equicorr(2, 0.5))
S <- equicorr(d = 6, rho = 0.7)
data <- rcopula.t(2000, df = 4, Sigma = S) 
pairs(data)
## Fitting Student's Copula
data(smi)
data(ftse100)
s1 <- window(ftse100, "1990-11-09", "2004-03-25")
s1a <- alignDailySeries(s1)
s2a <- alignDailySeries(smi)
idx <- merge(s1a, s2a)
r <-returns(idx)
rp <- series(window(r, "1994-01-01", "2003-12-31"))
rp <- rp[(rp[, 1] != 0) & (rp[, 2] !=0), ]
Udata <- apply(rp, 2, edf, adjust = 1)
copt2 <- fit.tcopula(Udata, method = "Kendall")

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(QRM)
Loading required package: gsl
Loading required package: Matrix
Loading required package: mvtnorm
Loading required package: numDeriv
Loading required package: timeSeries
Loading required package: timeDate

Attaching package: 'QRM'

The following object is masked from 'package:base':

    lbeta

> png(filename="/home/ddbj/snapshot/RGM3/R_CC/result/QRM/CopulaStudent.Rd_%03d_medium.png", width=480, height=480)
> ### Name: CopulaStudent
> ### Title: Student's t Copula
> ### Aliases: CopulaStudent dcopula.t rcopula.t fit.tcopula
> ### Keywords: distribution
> 
> ### ** Examples
> 
> ll <- c(0.01,0.99)
> #create perspective plot for bivariate density:
> BiDensPlot(func = dcopula.t, xpts = ll, ypts = ll, df = 4,
+            Sigma = equicorr(2, 0.5))
> S <- equicorr(d = 6, rho = 0.7)
> data <- rcopula.t(2000, df = 4, Sigma = S) 
> pairs(data)
> ## Fitting Student's Copula
> data(smi)
> data(ftse100)
> s1 <- window(ftse100, "1990-11-09", "2004-03-25")
> s1a <- alignDailySeries(s1)
> s2a <- alignDailySeries(smi)
> idx <- merge(s1a, s2a)
> r <-returns(idx)
> rp <- series(window(r, "1994-01-01", "2003-12-31"))
> rp <- rp[(rp[, 1] != 0) & (rp[, 2] !=0), ]
> Udata <- apply(rp, 2, edf, adjust = 1)
> copt2 <- fit.tcopula(Udata, method = "Kendall")
There were 12 warnings (use warnings() to see them)
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>