Learn R Programming

extracat (version 1.6-3)

arsim: block-structured arrays

Description

Generates an array or matrix that includes k fully separated block-clusters.

Usage

arsim(n, dim, k, noise = 0, shuffle = TRUE, v = 0.1, minc = 1,
 exp.prop = NULL, min.prop = 1/dim/4, noise.type = "s",
 dimnames=list(LETTERS,1:max(dim)))

Arguments

n
The number of observations in the array.
dim
The dimension of the array.
k
The number of clusters. 1 for no clusters.
noise
The proportion of noise among the observations. There are two choices for noise.type.
shuffle
Whether or not to shuffle the original category orders randomly.
v
A variability parameter for the assignment of the observations to the block clusters. Small values lea
minc
The minimum number of categories each cluster must have in each variable. E.g. minc = 2 means, that each block cluster covers at least 2 categories in each dimension.
exp.prop
Optional: expected proportions of the observations which fall into the block clusters.
min.prop
Minimum proportion of observations in each cluster.
noise.type
Either "s" or "I". The noise type "s" means that n*noise observations are drawn at random from the block-diagonal matrix. Then for these observations the category labels are permuted at random. "I"
dimnames
A list of 2: The first entry defines the variable labels (default: A,B,C,...) and the second entry defines the category labels (default 1:k).

Value

  • A simulated data array.

Details

Not a very sophisticated way of generating random arrays but it serves for tests and illustrations of the other functions.

Examples

Run this code
A <- arsim(1000, c(12,12), 3, shuffle = FALSE)
fluctile(A)

A <- arsim(1000, c(12,12), 3, shuffle = FALSE, dimnames = list(NULL,letters))
dimnames(A)

A <- arsim(4000, c(11,7,5), 3, shuffle = TRUE, dimnames = list(0:2,letters))
dimnames(A)

A2<- arsim(1000, c(12,12,12), 3, shuffle = FALSE)
fluctile3d(A2, shape ="oct")

Run the code above in your browser using DataLab