Learn R Programming

VineCopula (version 2.6.0)

pobs: Pseudo-Observations

Description

Compute the pseudo-observations for the given data matrix.

Usage

pobs(
  x,
  na.last = "keep",
  ties.method = eval(formals(rank)$ties.method),
  lower.tail = TRUE
)

Value

matrix of the same dimensions as x containing the pseudo-observations.

Arguments

x

\(n\times d\)-matrix of random variates to be converted to pseudo-observations.

na.last, ties.method

are passed to rank(); see there.

lower.tail

logical() which, if FALSE, returns the pseudo-observations when applying the empirical marginal survival functions.

Author

Marius Hofert, Thomas Nagler

Details

Given \(n\) realizations \(\bm{x}_i=(x_{i1},\dots,x_{id})^T\), \(i\in\{1,\dots,n\}\) of a random vector \(\bm{X}\), the pseudo-observations are defined via \(u_{ij}=r_{ij}/(n+1)\) for \(i\in\{1,\dots,n\}\) and \(j\in\{1,\dots,d\}\), where \(r_{ij}\) denotes the rank of \(x_{ij}\) among all \(x_{kj}\), \(k\in\{1,\dots,n\}\). The pseudo-observations can thus also be computed by component-wise applying the empirical distribution functions to the data and scaling the result by \(n/(n+1)\). This asymptotically negligible scaling factor is used to force the variates to fall inside the open unit hypercube, for example, to avoid problems with density evaluation at the boundaries. Note that pobs(, lower.tail=FALSE) simply returns 1-pobs().

Examples

Run this code

## Simple definition of the function:
pobs

## simulate data from a multivariate normal distribution
library(mvtnorm)
set.seed(123)
Sigma <- matrix(c(2, 1, -0.2, 1, 1, 0.3, -0.2, 0.3, 0.5), 3, 3)
mu <- c(-3, 2, 1)
dat <- rmvnorm(500, sigma = Sigma)
pairs(dat)  # plot observations

## compute pseudo-observations for copula inference
udat <- pobs(dat)
pairs(udat)
# estimate vine copula model
fit <- RVineStructureSelect(udat, familyset = c(1, 2))

Run the code above in your browser using DataLab