relliptical | R Documentation |
Generate a sample from an elliptical distribution with location mu
,
scatter matrix sigma
and generating variate specified by the sample
r
. Size of the generated sample is length(r)
.
relliptical(r, mu, sigma)
r |
A double or integer vector representing a sample from the generating variate. |
mu |
A double or integer vector representing location of the distribution. |
sigma |
A double or integer matrix representing the scatter matrix of
the distribution. Argument |
Function samples from a random variable X
with stochastic
representation
X \stackrel{d}{=} \mu + \mathcal{R} \Lambda \mathcal{U},
where \mu\in\mathbb{R}^m
, \mathcal{R}
is is nonnegative random
variable, \mathcal{U}
is a m
-dimensional random vector uniformly
distributed on a unit sphere and \Lambda\in \mathbb{R}^{m\times m}
is
a matrix such that \Sigma = \Lambda\Lambda^T
is a symmetric
positive-definite matrix. Random variables \mathcal{R}
and
\mathcal{U}
are independent. See, for example,
(Cambanis et al. 1981) for more information about elliptical
distributions.
Matrix \Lambda
is calculated with help of the eigenvalue
decomposition. I.e,
\Lambda = U A^{1/2} U^T,
where U
is a orthogonal matrix with eigenvectors of the matrix
\Sigma
as columns and A^{1/2} = \textrm{diag}(\lambda^{1/2}_1,
\lambda^{1/2}_2, \dots, \lambda^{1/2}_m)
. Here \lambda_1, \lambda_2,
\ldots, \lambda_m
are eigenvalues of the matrix \Sigma
.
An length(r)
times length(mu)
matrix with one
observation in each row.
Cambanis S, Huang S, Simons G (1981). "On the theory of elliptically contoured distributions." Journal of Multivariate Analysis, 11(3), 368-385.
ellipsoidq
, qreg
# Simulate a sample from 2-dimensional t-distribution with degrees of
# freedom equal to three.
n <- 100
d <- 2
df <- 3
r <- sqrt(d * rf(n, d, df))
mu <- c(-1, 1)
sigma <- matrix(c(11, 10.5, 10.5, 11.25), nrow = 2, byrow = TRUE)
x <- relliptical(r, mu, sigma)
# Plot the sample
plot(x)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.