fdata-class: Finmix 'fdata' class

Description Details Slots See Also

Description

The fdata class holds the data for finite mixture distributions.

Details

The fdata class defines an essential part of the finmix package and MCMC sampling for finite mixture distributions. It stores the data for finite mixture distributions which includes always the observations stored in slot y and occasionally also known indicators in slot S. The latter ones define either a so-called finite mixture model with fixed indicators or are used as starting indicators in MCMC sampling for a model with unknown indicators.

Observations can be stored in either in row or column format (default). In the former case the slot bycolumn has to be set to FALSE to indicate the safeguard functions in methods that the observations are stored in row format. If indicators are stored in the fdata object they must be stored in the same format as the observations. When using the setter setS()<- converting the repetitions to the right format is handled for the user.

For discrete mixture models with Poisson or Exponential distributions exposures can be added to the data (and model). Exposures scale the rate parameters individually for each observation. Exposures get stored in the slot exp and have to be either of dimension Nx1 or of dimension 1x1. Like observations and indicators, exposures also have to be provided in the same data format, i.e. either row or column depending on the slot bycolumn set to FALSE or TRUE. When using the setter setExp()<- converting the repetitions to the right format is handled for the user.

For mixtures of binomial distributions it is possible to include repetitions in the slot T of the fdata object. Repetitions can be constant or varying. In the former case the dimension of slot T is 1x1 and in the latter one it is Nx1. Depending on the slot bycolumn the repetitions have to be provided in row or column format. When using the setter setT()<- converting the repetitions to the right format is handled for the user.

For mixtures of multivariate data the slot r is larger than one. For all other mixtures it is equal to one. Note that in case of multivariate mixture models the data in slot y has to be of dimension Nxr or rxN depending on the slot bycolumn set to TRUE or FALSE.

Methods

There are a couple of methods that intend to simplify the handling of data for the user. These methods are listed below.

Show
Getters
Setters

All setters help the user to set the slots in the right format and with the correct class (integer, matrix, etc.). It is internally checked, if the new value fits the other slots of the object.

Checking methods

The checking methods are provided to allow a user to integrate the finmix classes more easily into a larger code basis. They check, if the slots are available and return a logical.

Plotting

The plotting function should help the user to get an impression of how the data in the fdata object is distributed. This is important for evaluating what kind of distribution to choose and how many mixture components to test for.

Slots

y

A matrix containing the observations for finite mixture estimation. Can be by column or row depending on the slot bycolumn.

N

An integer holding the number of observations.

r

An integer defining the dimension of the data. Only for multivariate distributions like normult or studmult the dimension is larger one.

S

A matrix containing the indicators of the data. If the fdata class contains indicators estimation is performed with a fixed indicator approach.

bycolumn

A logical indicating if the data in y and S is sorted by by column (TRUE) or row (FALSE).

name

A character specifying a name for the data. Optional.

type

A character specifying the data type: either discrete for discrete data or continuous for continuous data. The two data types are treated differently when calculating data moments.

sim

A logical indicating, if the data was simulated.

exp

A matrix containing the exposures of Poisson data.

T

A matrix containing the (optional) repetitions of binomial or Poisson data. Must be of type integer.

See Also


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