arsim: block-structured arrays

Description Usage Arguments Details Value Examples

View source: R/arsim.R

Description

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

Usage

1
2
3
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" adds noise in form of a random sample from the independence matrix with the same marginal totals as the block matrix.

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).

Details

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

Value

A simulated data array.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
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)

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

## End(Not run)

extracat documentation built on July 17, 2018, 5:05 p.m.

Related to arsim in extracat...