-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplot.coseq.Rd
94 lines (77 loc) · 4.09 KB
/
plot.coseq.Rd
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/plot.coseq.R
\name{plot.coseq}
\alias{plot.coseq}
\title{Visualize results from coseq clustering}
\usage{
\method{plot}{coseq}(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, n_row = NULL, n_col = NULL, ...)
}
\arguments{
\item{x}{An object of class \code{"coseq"}}
\item{y_profiles}{y (\emph{n} x \emph{q}) matrix of observed profiles for \emph{n}
observations and \emph{q} variables to be used for graphing results (optional for
\code{logLike}, \code{ICL}, \code{probapost_boxplots}, and \code{probapost_barplots},
and by default takes value \code{x$tcounts} if \code{NULL})}
\item{K}{If desired, the specific model to use for plotting. If \code{NULL},
the model chosen by ICL will be plotted}
\item{threshold}{Threshold used for maximum conditional probability; only observations
with maximum conditional probability greater than this threshold are visualized}
\item{conds}{Condition labels, if desired}
\item{average_over_conds}{If \code{TRUE}, average values of \code{y_profiles} within
each condition identified by \code{conds} for the \code{profiles} and \code{boxplots}
plots}
\item{graphs}{Graphs to be produced, one (or more) of the following:
\code{"logLike"} (log-likelihood plotted versus number of clusters),
\code{"ICL"} (ICL plotted versus number of clusters),
\code{"profiles"} (line plots of profiles in each cluster), \code{"boxplots"}
(boxplots of profiles in each cluster), \code{"probapost_boxplots"} (boxplots of
maximum conditional probabilities per cluster), \code{"probapost_barplots"}
(number of observations with a maximum conditional probability greater than
\code{threshold} per cluster), \code{"probapost_histogram"} (histogram of maximum
conditional probabilities over all clusters), \code{"lambda_barplots"} (barplots of
estimated proportions of counts per condition in each cluster for the Poisson mixture
model)}
\item{order}{If \code{TRUE}, order clusters in \code{probapost_boxplot} by median and
\code{probapost_barplot} by number of observations with maximum conditional probability
greater than \code{threshold}}
\item{profiles_order}{If \code{NULL} or \code{FALSE}, line plots and boxplots of profiles are
plotted sequentially by cluster number (K=1, K=2, ...). If \code{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.}
\item{n_row}{Number of rows for plotting layout of line plots and boxplots of profiles.
Note that if \code{n_row} x \code{n_col} is less than the total number of clusters plotted,
plots will be divided over multiple pages.}
\item{n_col}{Number of columns for plotting layout of line plots and boxplots of profiles.
Note that if \code{n_row} x \code{n_col} is less than the total number of clusters plotted,
plots will be divided over multiple pages.}
\item{...}{Additional optional plotting arguments}
}
\description{
Plot a coseq object.
}
\examples{
## Simulate toy data, n = 300 observations
set.seed(12345)
countmat <- matrix(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 Normal mixture model for K = 2,3,4
run_arcsin <- coseq(y=countmat, K=2:4, iter=5, transformation="arcsin")
## Plot and summarize results
plot(run_arcsin)
summary(run_arcsin)
## Compare ARI values for all models (no plot generated here)
ARI <- compareARI(run_arcsin, plot=FALSE)
## Compare ICL values for models with arcsin and logit transformations
run_logit <- coseq(y=countmat, K=2:4, iter=5, transformation="logit")
compareICL(list(run_arcsin, run_logit))
}
\author{
Andrea Rau, Cathy Maugis-Rabusseau
}