
Plot results of a mixture model
plot.mixglm.RdThis function plots results of a mixture model on the current graphical device.
Arguments
- x
an object of class "mixglm"
- form
formula, such as y ~ pred, specifying variables to be plotted. By default the first predictor is plotted on x axis.
- byChains
logical value indicating whether to plot mixture components for each chain
- transCol
logical value indicating usage of transparent colours
- addWAIC
logical value indication display of WAIC in upper right corner of the plot
- setCol
vector of colours to be used for mixture components
- drawAxes
logical value indicating whether values should be marked on axes
- SDmult
scalar multiplying visualized standard deviation (to make lines for small standard deviation visible)
- xlab
a label for the x axis, defaults to predictor name.
- ylab
a label for the y axis, defaults to response name.
- doPlot
logical value indicating if plotting should be done
- xSamples
integer value specifying the number of values regularly distributed along x-axis at which estimates are calculated
- ...
additional arguments passed to plot
Value
Returns invisibly a list of lists for each chain. These lists contain a dataframe for each mixture component:
xValues along x-axis for which estimates are calculated
probProbability of the component in the mixture along x-axis
yEstMean of the component in the mixture along x-axis
yLowMean minus
SDmulttimes standard deviation of the component in the mixture along x-axisyUppMean plus
SDmulttimes standard deviation of the component in the mixture along x-axis
Examples
if (FALSE) { # \dontrun{
set.seed(10)
n <- 200
x <- rnorm(n)
group <- rbinom(n, 1, 0.5)
y <- rnorm(n, 1 + 0.5 * x * c(-1, 1)[group + 1], 0.1)
plot(y ~ x)
dat <- data.frame(x, y)
mod <- mixglm(
stateValModels = y ~ x,
stateProbModels = ~ x,
statePrecModels = ~ x,
inputData = dat,
numStates = 2)
plot(mod)} # }