# est_quancov: Estimate the covariance matrix of quantile estimations In TLMoments: Calculate TL-Moments and Convert Them to Distribution Parameters

 est_quancov R Documentation

## Estimate the covariance matrix of quantile estimations

### Description

Internal function. Use est_cov. Description not done yet.

### Usage

```est_quancov(x, distr = "", p = NULL, leftrim = 0L, rightrim = 0L, ...)

## S3 method for class 'numeric'
est_quancov(x, distr, p, leftrim = 0L, rightrim = 0L, np.cov = FALSE, ...)

## S3 method for class 'matrix'
est_quancov(
x,
distr,
p,
leftrim = 0L,
rightrim = 0L,
np.cov = FALSE,
reg.weights = NULL,
...
)

## S3 method for class 'quantiles'
est_quancov(
x,
distr = attr(x, "distribution"),
p = attr(x, "p"),
leftrim = attr(x, "source")\$trimmings[1],
rightrim = attr(x, "source")\$trimmings[2],
set.n = NA,
...
)
```

### Arguments

 `x` numeric vector or matrix containing data. `distr` character of length 1 giving the distribution if parametric assumption should be used. `p` quantile levels from which the covariance should be calculated. `leftrim, rightrim` lower and upper trimming parameter used for parameter calculation, have to be non-negative integers. `...` additional arguments. `np.cov` boolean, if TRUE no parametric assumptions are used to calculate the covariance matrix (default FALSE). `reg.weights` numeric vector of weights for regionalized TLMoments. `set.n` hypothetical data length n if theoretical values are given.

numeric matrix

### Examples

```### Numeric vectors
x <- rgev(500, shape = .2)

quantiles(parameters(TLMoments(x), "gev"), c(.9, .95, .99))
est_quancov(x, "gev", c(.9, .95, .99), 0, 0)
#cov(t(replicate(5000,
#  quantiles(parameters(TLMoments(rgev(500, shape = .2)), "gev"), c(.9, .95, .99))
#)))

quantiles(parameters(TLMoments(x, rightrim = 1), "gev"), c(.9, .95, .99))
est_quancov(x, "gev", c(.9, .95, .99), 0, 1)
#cov(t(replicate(5000,
#  quantiles(
#    parameters(TLMoments(rgev(500, shape = .2), rightrim = 1), "gev"),
#    c(.9, .95, .99)
#  )
#)))

### Numeric matrices
x <- matrix(rgev(600, shape = .2), nc = 3)

quantiles(parameters(TLMoments(x), "gev"), c(.9, .95, .99))
est_quancov(x, "gev", c(.9, .95, .99), 0, 0)

est_quancov(x, "gev", .9, 0, 0)
#cov(t(replicate(5000,
# quantiles(
#   parameters(TLMoments(matrix(rgev(600, shape = .2), nc = 3)),
#  "gev"), .9)
#  )
#))

### quantiles object
q <- quantiles(as.parameters(loc = 3, scale = 2, shape = .4, distr = "gev"), c(.9, .99))
est_quancov(q)
est_quancov(q, leftrim = 0, rightrim = 0)
est_quancov(q, leftrim = 0, rightrim = 0, set.n = 10)

```

TLMoments documentation built on March 27, 2022, 5:07 p.m.