StMoE (Skew-t Mixture-of-Experts) provides a flexible and robust modelling framework for heterogenous data with possibly skewed, heavy-tailed distributions and corrupted by atypical observations. StMoE consists of a mixture of K skew-t expert regressors network (of degree p) gated by a softmax gating network (of degree q) and is represented by:
alpha
’s of the softmax
net.beta
’s, scale parameters
sigma
’s, the skewness parameters lambda
’s and
the degree of freedom parameters nu
’s.
StMoE thus generalises mixtures of (normal,
skew-normal, t, and skew-t) distributions and mixtures of regressions
with these distributions. For example, when q = 0, we retrieve mixtures of
(skew-t, t-, skew-normal, or normal) regressions, and when both p = 0 and q = 0, it is a mixture of (skew-t,
t-, skew-normal, or normal) distributions. It also reduces to the
standard (normal, skew-normal, t, and skew-t) distribution when we only
use a single expert (K = 1).Model estimation/learning is performed by a dedicated expectation conditional maximization (ECM) algorithm by maximizing the observed data log-likelihood. We provide simulated examples to illustrate the use of the model in model-based clustering of heterogeneous regression data and in fitting non-linear regression functions.
It was written in R Markdown, using the knitr package for production.
See help(package="meteorits")
for further details and
references provided by citation("meteorits")
.
n <- 500 # Size of the sample
alphak <- matrix(c(0, 8), ncol = 1) # Parameters of the gating network
betak <- matrix(c(0, -2.5, 0, 2.5), ncol = 2) # Regression coefficients of the experts
sigmak <- c(0.5, 0.5) # Standard deviations of the experts
lambdak <- c(3, 5) # Skewness parameters of the experts
nuk <- c(5, 7) # Degrees of freedom of the experts network t densities
x <- seq.int(from = -1, to = 1, length.out = n) # Inputs (predictors)
# Generate sample of size n
sample <- sampleUnivStMoE(alphak = alphak, betak = betak, sigmak = sigmak,
lambdak = lambdak, nuk = nuk, x = x)
y <- sample$y
stmoe <- emStMoE(X = x, Y = y, K, p, q, n_tries, max_iter,
threshold, verbose, verbose_IRLS)
## EM - StMoE: Iteration: 1 | log-likelihood: -385.368829345481
## EM - StMoE: Iteration: 2 | log-likelihood: -338.957872929278
## EM - StMoE: Iteration: 3 | log-likelihood: -327.905843918556
## EM - StMoE: Iteration: 4 | log-likelihood: -321.091943693949
## EM - StMoE: Iteration: 5 | log-likelihood: -315.86005566305
## EM - StMoE: Iteration: 6 | log-likelihood: -311.586637947083
## EM - StMoE: Iteration: 7 | log-likelihood: -307.909989823282
## EM - StMoE: Iteration: 8 | log-likelihood: -304.622933118144
## EM - StMoE: Iteration: 9 | log-likelihood: -301.606754948985
## EM - StMoE: Iteration: 10 | log-likelihood: -298.790519771365
## EM - StMoE: Iteration: 11 | log-likelihood: -296.133891470474
## EM - StMoE: Iteration: 12 | log-likelihood: -293.622855137567
## EM - StMoE: Iteration: 13 | log-likelihood: -291.272248882122
## EM - StMoE: Iteration: 14 | log-likelihood: -289.095233130465
## EM - StMoE: Iteration: 15 | log-likelihood: -287.095460150291
## EM - StMoE: Iteration: 16 | log-likelihood: -285.267766070026
## EM - StMoE: Iteration: 17 | log-likelihood: -283.602385978574
## EM - StMoE: Iteration: 18 | log-likelihood: -282.086217862809
## EM - StMoE: Iteration: 19 | log-likelihood: -280.708683619841
## EM - StMoE: Iteration: 20 | log-likelihood: -279.458580113783
## EM - StMoE: Iteration: 21 | log-likelihood: -278.319474845686
## EM - StMoE: Iteration: 22 | log-likelihood: -277.278284811922
## EM - StMoE: Iteration: 23 | log-likelihood: -276.325613980097
## EM - StMoE: Iteration: 24 | log-likelihood: -275.452054838214
## EM - StMoE: Iteration: 25 | log-likelihood: -274.652613602365
## EM - StMoE: Iteration: 26 | log-likelihood: -273.917906535753
## EM - StMoE: Iteration: 27 | log-likelihood: -273.241683367699
## EM - StMoE: Iteration: 28 | log-likelihood: -272.620297909754
## EM - StMoE: Iteration: 29 | log-likelihood: -272.048100302575
## EM - StMoE: Iteration: 30 | log-likelihood: -271.521464819982
## EM - StMoE: Iteration: 31 | log-likelihood: -271.038599059341
## EM - StMoE: Iteration: 32 | log-likelihood: -270.595796976774
## EM - StMoE: Iteration: 33 | log-likelihood: -270.190801323282
## EM - StMoE: Iteration: 34 | log-likelihood: -269.819543204151
## EM - StMoE: Iteration: 35 | log-likelihood: -269.478373231286
## EM - StMoE: Iteration: 36 | log-likelihood: -269.166160200449
## EM - StMoE: Iteration: 37 | log-likelihood: -268.880164029563
## EM - StMoE: Iteration: 38 | log-likelihood: -268.619209103127
## EM - StMoE: Iteration: 39 | log-likelihood: -268.382415131731
## EM - StMoE: Iteration: 40 | log-likelihood: -268.166837431276
## EM - StMoE: Iteration: 41 | log-likelihood: -267.971180122846
## EM - StMoE: Iteration: 42 | log-likelihood: -267.793959798785
## EM - StMoE: Iteration: 43 | log-likelihood: -267.632678733798
## EM - StMoE: Iteration: 44 | log-likelihood: -267.484641759751
## EM - StMoE: Iteration: 45 | log-likelihood: -267.349025284738
## EM - StMoE: Iteration: 46 | log-likelihood: -267.224969938457
## EM - StMoE: Iteration: 47 | log-likelihood: -267.111038588831
## EM - StMoE: Iteration: 48 | log-likelihood: -267.006140754541
## EM - StMoE: Iteration: 49 | log-likelihood: -266.909638800181
## EM - StMoE: Iteration: 50 | log-likelihood: -266.821844217366
## EM - StMoE: Iteration: 51 | log-likelihood: -266.741675390736
## EM - StMoE: Iteration: 52 | log-likelihood: -266.668039491455
## EM - StMoE: Iteration: 53 | log-likelihood: -266.600405363101
## EM - StMoE: Iteration: 54 | log-likelihood: -266.53810748787
## EM - StMoE: Iteration: 55 | log-likelihood: -266.480942123515
## EM - StMoE: Iteration: 56 | log-likelihood: -266.428432544918
## EM - StMoE: Iteration: 57 | log-likelihood: -266.380169159284
## EM - StMoE: Iteration: 58 | log-likelihood: -266.336167918516
## EM - StMoE: Iteration: 59 | log-likelihood: -266.29577779607
## EM - StMoE: Iteration: 60 | log-likelihood: -266.258877606723
## EM - StMoE: Iteration: 61 | log-likelihood: -266.224885499263
## EM - StMoE: Iteration: 62 | log-likelihood: -266.19351962907
## EM - StMoE: Iteration: 63 | log-likelihood: -266.164573626451
## EM - StMoE: Iteration: 64 | log-likelihood: -266.137898698178
## EM - StMoE: Iteration: 65 | log-likelihood: -266.112925279816
## EM - StMoE: Iteration: 66 | log-likelihood: -266.08987886246
## EM - StMoE: Iteration: 67 | log-likelihood: -266.068497191113
## EM - StMoE: Iteration: 68 | log-likelihood: -266.048645457238
## EM - StMoE: Iteration: 69 | log-likelihood: -266.030200027439
## EM - StMoE: Iteration: 70 | log-likelihood: -266.01302419053
## EM - StMoE: Iteration: 71 | log-likelihood: -265.997173019411
## EM - StMoE: Iteration: 72 | log-likelihood: -265.982666379885
## EM - StMoE: Iteration: 73 | log-likelihood: -265.969291450179
## EM - StMoE: Iteration: 74 | log-likelihood: -265.95723588626
## EM - StMoE: Iteration: 75 | log-likelihood: -265.945950370812
## EM - StMoE: Iteration: 76 | log-likelihood: -265.935368063594
## EM - StMoE: Iteration: 77 | log-likelihood: -265.925493175691
## EM - StMoE: Iteration: 78 | log-likelihood: -265.916283730973
## EM - StMoE: Iteration: 79 | log-likelihood: -265.907695902565
## EM - StMoE: Iteration: 80 | log-likelihood: -265.899671140248
## EM - StMoE: Iteration: 81 | log-likelihood: -265.892173595027
## EM - StMoE: Iteration: 82 | log-likelihood: -265.885161575097
## EM - StMoE: Iteration: 83 | log-likelihood: -265.878598628939
## EM - StMoE: Iteration: 84 | log-likelihood: -265.872455454284
## EM - StMoE: Iteration: 85 | log-likelihood: -265.866700516292
## EM - StMoE: Iteration: 86 | log-likelihood: -265.861307843709
## EM - StMoE: Iteration: 87 | log-likelihood: -265.856252249653
## EM - StMoE: Iteration: 88 | log-likelihood: -265.851510833699
## EM - StMoE: Iteration: 89 | log-likelihood: -265.847062266813
## EM - StMoE: Iteration: 90 | log-likelihood: -265.842886812221
## EM - StMoE: Iteration: 91 | log-likelihood: -265.838966268996
## EM - StMoE: Iteration: 92 | log-likelihood: -265.835283763561
## EM - StMoE: Iteration: 93 | log-likelihood: -265.831823644097
## EM - StMoE: Iteration: 94 | log-likelihood: -265.828571383852
## EM - StMoE: Iteration: 95 | log-likelihood: -265.825513492698
## EM - StMoE: Iteration: 96 | log-likelihood: -265.822637436224
## EM - StMoE: Iteration: 97 | log-likelihood: -265.819931561722
## EM - StMoE: Iteration: 98 | log-likelihood: -265.817385030429
stmoe$summary()
## ------------------------------------------
## Fitted Skew t Mixture-of-Experts model
## ------------------------------------------
##
## StMoE model with K = 2 experts:
##
## log-likelihood df AIC BIC ICL
## -265.8174 12 -277.8174 -303.105 -303.1061
##
## Clustering table (Number of observations in each expert):
##
## 1 2
## 250 250
##
## Regression coefficients:
##
## Beta(k = 1) Beta(k = 2)
## 1 -0.03015558 0.04117581
## X^1 2.56978382 -2.62659694
##
## Variances:
##
## Sigma2(k = 1) Sigma2(k = 2)
## 0.4781602 0.2703674
stmoe <- emStMoE(X = x, Y = y, K, p, q, n_tries, max_iter,
threshold, verbose, verbose_IRLS)
## EM - StMoE: Iteration: 1 | log-likelihood: -606.771761531912
## EM - StMoE: Iteration: 2 | log-likelihood: -586.561692945793
## EM - StMoE: Iteration: 3 | log-likelihood: -583.447512566881
## EM - StMoE: Iteration: 4 | log-likelihood: -582.444436830449
## EM - StMoE: Iteration: 5 | log-likelihood: -581.81775123626
## EM - StMoE: Iteration: 6 | log-likelihood: -578.755448157513
## EM - StMoE: Iteration: 7 | log-likelihood: -574.084770502747
## EM - StMoE: Iteration: 8 | log-likelihood: -567.483719855793
## EM - StMoE: Iteration: 9 | log-likelihood: -563.392320705151
## EM - StMoE: Iteration: 10 | log-likelihood: -561.070833661223
## EM - StMoE: Iteration: 11 | log-likelihood: -559.986179911805
## EM - StMoE: Iteration: 12 | log-likelihood: -559.394908329518
## EM - StMoE: Iteration: 13 | log-likelihood: -559.031608284086
## EM - StMoE: Iteration: 14 | log-likelihood: -558.851433366803
## EM - StMoE: Iteration: 15 | log-likelihood: -558.744986081847
## EM - StMoE: Iteration: 16 | log-likelihood: -558.653737337899
## EM - StMoE: Iteration: 17 | log-likelihood: -558.563781308371
## EM - StMoE: Iteration: 18 | log-likelihood: -558.475801877821
## EM - StMoE: Iteration: 19 | log-likelihood: -558.394465699026
## EM - StMoE: Iteration: 20 | log-likelihood: -558.997974541465
## EM - StMoE: Iteration: 21 | log-likelihood: -559.037190048569
## EM - StMoE: Iteration: 22 | log-likelihood: -556.107785417442
## EM - StMoE: Iteration: 23 | log-likelihood: -553.601906436936
## EM - StMoE: Iteration: 24 | log-likelihood: -550.826015554533
## EM - StMoE: Iteration: 25 | log-likelihood: -548.047967799554
## EM - StMoE: Iteration: 26 | log-likelihood: -546.505574727569
## EM - StMoE: Iteration: 27 | log-likelihood: -546.479989547421
## EM - StMoE: Iteration: 28 | log-likelihood: -545.930939419644
## EM - StMoE: Iteration: 29 | log-likelihood: -545.838527918075
## EM - StMoE: Iteration: 30 | log-likelihood: -545.547761419624
## EM - StMoE: Iteration: 31 | log-likelihood: -545.392888056218
## EM - StMoE: Iteration: 32 | log-likelihood: -545.201933146192
## EM - StMoE: Iteration: 33 | log-likelihood: -545.057976363591
## EM - StMoE: Iteration: 34 | log-likelihood: -544.915866609333
## EM - StMoE: Iteration: 35 | log-likelihood: -544.778609979587
## EM - StMoE: Iteration: 36 | log-likelihood: -544.65567582502
## EM - StMoE: Iteration: 37 | log-likelihood: -544.562652854454
## EM - StMoE: Iteration: 38 | log-likelihood: -544.497436327704
## EM - StMoE: Iteration: 39 | log-likelihood: -544.450809799142
## EM - StMoE: Iteration: 40 | log-likelihood: -544.415972951376
## EM - StMoE: Iteration: 41 | log-likelihood: -544.388959266028
## EM - StMoE: Iteration: 42 | log-likelihood: -544.367143943402
## EM - StMoE: Iteration: 43 | log-likelihood: -544.348994405836
## EM - StMoE: Iteration: 44 | log-likelihood: -544.333112065702
## EM - StMoE: Iteration: 45 | log-likelihood: -544.318734780046
## EM - StMoE: Iteration: 46 | log-likelihood: -544.305006285508
## EM - StMoE: Iteration: 47 | log-likelihood: -544.291642106507
## EM - StMoE: Iteration: 48 | log-likelihood: -544.278420092602
## EM - StMoE: Iteration: 49 | log-likelihood: -544.264859186116
## EM - StMoE: Iteration: 50 | log-likelihood: -544.250962220532
## EM - StMoE: Iteration: 51 | log-likelihood: -544.236623290403
## EM - StMoE: Iteration: 52 | log-likelihood: -544.222450757797
## EM - StMoE: Iteration: 53 | log-likelihood: -544.208379304201
## EM - StMoE: Iteration: 54 | log-likelihood: -544.193955268967
## EM - StMoE: Iteration: 55 | log-likelihood: -544.178805382651
## EM - StMoE: Iteration: 56 | log-likelihood: -544.162868886061
## EM - StMoE: Iteration: 57 | log-likelihood: -544.145735093955
## EM - StMoE: Iteration: 58 | log-likelihood: -544.1274166452
## EM - StMoE: Iteration: 59 | log-likelihood: -544.10811327324
## EM - StMoE: Iteration: 60 | log-likelihood: -544.087775524492
## EM - StMoE: Iteration: 61 | log-likelihood: -544.066355916492
## EM - StMoE: Iteration: 62 | log-likelihood: -544.043885904051
## EM - StMoE: Iteration: 63 | log-likelihood: -544.020429328589
## EM - StMoE: Iteration: 64 | log-likelihood: -543.996074967042
## EM - StMoE: Iteration: 65 | log-likelihood: -543.970924133561
## EM - StMoE: Iteration: 66 | log-likelihood: -543.945084896804
## EM - StMoE: Iteration: 67 | log-likelihood: -543.918675405591
## EM - StMoE: Iteration: 68 | log-likelihood: -543.891806578305
## EM - StMoE: Iteration: 69 | log-likelihood: -543.864653676363
## EM - StMoE: Iteration: 70 | log-likelihood: -543.837111963459
## EM - StMoE: Iteration: 71 | log-likelihood: -543.809540688493
## EM - StMoE: Iteration: 72 | log-likelihood: -543.781950003257
## EM - StMoE: Iteration: 73 | log-likelihood: -543.754411368293
## EM - StMoE: Iteration: 74 | log-likelihood: -543.727004034452
## EM - StMoE: Iteration: 75 | log-likelihood: -543.699801159361
## EM - StMoE: Iteration: 76 | log-likelihood: -543.672866770462
## EM - StMoE: Iteration: 77 | log-likelihood: -543.646254647981
## EM - StMoE: Iteration: 78 | log-likelihood: -543.620013016757
## EM - StMoE: Iteration: 79 | log-likelihood: -543.594221110494
## EM - StMoE: Iteration: 80 | log-likelihood: -543.568714449984
## EM - StMoE: Iteration: 81 | log-likelihood: -543.543655883385
## EM - StMoE: Iteration: 82 | log-likelihood: -543.518919089798
## EM - StMoE: Iteration: 83 | log-likelihood: -543.494460334177
## EM - StMoE: Iteration: 84 | log-likelihood: -543.470265272329
## EM - StMoE: Iteration: 85 | log-likelihood: -543.446332402836
## EM - StMoE: Iteration: 86 | log-likelihood: -543.422665030909
## EM - StMoE: Iteration: 87 | log-likelihood: -543.399274620568
## EM - StMoE: Iteration: 88 | log-likelihood: -543.376172192305
## EM - StMoE: Iteration: 89 | log-likelihood: -543.353371503096
## EM - StMoE: Iteration: 90 | log-likelihood: -543.330887253182
## EM - StMoE: Iteration: 91 | log-likelihood: -543.308734405987
## EM - StMoE: Iteration: 92 | log-likelihood: -543.286927640135
## EM - StMoE: Iteration: 93 | log-likelihood: -543.265483466841
## EM - StMoE: Iteration: 94 | log-likelihood: -543.244413050723
## EM - StMoE: Iteration: 95 | log-likelihood: -543.223728695496
## EM - StMoE: Iteration: 96 | log-likelihood: -543.203440847095
## EM - StMoE: Iteration: 97 | log-likelihood: -543.18355274543
## EM - StMoE: Iteration: 98 | log-likelihood: -543.16406716914
## EM - StMoE: Iteration: 99 | log-likelihood: -543.145000870762
## EM - StMoE: Iteration: 100 | log-likelihood: -543.126361650697
## EM - StMoE: Iteration: 101 | log-likelihood: -543.10815075572
## EM - StMoE: Iteration: 102 | log-likelihood: -543.090367231217
## EM - StMoE: Iteration: 103 | log-likelihood: -543.073145524685
## EM - StMoE: Iteration: 104 | log-likelihood: -543.056212639894
## EM - StMoE: Iteration: 105 | log-likelihood: -543.039656283784
## EM - StMoE: Iteration: 106 | log-likelihood: -543.023499471695
## EM - StMoE: Iteration: 107 | log-likelihood: -543.007744102051
## EM - StMoE: Iteration: 108 | log-likelihood: -542.992385046313
## EM - StMoE: Iteration: 109 | log-likelihood: -542.977414591711
## EM - StMoE: Iteration: 110 | log-likelihood: -542.96282387138
## EM - StMoE: Iteration: 111 | log-likelihood: -542.948603843929
## EM - StMoE: Iteration: 112 | log-likelihood: -542.934743410917
## EM - StMoE: Iteration: 113 | log-likelihood: -542.921233336534
## EM - StMoE: Iteration: 114 | log-likelihood: -542.908063149674
## EM - StMoE: Iteration: 115 | log-likelihood: -542.895222852431
## EM - StMoE: Iteration: 116 | log-likelihood: -542.882701162245
## EM - StMoE: Iteration: 117 | log-likelihood: -542.870488406793
## EM - StMoE: Iteration: 118 | log-likelihood: -542.858574334182
## EM - StMoE: Iteration: 119 | log-likelihood: -542.84694912124
## EM - StMoE: Iteration: 120 | log-likelihood: -542.835602550974
## EM - StMoE: Iteration: 121 | log-likelihood: -542.824525303394
## EM - StMoE: Iteration: 122 | log-likelihood: -542.813708184743
## EM - StMoE: Iteration: 123 | log-likelihood: -542.803141396886
## EM - StMoE: Iteration: 124 | log-likelihood: -542.792817269777
## EM - StMoE: Iteration: 125 | log-likelihood: -542.78272689536
## EM - StMoE: Iteration: 126 | log-likelihood: -542.772862114713
## EM - StMoE: Iteration: 127 | log-likelihood: -542.763215070329
## EM - StMoE: Iteration: 128 | log-likelihood: -542.753778200441
## EM - StMoE: Iteration: 129 | log-likelihood: -542.744544234068
## EM - StMoE: Iteration: 130 | log-likelihood: -542.735506185751
## EM - StMoE: Iteration: 131 | log-likelihood: -542.726657349631
## EM - StMoE: Iteration: 132 | log-likelihood: -542.717992137591
## EM - StMoE: Iteration: 133 | log-likelihood: -542.709503495123
## EM - StMoE: Iteration: 134 | log-likelihood: -542.701185806975
## EM - StMoE: Iteration: 135 | log-likelihood: -542.69303352057
## EM - StMoE: Iteration: 136 | log-likelihood: -542.685041289601
## EM - StMoE: Iteration: 137 | log-likelihood: -542.677204000947
## EM - StMoE: Iteration: 138 | log-likelihood: -542.669516770903
## EM - StMoE: Iteration: 139 | log-likelihood: -542.661974935036
## EM - StMoE: Iteration: 140 | log-likelihood: -542.654574039802
## EM - StMoE: Iteration: 141 | log-likelihood: -542.64730983375
## EM - StMoE: Iteration: 142 | log-likelihood: -542.640177601694
## EM - StMoE: Iteration: 143 | log-likelihood: -542.633174157418
## EM - StMoE: Iteration: 144 | log-likelihood: -542.626295622597
## EM - StMoE: Iteration: 145 | log-likelihood: -542.619538309123
## EM - StMoE: Iteration: 146 | log-likelihood: -542.612898767655
## EM - StMoE: Iteration: 147 | log-likelihood: -542.606373690512
## EM - StMoE: Iteration: 148 | log-likelihood: -542.599959904285
## EM - StMoE: Iteration: 149 | log-likelihood: -542.593654362998
## EM - StMoE: Iteration: 150 | log-likelihood: -542.587454141137
## EM - StMoE: Iteration: 151 | log-likelihood: -542.581356427155
## EM - StMoE: Iteration: 152 | log-likelihood: -542.575358517799
## EM - StMoE: Iteration: 153 | log-likelihood: -542.569457812758
## EM - StMoE: Iteration: 154 | log-likelihood: -542.563651834462
## EM - StMoE: Iteration: 155 | log-likelihood: -542.55793815251
## EM - StMoE: Iteration: 156 | log-likelihood: -542.552314444163
## EM - StMoE: Iteration: 157 | log-likelihood: -542.546778469773
## EM - StMoE: Iteration: 158 | log-likelihood: -542.541328068303
## EM - StMoE: Iteration: 159 | log-likelihood: -542.535961153738
stmoe$summary()
## ------------------------------------------
## Fitted Skew t Mixture-of-Experts model
## ------------------------------------------
##
## StMoE model with K = 4 experts:
##
## log-likelihood df AIC BIC ICL
## -542.536 30 -572.536 -615.8912 -616.539
##
## Clustering table (Number of observations in each expert):
##
## 1 2 3 4
## 25 40 31 37
##
## Regression coefficients:
##
## Beta(k = 1) Beta(k = 2) Beta(k = 3) Beta(k = 4)
## 1 -0.86071020 1117.69501 -1807.612653 132.89203206
## X^1 -0.70112209 -121.38548 111.287737 -6.69941241
## X^2 0.02430659 2.93944 -1.666764 0.07041107
##
## Variances:
##
## Sigma2(k = 1) Sigma2(k = 2) Sigma2(k = 3) Sigma2(k = 4)
## 6.91373 504.1935 570.7413 1404.837