Learn R Programming

ghyp (version 1.1.0)

mean-vcov-methods: Expected value and variance-covariance of generalized hyperbolic distributions

Description

The function mean returns the expected value. The function vcov returns the variance in the univariate case and the variance-covariance matrix in the multivariate case.

Usage

## S3 method for class 'ghyp':
mean(x)

## S3 method for class 'ghyp': vcov(object)

Arguments

x, object
An object inheriting from class ghyp.

Value

  • Either the expected value or the variance.

See Also

ghyp, ghyp-class, Egig to compute the expected value and the variance of the generalized inverse gaussian mixing distribution distributed and its special cases.

Examples

Run this code
## Univariate: Parametric 
  vg.dist <- VG(lambda = 1.1, mu = 10, sigma = 10, gamma = 2)
  mean(vg.dist)
  vcov(vg.dist)
  
  ## Univariate: Empirical                                                 
  vg.sim <- rghyp(10000, vg.dist)
  mean(vg.sim)
  var(vg.sim)

  ## Multivariate: Parametric 
  vg.dist <- VG(lambda = 0.1, mu = c(55, 33), sigma = diag(c(22, 888)), gamma = 1:2)
  mean(vg.dist)
  vcov(vg.dist)
  
  ## Multivariate: Empirical                                                 
  vg.sim <- rghyp(50000, vg.dist)
  colMeans(vg.sim)
  var(vg.sim)

Run the code above in your browser using DataLab