Visualize results from clustering using a Poisson mixture model

Share:

Description

Plot a PoisMixClus object.

Usage

1
2
3
4
5
6
## S3 method for class 'PoisMixClus'
plot(x, y_profiles = NULL, K = NULL,
  threshold = 0.8, conds = NULL, average_over_conds = FALSE,
  graphs = c("logLike", "ICL", "profiles", "boxplots", "probapost_boxplots",
  "probapost_barplots", "probapost_histogram", "lambda_barplots"),
  order = FALSE, profiles_order = NULL, ...)

Arguments

x

An object of class "PoisMixClus"

y_profiles

y (n x q) matrix of observed profiles for n observations and q variables to be used for graphing results (optional for logLike, ICL, probapost_boxplots, and probapost_barplots)

K

If desired, the specific model to use for plotting. If NULL, the model chosen using the criterion defined by the user will be plotted

threshold

Threshold used for maximum conditional probability; only observations with maximum conditional probability greater than this threshold are visualized

conds

Condition labels

average_over_conds

If TRUE, average values of y_profiles within each condition identified by conds for the profiles and boxplots plots

graphs

Graphs to be produced, one (or more) of the following: "logLike" (log-likelihood plotted versus number of clusters), "ICL" (ICL plotted versus number of clusters), "profiles" (line plots of profiles in each cluster), "boxplots" (boxplots of profiles in each cluster), "probapost_boxplots" (boxplots of maximum conditional probabilities per cluster), "probapost_barplots" (number of observations with a maximum conditional probability greater than threshold per cluster), "probapost_histogram" (histogram of maximum conditional probabilities over all clusters), "lambda_barplots" (barplots of estimated proportions of counts per condition in each cluster for the Poisson mixture model)

order

If TRUE, order clusters in probapost_boxplot by median and probapost_barplot by number of observations with maximum conditional probability greater than threshold

profiles_order

If NULL or FALSE, line plots and boxplots of profiles are plotted sequentially by cluster number (K=1, K=2, ...). If TRUE, line plots and boxplots of profiles are plotted in an automatically calculated order (according to the Euclidean distance between cluster means) to plot clusters with similar mean profiles next to one another. Otherwise, the user may provide a vector (of length equal to the number of clusters in the given model) providing the desired order of plots.

...

Additional optional plotting arguments

Author(s)

Andrea Rau

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
## Simulate toy data, n = 300 observations
set.seed(12345)
countmat <- matrix(round(runif(300*4, min=0, max=500)), nrow=300, ncol=4)
countmat <- countmat[which(rowSums(countmat) > 0),]
conds <- rep(c("A","B","C","D"), each=2)

## Run the Poisson mixture model for K = 2,3
run <- coseq(y=countmat, K=2:3, iter=5, model="Poisson")
plot(run)
summary(run)