fitted: Access model components.

Description Usage Arguments Value Author(s) Examples

Description

The accessors mixture and mixturewt return information about the esimtated Dirichlet comonents of the fitted model. mixture returns a sample x component matrix of estimated values, mixturewt reta matrix of

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
mixture(object, ..., assign=FALSE)
mixturewt(object, ...)
goodnessOfFit(object, ...)
laplace(object, ...)
## S4 method for signature 'DMN'
AIC(object, ..., k = 2)
## S4 method for signature 'DMN'
BIC(object, ...)

## S4 method for signature 'DMN'
fitted(object, ..., scale=FALSE)
## S4 method for signature 'DMN'
predict(object, newdata, ..., logevidence=FALSE)
## S4 method for signature 'DMNGroup'
fitted(object, ...)
## S4 method for signature 'DMNGroup'
predict(object, newdata, ..., assign=FALSE)
## S4 method for signature 'DMNGroup'
summary(object, ...)

Arguments

object

An instance of class dmn.

newdata

A matrix of new sample x taxon data to be fitted to the model of object.

...

Additional arguments, available to methods, when applicable.

assign

logical(1) indicating whether the maximum per-sample mixture component should be returned (assign=FALSE), or the full mixture matrix (assign=TRUE).

scale

logical(1) indicating whether fitted values should be returned unscaled (default, scaled=FALSE) or scaled by the variability of mixturewt parameter theta.

logevidence

logical(1) indicating whether posterior probability (default, logevidence=FALSE) or log evidence logical=TRUE should be returned.

k

ignored.

Value

mixture with assign=FALSE returns a matrix of sample x Dirichlet component estimates. With assign=TRUE mixture returns a named vector indexing the maximal Dirichlet component of each sample.

mixturewt returns a matrix with rows corresponding to mixture components, and columns pi (component weight) and theta (component variability). Small values of theta correspond to highly variable components.

goodnessOfFit returns a named numeric vector of measures of goodness of fit.

laplace, AIC, and BIC return the corresponding measures of goodness of fit.

Author(s)

Martin Morgan mailto:mtmorgan@fhcrc.org

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
data(fit)
best <- fit[[4]]
mixturewt(best)
head(mixture(best), 3)
head(mixture(best, assign=TRUE), 3)
goodnessOfFit(best)

fl <- system.file(package="DirichletMultinomial", "extdata",
                  "Twins.csv")
count <- t(as.matrix(read.csv(fl, row.names=1)))
data(bestgrp)
bestgrp
head(predict(bestgrp, count))

Example output

Loading required package: S4Vectors
Loading required package: stats4
Loading required package: BiocGenerics
Loading required package: parallel

Attaching package:BiocGenericsThe following objects are masked frompackage:parallel:

    clusterApply, clusterApplyLB, clusterCall, clusterEvalQ,
    clusterExport, clusterMap, parApply, parCapply, parLapply,
    parLapplyLB, parRapply, parSapply, parSapplyLB

The following objects are masked frompackage:stats:

    IQR, mad, sd, var, xtabs

The following objects are masked frompackage:base:

    anyDuplicated, append, as.data.frame, basename, cbind, colnames,
    dirname, do.call, duplicated, eval, evalq, Filter, Find, get, grep,
    grepl, intersect, is.unsorted, lapply, Map, mapply, match, mget,
    order, paste, pmax, pmax.int, pmin, pmin.int, Position, rank,
    rbind, Reduce, rownames, sapply, setdiff, sort, table, tapply,
    union, unique, unsplit, which.max, which.min


Attaching package:S4VectorsThe following object is masked frompackage:base:

    expand.grid

Loading required package: IRanges
         pi    theta
1 0.3108456 52.03706
2 0.1665874 18.72599
3 0.3027727 53.29525
4 0.2197943 30.19582
                [,1]         [,2]         [,3]         [,4]
TS1.2   9.999914e-01 2.117284e-11 8.563935e-06 3.306464e-08
TS10.2  3.776510e-08 3.268129e-04 9.996731e-01 2.847131e-10
TS100.2 7.214444e-09 8.825346e-01 7.953749e-13 1.174654e-01
  TS1.2  TS10.2 TS100.2 
      1       3       2 
       NLE     LogDet    Laplace        BIC        AIC 
38953.6920   616.0335 38781.1039 40425.3149 39476.6920 
class: DMNGroup 
summary:
      k samples taxa       NLE   LogDet   Laplace       BIC       AIC
Lean  1      61  130  9065.657 162.3513  9027.371  9332.864  9195.657
Obese 3     193  130 26769.931 407.4130 26613.414 27801.418 27161.931
                Lean      Obese
TS1.2   9.648780e-01 0.03512197
TS10.2  1.000058e-03 0.99899994
TS100.2 3.522984e-08 0.99999996
TS100   3.290371e-05 0.99996710
TS101.2 7.349397e-08 0.99999993
TS103.2 1.679035e-02 0.98320965

DirichletMultinomial documentation built on Nov. 8, 2020, 7 p.m.