rlsbclust {lsbclust} | R Documentation |
Simulate from LSBCLUST Model
Description
Simulate three-way arrays adhering to the LSBCLUST framework (see lsbclust
).
Usage
rlsbclust(ndata = 50L, nobs, size, nclust, clustsize = NULL,
delta = rep(1L, 4L), ndim = 2L, alpha = 0.5, fixed = c("none",
"rows", "columns"), err_sd = 1, svmins = 1, svmax = 6)
Arguments
ndata |
Integer giving the number of data sets to generate with the same underlying parameters. |
nobs |
Integer giving the number of observations to sample. |
size |
Vector with two elements giving the number of rows and columns respectively of each simulated observation. |
nclust |
A vector of length four giving the number of clusters for the overall mean, the row margins, the column margins and the interactions (in that order) respectively. Alternatively, a vector of length one, in which case all components will have the same number of clusters. |
clustsize |
A list of length four, with each element containing a vector
of the same length as the corresponding entry in |
delta |
A four-element binary vector (logical or numeric) indicating which sum-to-zero constraints must be enforced. |
ndim |
The required rank for the approximation of the interactions (a scalar). |
alpha |
Numeric value in [0, 1] which determines how the singular values are distributed
between rows and columns (passed to |
fixed |
One of |
err_sd |
The standard deviation of the error distribution, as passed to
|
svmins |
Vector of minimum values for the singular values
(as passed to |
svmax |
The maximum possible singular value (as passed to |
Examples
## Nothing fixed, balanced classes
set.seed(1)
dat <- rlsbclust(ndata = 1, nobs = 100, size = c(10, 8), nclust = c(5, 4, 6, 5))
res <- lsbclust(data = dat[[1]]$data, nclust = c(5, 4, 6, 5))
cfsim(res, dat[[1]])
## Rows fixed, balanced classes
set.seed(2)
dat <- rlsbclust(ndata = 1, nobs = 100, size = c(10, 8), nclust = c(5, 4, 6, 5),
fixed = "rows")
res <- lsbclust(data = dat[[1]]$data, nclust = c(5, 4, 6, 5), fixed = "rows")
cfsim(res, dat[[1]])
## Rows fixed, unbalanced classes
set.seed(3)
dat <- rlsbclust(ndata = 1, nobs = 100, size = c(10, 8), nclust = c(5, 4, 6, 5),
fixed = "columns",
clustsize = list(NULL, NULL, c(40, 25, 15, 10, 5, 5), c(40, 25, 15, 10, 10)))
res <- lsbclust(data = dat[[1]]$data, nclust = c(5, 4, 6, 5), fixed = "columns")
cfsim(res, dat[[1]])