otsort | R Documentation |
Given a q
-dimensional random vector \mathbf{X} = (\mathbf{X}_{1},...,\mathbf{X}_{k})
with \mathbf{X}_{i}
a d_{i}
-dimensional random vector, i.e., q = d_{1} + ... + d_{k}
,
this function sorts the columns (variables) of a sample of \mathbf{X}
such that the dimensions are in ascending order.
otsort(sample, dim)
sample |
A sample from a |
dim |
The vector of dimensions |
The columns of sample are rearranged such that the data corresponding to the random vector \mathbf{X}_{i}
having the smallest dimension d_{i}
comes first, then the random vector with second smallest dimension, and so on.
A list with elements "sample" containing the ordered sample, and "dim" containing the ordered dimensions.
q = 10
n = 50
dim = c(2,3,1,4)
# Sample from multivariate normal distribution
sample = mvtnorm::rmvnorm(n,rep(0,q),diag(q), method = "chol")
ordered = otsort(sample,dim)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.