predict.mModel: Predictions for fitted Gaussian component model

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

View source: R/bgmm.r

Description

For every row in the matrix X the posterior probability of belonging to class i is calculated.

Usage

1
2
## S3 method for class 'mModel'
predict(object, X, knowns = NULL, B = NULL, P = NULL, ...)

Arguments

object

an object of the class mModel,

X

a matrix or data.frame in which number of columns is equal to object$d.

knowns

a data.frame or matrix with the labeled observations. If the argument knowns is specified then eighter B or P need to be specified.

P

a matrix with plausibilities for object knowns.

B

a matrix with beliefs for object knowns.

...

all other arguments will be neglected.

Details

The matrix tij of posterior probabilities is calculated as normalized products of priors pi's and density of model components in values specified by rows of the matrix X.

If arguments knowns and B are specified then the priors's for objects in knowns are replaced by belief matrix B. If arguments knowns and P are specified then the priors's for objects in knowns are multiplied by plausibility matrix P.

Value

An list with the following elements:

tij.X, tij.knowns

the matrix tij.X is a matrix with number of rows equal to number of rows in the matrix X and the number of columns equal to the number of components in model defined by argument object. Values in this matrix are posterior probabilities that observation i belongs to component j. The slot tij.knowns is equal to NULL if neither B nor P are specified, otherwise it is a matrix with number of rows equal to number of rows in the matrix knowns and contains posterior probabilities for observarions with specified belief or plausibilities matrix

class.X, class.knowns

vactors of labels/classes obtained with the MAP rule. The vector class.X corresponds to observations in X while the vector class.knowns corresponds to observations in knowns.

Author(s)

Przemyslaw Biecek, Ewa Szczurek, Martin Vingron, Jerzy Tiuryn (2012), The R Package bgmm: Mixture Modeling with Uncertain Knowledge, Journal of Statistical Software.

References

http://bgmm.molgen.mpg.de

See Also

belief

Examples

1
2
3
4
5
6
 data(genotypes)

 modelSoft = soft(X=genotypes$X, knowns=genotypes$knowns, P=genotypes$B)

 preds = predict(modelSoft, X = genotypes$X)
 str(preds)

Example output

Loading required package: mvtnorm
Loading required package: car
Loading required package: carData
Loading required package: lattice
Loading required package: combinat

Attaching package: 'combinat'

The following object is masked from 'package:utils':

    combn

List of 4
 $ tij.X       : num [1:318, 1:3] 1 1 1 1 1 1 1 1 1 1 ...
  ..- attr(*, "dimnames")=List of 2
  .. ..$ : chr [1:318] "1" "2" "3" "4" ...
  .. ..$ : NULL
 $ tij.knowns  : NULL
 $ class.X     : Named int [1:318] 1 1 1 1 1 1 1 1 1 1 ...
  ..- attr(*, "names")= chr [1:318] "1" "2" "3" "4" ...
 $ class.knowns: NULL

bgmm documentation built on Oct. 10, 2021, 5:07 p.m.