model: Constructor for the S4 model class

Description Usage Arguments Details Value See Also Examples

Description

model creates a finite mixture model with given parameters.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
model(
  dist = "poisson",
  r,
  K,
  weight = matrix(),
  par = list(),
  indicmod = "multinomial",
  indicfix = FALSE,
  T = matrix()
)

Arguments

dist

A character, defining the distribution family. Possible choices are "binomial", "exponential", "normal", "normult", "poisson", "student", and "studmult".

r

An integer. Defines the vector dimension of a model. Is one for all univariate distributions and larger than one for "normult" and "studmult".

K

An integer, defining the number of components in the finite mixture. Must be larger or equal to one.

weight

A matrix, containing the weights of the finite mixture model. The matrix must have dimension 1 x K and weights must add to one and must all be larger or equal to zero.

par

A list containing the parameter vectors for the finite mixture distribution. The list can contain more than one named parameter vector. Depending on the distribution parameters must be defined in the list as follows: a K-dimensional vector of probabilities named "p" for a "binomial" model, a K-dimensional vector of positive rates named "lambda" for an "exponential" model, K-dimensional vectors of means named "mu" and variances named sigma for a "normal" model, a r x K-dimensional matrix of means named "mu" and a K x r x r dimensional array of variance-covariance matrices named "sigma" for a "normult" model, a K-dimensional vector of rates named "rates" for a "poisson" model, K-dimensional vectors of means named "mu", variances named sigma, and degrees of freedom named "df" for a "student" model, a r x K-dimensional matrix of means named "mu", a K x r x r dimensional array of variance-covariance matrices named "sigma", and a K-dimensional vector of degrees of freedom for a "studmult" model.

indicmod

A character defining the indicator model used. For now only "multinomial" is implemented.

indicfix

A logical. If TRUE the indicators are given and therefore fixed.

T

A matrix containing the repetitions in case of a "binomial" or "poisson" model. Must be positive integers.

Details

This is a constructor that creates a class object and guides the user in regard to the different parameters needed to define a finite mixture model.

Value

An S4 model object.

See Also

Examples

1
f_model <- model(dist = "poisson", K = 2, par = list(lambda = c(0.17, 0.2)))

simonsays1980/finmix documentation built on Dec. 23, 2021, 2:25 a.m.