sscopu: Estimating Copula Density Using Smoothing Splines

View source: R/sscopu.R

sscopuR Documentation

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.

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.

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.

Note

For reasonable execution time in higher dimensions, set skip.iter=TRUE in calls to sscopu.

When "Newton iteration diverges" in sscopu, try to use a larger qdsz.depth; the default values for dimensions 2, 3, 4, 5, 6+ are 24, 14, 12, 11, 10. To be sure a larger qdsz.depth indeed makes difference, verify the cubature size using smolyak.size.

The results may vary from run to run. For consistency, specify id.basis or set seed.

Author(s)

Chong Gu, chong@stat.purdue.edu

References

Gu, C. (2013), Smoothing Spline ANOVA Models (2nd Ed). New York: Springer-Verlag.

Gu, C. (2015), Hazard estimation with bivariate survival data and copula density estimation. Journal of Computational and Graphical Statistics, 24, 1053-1073.

Examples

## 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)
## Not run: 
## Kendall's tau and Spearman's rho
summary(fit); summary(fit2); summary(fit.s)
## clean up
rm(x,fit,fit2,fit.s)

## End(Not run)

gss documentation built on Oct. 12, 2024, 1:08 a.m.

Related to sscopu in gss...