Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

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)

Arguments

x

n x d-matrix (or d-vector) of random variates to be converted to pseudo-observations.

na.last

string passed to rank; see there.

ties.method

string specifying how ranks should be computed if there are ties in any of the coordinate samples of x; passed to rank.

lower.tail

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

Details

Given n realizations x_i=(x_{i1},...,x_{id}), i in {1,...,n} of a random vector X, the pseudo-observations are defined via u_{ij}=r_{ij}/(n+1) for i in {1,...,n} and j in {1,...,d}, where r_{ij} denotes the rank of x_{ij} among all x_{kj}, k in {1,...,n}. When there are no ties in any of the coordinate samples of x, the pseudo-observations can thus also be computed by component-wise applying the marginal 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().

Value

matrix (or vector) of the same dimensions as x containing the pseudo-observations.

Examples

## Simple definition of the function:
pobs

## Draw from a multivariate normal distribution
d <- 10
set.seed(1)
P <- Matrix::nearPD(matrix(pmin(pmax(runif(d*d), 0.3), 0.99), ncol=d))$mat
diag(P) <- rep(1, d)
n <- 500
x <- MASS::mvrnorm(n, mu = rep(0, d), Sigma = P)

## Compute pseudo-observations (should roughly follow a Gauss
## copula with correlation matrix P)
u <- pobs(x)
plot(u[,5],u[,10], xlab=quote(italic(U)[1]), ylab=quote(italic(U)[2]))

## All components: pairwise plot
pairs(u, gap=0, pch=".", labels =
      as.expression( lapply(1:d, function(j) bquote(italic(U[.(j)]))) ))

copula

Multivariate Dependence with Copulas

v1.0-1
GPL (>= 3) | file LICENCE
Authors
Marius Hofert [aut] (<https://orcid.org/0000-0001-8009-4665>), Ivan Kojadinovic [aut] (<https://orcid.org/0000-0002-2903-1543>), Martin Maechler [aut, cre] (<https://orcid.org/0000-0002-8685-9910>), Jun Yan [aut] (<https://orcid.org/0000-0003-4401-7296>), Johanna G. Nešlehová [ctb] (evTestK(), <https://orcid.org/0000-0001-9634-4796>), Rebecca Morger [ctb] (fitCopula.ml(): code for free mixCopula weight parameters)
Initial release
2020-12-07

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.