Learn R Programming

gsscopu (version 0.9-3)

sscopu: Estimating Copula Density Using Smoothing Splines

Description

Estimate copula densities using tensor-product cubic splines.

Usage

sscopu(x, symmetry=FALSE, alpha=1.4, order=NULL, exclude=NULL, weights=NULL, id.basis=NULL, nbasis=NULL, seed=NULL, qdsz.depth=NULL, prec=1e-7, maxiter=30, skip.iter=dim(x)[2]!=2)
sscopu2(x, censoring=NULL, truncation=NULL, symmetry=FALSE, alpha=1.4, weights=NULL, id.basis=NULL, nbasis=NULL, seed=NULL, prec=1e-7, maxiter=30)

Arguments

x
Matrix of observations on unit cubes.
symmetry
Flag indicating whether to enforce symmetry, or invariance under coordinate permutation.
order
Highest order of interaction terms in log density. When NULL, it is set to dim(x)[2] internally.
exclude
Pair(s) of marginals whose interactions to be excluded in log density.
alpha
Parameter defining cross-validation score for smoothing parameter selection.
weights
Optional vector of bin-counts for histogram data.
id.basis
Index of observations to be used as "knots."
nbasis
Number of "knots" to be used. Ignored when id.basis is specified.
seed
Seed to be used for the random generation of "knots." Ignored when id.basis is specified.
qdsz.depth
Depth to be used in smolyak.quad for the generation of quadrature.
prec
Precision requirement for internal iterations.
maxiter
Maximum number of iterations allowed for internal iterations.
skip.iter
Flag indicating whether to use initial values of theta and skip theta iteration. See ssanova for notes on skipping theta iteration.
censoring
Optional censoring indicator.
truncation
Optional truncation points.

Value

sscopu and sscopu2 return a list object of class "sscopu". dsscopu can be used to evaluate the estimated copula density. A "copularization" process is applied to the estimated density by default so the resulting marginal densities are guaranteed to be uniform.cdsscopu, cpsscopu, and cqsscopu can be used to evaluate 1-D conditional pdf, cdf, and quantiles.

Details

sscopu is essentially ssden applied to observations on unit cubes. Instead of variables in data frames, the data are entered as a numerical matrix, and model complexity is globally controlled by the highest order of interactions allowed in log density.

sscopu2 further restricts the domain to the unit square, but allows for possible censoring and truncation. With censoring==0,1,2,3, a data point $(x1,x2)$ represents exact observation, $[0,x1]x{x2}$, ${x1}x[0,x2]$, or $[0,x1]x[0,x2]$. With truncation point $(t1,t2)$, the sample is taken from $[0,t1]x[0,t2]$ instead of the unit square.

With symmetriy=TRUE, one may enforce the interchangeability of coordinates so that $f(x1,x2)=f(x2,x1)$, say.

When (1,2) is a row in exclude, interaction terms involving coordinates 1 and 2 are excluded.

References

Gu, C. (2013), Smoothing Spline ANOVA Models. New York: Springer-Verlag. Gu, C. (2013), Hazard estimation with bivariate survival data and copula density estimation.

Examples

Run this code
## simulate 2-D data
x <- matrix(runif(200),100,2)
## fit copula density
fit <- sscopu(x)
## "same fit"
fit2 <- sscopu2(x,id=fit$id)
## symmetric fit
fit.s <- sscopu(x,sym=TRUE,id=fit$id)
## Kendall's tau and Spearman's rho
summary(fit); summary(fit2); summary(fit.s)
## clean up
## Not run: rm(x,fit,fit2,fit.s)

Run the code above in your browser using DataLab