plotTransProbs: Produces Balloon Plots and LaTeX-Style Tables of the...

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

View source: R/plotTransProbs.R

Description

Produces balloon plots and LaTeX-style tables of the transition matrices and cluster-specific contingency tables (transition frequency matrices).

Usage

1
2
3
4
5
plotTransProbs(outList, estTransProb, estGroupSize, class, 
               grLabels = paste("Group", 1:outList$Prior$H), 
               plotPooled = TRUE, 
               plotContTable = TRUE, printContTable = TRUE, 
               plotContPooled = TRUE)

Arguments

outList

specifies a list containing the outcome (return value) of an MCMC run of mcClust, dmClust, mcClustExtended or dmClustExtended.

estTransProb

A 3-dim array containing the posterior expectation of the average transition matrices of all clusters/groups as returned by calcTransProbs.

estGroupSize

A vector of dimension H containing the (estimated) group sizes returned by calcAllocations.

class

A vector of length N containing the group membership returned by calcAllocations.

grLabels

A character vector giving user-specified names for the clusters/groups.

plotPooled

If TRUE (default) a balloon plot of the pooled transition matrix (ML estimate for all individuals) is produced. See Value: relNjk.

plotContTable

If TRUE (default) balloon plots of the cluster-specific contingency tables (transition frequency matrices) are produced. See Details and Value: relTransFreq.

printContTable

If TRUE (default) a LaTeX-style table containing the absolute and relative row sums of the cluster-specific contingency tables (transition frequency matrices) is generated/printed (iff plotContTable is TRUE). See Value: contTable.

plotContPooled

If TRUE (default) a balloon plot of the pooled contingency table (transition frequency matrix) is produced (iff plotContTable is TRUE). See Value: relNjkMat.

Details

This function visualizes the posterior expectation of the group-specific transition matrices (estTransProb) using “balloon plots” (function balloonplot from package gplots). The circular areas are proportional to the size of the corresponding entry in the transition matrix. The corresponding group sizes (estGroupSize) are indicated in parentheses.

Furthermore, the “balloons” are appropriately scaled (automatically) to be comparable within and between groups.

The (cluster-specific) contingency tables report for each cluster in cell (j,k) the probability of observing the categories (j,k) in consecutive time points/periods for an individual in this cluster. The entries to this table/figure sum to one (see Value: relTransFreq).

Value

A list containing:

relNjk

A matrix containing the ML estimate of the transition matrix for all individuals (pooled). That is the matrix containing the total sum of all observed transitions where each row is scaled to 1.

contTable

A matrix containing the row sums of the group-specific contingency tables (absolute transition frequencies).

relTransFreq

A 3-dim array containing the cluster-specific contingency tables.

relNjkMat

A matrix containing the sum of all observed transitions where the whole matrix is scaled to 1.

Note

Note, that in contrast to the literature (see References), the numbering (labelling) of the states of the categorical outcome variable (time series) in this package is sometimes 0,...,K (instead of 1,...,K), however, there are K+1 categories (states)!

Author(s)

Christoph Pamminger <christoph.pamminger@gmail.com>

References

Sylvia Fruehwirth-Schnatter, Christoph Pamminger, Andrea Weber and Rudolf Winter-Ebmer, (2011), "Labor market entry and earnings dynamics: Bayesian inference using mixtures-of-experts Markov chain clustering". Journal of Applied Econometrics. DOI: 10.1002/jae.1249 http://onlinelibrary.wiley.com/doi/10.1002/jae.1249/abstract

Christoph Pamminger and Sylvia Fruehwirth-Schnatter, (2010), "Model-based Clustering of Categorical Time Series". Bayesian Analysis, Vol. 5, No. 2, pp. 345-368. DOI: 10.1214/10-BA606 http://ba.stat.cmu.edu/journal/2010/vol05/issue02/pamminger.pdf

See Also

calcTransProbs, calcAllocations, balloonplot, mcClust, dmClust, mcClustExtended, dmClustExtended

Examples

1
2
# please run the examples in mcClust, dmClust, mcClustExtended, 
# dmClustExtended

Example output

Loading required package: gplots

Attaching package: 'gplots'

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

    lowess

Loading required package: xtable
Loading required package: mnormt
Loading required package: MASS
Loading required package: bayesm
Loading required package: boa
Loading required package: e1071
Loading required package: gtools

Attaching package: 'gtools'

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

    permutations

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

    rdirichlet

bayesMCClust documentation built on May 29, 2017, 3:31 p.m.