Learn R Programming

Kmedians (version 2.2.0)

gen_K: gen_K

Description

Generate a sample of a Gaussian Mixture Model whose centers are generate randomly on a sphere of radius radius.

Usage

gen_K(n=500,d=5,K=3,pcont=0,df=1,
      cont="Student",min=-5,max=5,radius=5)

Value

A list with:

X

A numerical matrix giving the generated data.

cluster

An character vector specifying the true classification.

Arguments

n

A positive integer giving the number of data per cluster. Default is 500.

d

A positive integer giving the dimension. Default is 5.

K

A positive integer giving the number of clusters. Default is 3.

pcont

A scalar between 0 and 1 giving the proportion of contaminated data.

df

A positive integer giving the degrees of freedom of the law of the contaminated data if cont='Student'. Default is 1.

cont

The law of the contaminated data. Can be 'Student' (default) and 'Unif'.

min

A scalar giving the lower bound of the uniform law if cont='Unif'. Default is -5.

max

A scalar giving the upper bound of the uniform law if cont='Unif'. Default is 5.

radius

The radius of the sphere on each the centers of the class are generated. Default is 5.

See Also

See also Kmedians and Kmeans.

Examples

Run this code
n <- 500
K <- 3
pcont <- 0.2
ech <- gen_K(n=n,K=K,pcont=pcont)
X=ech$X

Run the code above in your browser using DataLab