Learn R Programming

clusteval (version 0.1)

sim_student: Generates random variates from multivariate Student's t populations.

Description

We generate $n_m$ observations $(m = 1, \ldots, M)$ from each of $M$ multivariate Student's t distributions such that the Euclidean distance between each of the means and the origin is equal and scaled by $\Delta \ge 0$.

Usage

sim_student(n = rep(25, 5), p = 50, df = rep(6, 5),
    delta = 0, Sigma = diag(p), seed = NULL)

Arguments

Value

named list containing: [object Object],[object Object]

Details

Let $\Pi_m$ denote the $m$th population with a $p$-dimensional multivariate Student's t distribution, $T_p(\mu_m, \Sigma_m, c_m)$, where $\mu_m$ is the population location vector, $\Sigma_m$ is the positive-definite covariance matrix, and $c_m$ is the degrees of freedom.

Let $e_m$ be the $m$th standard basis vector (i.e., the $m$th element is 1 and the remaining values are 0). Then, we define $$\mu_m = \Delta \sum_{j=1}^{p/M} e_{(p/M)(m-1) + j}.$$ Note that p must be divisible by M. By default, the first 10 dimensions of $\mu_1$ are set to delta with all remaining dimensions set to 0, the second 10 dimensions of $\mu_2$ are set to delta with all remaining dimensions set to 0, and so on.

We use a common covariance matrix $\Sigma_m = \Sigma$ for all populations.

For small values of $c_m$, the tails are heavier, and, therefore, the average number of outlying observations is increased.

By default, we let $M = 5$, $\Delta = 0$, $\Sigma_m = I_p$, and $c_m = 6$, $m = 1, \ldots, M$, where $I_p$ denotes the $p \times p$ identity matrix. Furthermore, we generate 25 observations from each population by default.

For $\Delta = 0$ and $c_m = c$, $m = 1, \ldots, M$, the $M$ populations are equal.

Examples

Run this code
data_generated <- sim_student(n = 10 * seq_len(5), seed = 42)
dim(data_generated$x)
table(data_generated$y)

data_generated2 <- sim_student(p = 10, delta = 2, df = rep(2, 5))
table(data_generated2$y)
sample_means <- with(data_generated2,
                     tapply(seq_along(y), y, function(i) {
                            colMeans(x[i,])
                     }))
(sample_means <- do.call(rbind, sample_means))

Run the code above in your browser using DataLab