Learn R Programming

QRM (version 0.4-31)

CopulaStudent: 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().

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().

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.

See Also

nlminb

Examples

Run this code
# NOT RUN {
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")
# }

Run the code above in your browser using DataLab