est_paramcov: Estimate the covariance matrix of parameter estimations

View source: R/est_paramcov.R

est_paramcovR Documentation

Estimate the covariance matrix of parameter estimations

Description

Internal function. Use est_cov. Description not done yet.

Usage

est_paramcov(x, distr = "", leftrim = 0L, rightrim = 0L, ...)

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

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

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

Arguments

x

numeric vector or matrix containing data OR an object of parameters.

distr

character indicating the distribution from which the parameters are calculated. If x is parameters-object, distr does not need to be specified.

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.

Value

numeric matrix

Examples

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

parameters(TLMoments(x), "gev")
est_paramcov(x, "gev", 0, 0)
#cov(t(replicate(10000, parameters(TLMoments(rgev(500, shape = .2)), "gev"))))

parameters(TLMoments(x, rightrim = 1), "gev")
est_paramcov(x, "gev", 0, 1)
#cov(t(replicate(10000,
#   parameters(TLMoments(rgev(500, shape = .2), rightrim = 1), "gev")
#)))

parameters(TLMoments(x, rightrim = 2), "gev")
est_paramcov(x, "gev", 0, 2)
#cov(t(replicate(10000,
#  parameters(TLMoments(rgev(500, shape = .2), rightrim = 2), "gev")
#)))

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

parameters(TLMoments(x), "gev")
est_paramcov(x, "gev", 0, 0)
#cov(t(replicate(5000,
#  as.vector(parameters(TLMoments(matrix(rgev(600, shape = .2), nc = 3)), "gev")))
#))

### parameters-object
x <- as.parameters(loc = 3, scale = 2, shape = .4, distr = "gev")
est_paramcov(x)
est_paramcov(x, leftrim = 0, rightrim = 0)
est_paramcov(x, leftrim = 0, rightrim = 0, set.n = 100)
# distr-argument can be neglected


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