mom.mtruncnorm | R Documentation |
Moments up to the specified orders of a possibly truncated d
-dimensional
normal distribution; the distribution must be non-degenerate.
Each component variable can be truncated on one side (to the left or
to the right) or on two sides or not truncated.
After the initial stage, cumulants up to the fourth order and other
quantities are computed, provided all moments of the required order
had been computed in the first stage.
mom.mtruncnorm(powers=4, mean, varcov, lower, upper, cum = TRUE, ...)
powers |
a vector of non-negative integer values representing the required order of moments for each component variable, or a single such value, in which case this value is repeated for all component variables. |
mean |
a |
varcov |
a symmetric positive definite matrix with dimensions |
lower |
a |
upper |
a |
cum |
a logical value; if codeTRUE (default value), cumulants are other quantities are computed up to the minimum between the fourth order and the maximum possible order, given the available moments. |
... |
additional arguments passed to |
The maximal value of d is 20
. If this threshold is exceeded, NA
s
are returned. The constraint originates from the underlying function
sadmvn
.
This function makes use of two workhorses, recintab
and mom2cum
,
providing a user-friendly interface to these more basic tools.
The first function computes an array of raw moments of the truncated normal;
the second function translates them into cumulants and other quantities
such as the Mardia's measures of skewness and kurtosis, unless cum=FALSE
.
See the documentation of these two underlying functions for additional
information about the arguments and the returned quantities.
The argument ...
is passed, via recintab
, to sadmvn
for regulation of its working.
Not all d
component variables need to be truncated.
In fact, the function works also with no truncated components
(just omit lower
and upper
),
although for this case there exist known formulae to do the job.
A list with the following components:
mom |
an array with raw moments as produced by |
cum1 |
the vector of first-order cumulants,
AKA the expected value or the mean value,
which will be there provided |
order2, ... |
additional lists with higher order terms up to order 4;
these lists only exist when the available moments are of sufficiently
high order. See |
Adelchi Azzalini
recintab
, mom2cum
, sadmvn
mu <- c(1, -0.5, 0) Sigma <- toeplitz(1/(1:3)) lower <- c(-Inf, -3, -4) upper <- c(1.5, Inf, 2) m <- mom.mtruncnorm(1, mu, Sigma, lower, upper) print(m$cum1) # m <- mom.mtruncnorm(3, mu, Sigma, lower, upper) print(m$order3$gamma1.marginal) print(m$order3$gamma1.Mardia) # #-- # Example 2 of Leppard & Tallis (1989, Appl.Stat. vol.38, p.547) truncp <- c(0, 1, 2) U <- c(0, 0, 0) V <- 0.5*(diag(3) + matrix(1, 3, 3)) m <- mom.mtruncnorm(2, U, V, truncp) print(m$cum1, digits=9) print(m$order2$cum2, digits=9)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.