rtheta: Get random parameters for the Gaussian mixture (copula) model

Description Usage Arguments Details Value Note Author(s) References See Also Examples

View source: R/rtheta.R

Description

Generate a random set parameters for the Gaussian mixture model (GMM) and Gaussian mixture copula model (GMCM). Primarily, it provides an easy prototype of the theta-format used in GMCM.

Usage

1
2
rtheta(m = 3, d = 2, method = c("old", "EqualSpherical",
  "UnequalSpherical", "EqualEllipsoidal", "UnequalEllipsoidal"))

Arguments

m

The number of components in the mixture.

d

The dimension of the mixture distribution.

method

The method by which the theta should be generated. See details. Defaults to "old" which is the regular "old" behavior.

Details

Depending on the method argument the parameters are generated as follows. The new behavior is inspired by the simulation scenarios in Friedman (1989) but not exactly the same.

Value

A named list of parameters with the 4 elements:

m

An integer giving the number of components in the mixture. Default is 3.

d

An integer giving the dimension of the mixture distribution. Default is 2.

pie

A numeric vector of length m of mixture proportions between 0 and 1 which sums to one.

mu

A list of length m of numeric vectors of length d for each component.

sigma

A list of length m of variance-covariance matrices (of size d times d) for each component.

Note

The function is.theta checks whether or not theta is in the correct format.

Author(s)

Anders Ellern Bilgrau <anders.ellern.bilgrau@gmail.com>

References

Friedman, Jerome H. "Regularized discriminant analysis." Journal of the American statistical association 84.405 (1989): 165-175.

See Also

is.theta

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
rtheta()

rtheta(d = 5, m = 2)

rtheta(d = 3, m = 2, method = "EqualEllipsoidal")

test <- rtheta()
is.theta(test)

summary(test)
print(test)
plot(test)

## Not run: 
A <- SimulateGMMData(n = 100, rtheta(d = 2, method = "EqualSpherical"))
plot(A$z, col = A$K, pch = A$K, asp = 1)
B <- SimulateGMMData(n = 100, rtheta(d = 2, method = "UnequalSpherical"))
plot(B$z, col = B$K, pch = B$K, asp = 1)
C <- SimulateGMMData(n = 100, rtheta(d = 2, method = "EqualEllipsoidal"))
plot(C$z, col = C$K, pch = C$K, asp = 1)
D <- SimulateGMMData(n = 100, rtheta(d = 2, method = "UnequalEllipsoidal"))
plot(D$z, col = D$K, pch = D$K, asp = 1)
## End(Not run)

Example output

theta object with d = 2 dimensions and m = 3 components:

$pie
     pie1      pie2      pie3 
0.4021378 0.2269200 0.3709422 

$mu
$mu$comp1
[1]  1.0500364 -0.1736079

$mu$comp2
[1] -2.491570 -8.668685

$mu$comp3
[1] -15.85840 -13.50386


$sigma
$sigma$comp1
          [,1]     [,2]
[1,] 12.163056 1.741049
[2,]  1.741049 4.066783

$sigma$comp2
          [,1]      [,2]
[1,]  3.342854 -0.307823
[2,] -0.307823  3.830170

$sigma$comp3
           [,1]       [,2]
[1,]  7.6616828 -0.8254486
[2,] -0.8254486  2.2629737


theta object with d = 5 dimensions and m = 2 components:

$pie
     pie1      pie2 
0.7286771 0.2713229 

$mu
$mu$comp1
[1]  -0.2844692 -11.3655777 -12.7313795   6.6928255 -21.8417287

$mu$comp2
[1]  -3.9719311  -0.2987447  -6.0156682  -8.6883948 -15.2704822


$sigma
$sigma$comp1
           [,1]       [,2]       [,3]        [,4]        [,5]
[1,]  8.6443726 -1.4604139 -1.2413539  0.32444381 -1.28967472
[2,] -1.4604139  5.7341061 -5.7677675 -0.05827420  6.59408096
[3,] -1.2413539 -5.7677675  8.1497953 -0.41609770 -7.93265000
[4,]  0.3244438 -0.0582742 -0.4160977  3.46816978  0.01804346
[5,] -1.2896747  6.5940810 -7.9326500  0.01804346 10.76709729

$sigma$comp2
           [,1]       [,2]       [,3]      [,4]       [,5]
[1,] 11.3815762 -1.2722233  0.2874251 -2.075619 -1.5642672
[2,] -1.2722233  7.7737208  0.6949327 -2.658452 -0.8588891
[3,]  0.2874251  0.6949327  8.6969376  1.789464 -1.8389893
[4,] -2.0756186 -2.6584521  1.7894642 12.120062  4.4621376
[5,] -1.5642672 -0.8588891 -1.8389893  4.462138 16.7178827


theta object with d = 3 dimensions and m = 2 components:

$pie
     pie1      pie2 
0.8224278 0.1775722 

$mu
$mu$comp1
[1] -14.598711  12.239396   2.703662

$mu$comp2
[1] 2.377408 2.616226 8.604377


$sigma
$sigma$comp1
         [,1]      [,2]      [,3]
[1,] 78.64017 25.266552 31.862327
[2,] 25.26655 29.528516 -3.153781
[3,] 31.86233 -3.153781 23.081313

$sigma$comp2
         [,1]      [,2]      [,3]
[1,] 78.64017 25.266552 31.862327
[2,] 25.26655 29.528516 -3.153781
[3,] 31.86233 -3.153781 23.081313


[1] TRUE
A theta object with d = 2 dimensions and m = 3 components.
theta object with d = 2 dimensions and m = 3 components:

$pie
     pie1      pie2      pie3 
0.5605378 0.3352609 0.1042014 

$mu
$mu$comp1
[1] -2.753359  3.025036

$mu$comp2
[1] -15.44550 -12.09916

$mu$comp3
[1]  13.88003 -20.82262


$sigma
$sigma$comp1
          [,1]      [,2]
[1,]  5.658463 -2.567036
[2,] -2.567036  1.626723

$sigma$comp2
         [,1]     [,2]
[1,] 6.723335 1.606619
[2,] 1.606619 5.427237

$sigma$comp3
           [,1]       [,2]
[1,]  0.8945315 -0.2450019
[2,] -0.2450019  3.4113624

GMCM documentation built on Nov. 6, 2019, 1:08 a.m.