Last data update: 2014.03.03

R: Gauss Copula
CopulaGaussR Documentation

Gauss Copula

Description

Functions for evaluating the Gauss copula, generating random variates and fitting.

Usage

dcopula.gauss(Udata, Sigma, log = FALSE)
rcopula.gauss(n, Sigma)
fit.gausscopula(Udata, ...)

Arguments

log

logical, whether log density values should be returned.

n

integer, count of random variates

Sigma

matrix, correlation matrix.

Udata

matrix, pseudo-uniform data where rows are vector observations with all values in unit interval.

...

ellipsis argument, passed down to nlminb() used in optimization.

Value

For dcopula.gauss() a vector of density values of length n. For rcopula.gauss() a n \times d matrix of random variates and for fit.gausscopula() a list with the optimization results.

See Also

nlminb

Examples

ll <- c(0.01,0.99)
BiDensPlot(func = dcopula.gauss, xpts = ll, ypts = ll,
           Sigma = equicorr(2, 0.5))
data <- rcopula.gauss(2000, Sigma = equicorr(d = 6, rho = 0.7)) 
pairs(data)
## Fitting Gauss 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)
copgauss <- fit.gausscopula(Udata) 

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/CopulaGauss.Rd_%03d_medium.png", width=480, height=480)
> ### Name: CopulaGauss
> ### Title: Gauss Copula
> ### Aliases: dcopula.gauss rcopula.gauss fit.gausscopula
> ### Keywords: distribution
> 
> ### ** Examples
> 
> ll <- c(0.01,0.99)
> BiDensPlot(func = dcopula.gauss, xpts = ll, ypts = ll,
+            Sigma = equicorr(2, 0.5))
> data <- rcopula.gauss(2000, Sigma = equicorr(d = 6, rho = 0.7)) 
> pairs(data)
> ## Fitting Gauss 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)
> copgauss <- fit.gausscopula(Udata) 
> 
> 
> 
> 
> 
> dev.off()
null device 
          1 
>