R/model_mor.R
MoRPrior-class.Rd
An S4 class to represent a multivariate mixture of regression model.
The model follows [minka-linear](https://tminka.github.io/papers/minka-linear.pdf) .
The model corresponds to the following generative model:
$$ \pi \sim Dirichlet(\alpha)$$
$$ Z_i \sim \mathcal{M}(1,\pi)$$
$$ V_k \sim \mathcal{W}(\varepsilon^{-1},n_0)$$
$$ A_k \sim \mathcal{MN}(0,(V_k)^{-1},\tau X^{t}X)$$
$$ Y_{i.}|X_{i.}, A_k, Z_{ik}=1 \sim \mathcal{N}(A_k x_{i.},V_{k}^{-1})$$
with \(\mathcal{W}(\epsilon^{-1},n_0)\) the Whishart distribution and \(\mathcal{MN}\) the matrix-normal distribution.
The MoR-class
must be used when fitting a simple Mixture of Regression whereas the MoRPrior-class
must be used when fitting a MixedModels-class
.
MoRPrior(formula, tau = 0.001, N0 = NaN, epsilon = as.matrix(NaN))
MoR(formula, alpha = 1, tau = 0.1, N0 = NaN, epsilon = as.matrix(NaN))
a formula
that describe the linear model to use
Prior parameter (inverse variance) default 0.001
Prior parameter (default to NaN, in this case N0 will be fixed equal to the number of columns of Y.)
Covariance matrix prior parameter (default to NaN, in this case epsilon will be fixed to a diagonal variance matrix equal to 0.1 time the variance of the regression residuals with only one cluster.)
Dirichlet prior parameter over the cluster proportions (default to 1)
a MoRPrior-class
object
a MoR-class
object
MoR-class
: MoR class constructor
MoRPrior
: MoRPrior class constructor
MoR
: MoR class constructor
formula
a formula
that describe the linear model to use
tau
Prior parameter (inverse variance) default 0.001
epsilon
Covariance matrix prior parameter (default to as.matrix(NaN), in this case epsilon will be fixed to a diagonal variance matrix equal to 0.1 time the variance of the regression residuals with only one cluster.)
N0
Prior parameter (default to NaN, in this case N0 will be fixed equal to the number of columns of Y.)
alpha
Dirichlet prior parameter over the cluster proportions (default to 1)
Other DlvmModels:
DcLbmPrior-class
,
DcSbmPrior-class
,
DiagGmmPrior-class
,
DlvmPrior-class
,
Gmm
,
LcaPrior-class
,
MixedModels-class
,
MoMPrior-class
,
MultSbmPrior-class
,
SbmPrior-class
,
greed()
MoRPrior(y ~ x1 + x2)
#> An object of class "MoRPrior"
#> Slot "formula":
#> y ~ x1 + x2
#> <environment: 0x55d410fdf2a8>
#>
#> Slot "tau":
#> [1] 0.001
#>
#> Slot "N0":
#> [1] NaN
#>
#> Slot "epsilon":
#> [,1]
#> [1,] NaN
#>
MoRPrior(y ~ x1 + x2, N0 = 100)
#> An object of class "MoRPrior"
#> Slot "formula":
#> y ~ x1 + x2
#> <environment: 0x55d410fdf2a8>
#>
#> Slot "tau":
#> [1] 0.001
#>
#> Slot "N0":
#> [1] 100
#>
#> Slot "epsilon":
#> [,1]
#> [1,] NaN
#>
MoRPrior(cbind(y1, y2) ~ x1 + x2, N0 = 100)
#> An object of class "MoRPrior"
#> Slot "formula":
#> cbind(y1, y2) ~ x1 + x2
#> <environment: 0x55d410fdf2a8>
#>
#> Slot "tau":
#> [1] 0.001
#>
#> Slot "N0":
#> [1] 100
#>
#> Slot "epsilon":
#> [,1]
#> [1,] NaN
#>
MoR(y ~ x1 + x2)
#> An object of class "MoR"
#> Slot "formula":
#> y ~ x1 + x2
#> <environment: 0x55d410fdf2a8>
#>
#> Slot "tau":
#> [1] 0.1
#>
#> Slot "N0":
#> [1] NaN
#>
#> Slot "epsilon":
#> [,1]
#> [1,] NaN
#>
#> Slot "alpha":
#> [1] 1
#>
MoR(y ~ x1 + x2, N0 = 100)
#> An object of class "MoR"
#> Slot "formula":
#> y ~ x1 + x2
#> <environment: 0x55d410fdf2a8>
#>
#> Slot "tau":
#> [1] 0.1
#>
#> Slot "N0":
#> [1] 100
#>
#> Slot "epsilon":
#> [,1]
#> [1,] NaN
#>
#> Slot "alpha":
#> [1] 1
#>
MoR(cbind(y1, y2) ~ x1 + x2, N0 = 100)
#> An object of class "MoR"
#> Slot "formula":
#> cbind(y1, y2) ~ x1 + x2
#> <environment: 0x55d410fdf2a8>
#>
#> Slot "tau":
#> [1] 0.1
#>
#> Slot "N0":
#> [1] 100
#>
#> Slot "epsilon":
#> [,1]
#> [1,] NaN
#>
#> Slot "alpha":
#> [1] 1
#>