plot.ergmm: Plotting Method for class ERGMM

View source: R/plot.ergmm.R

plot.ergmmR Documentation

Plotting Method for class ERGMM

Description

plot.ergmm is the plotting method for ergmm objects. For latent models, this plots the minimum Kullback-Leibler positions by default. The maximum likelihood, posterior mean, posterior mode, or a particular iteration's or configuration's positions can be used instead, or pie charts of the posterior probabilities of cluster membership can be shown. See ergmm for more information on how to fit these models.

Usage

## S3 method for class 'ergmm'
plot(
  x,
  ...,
  vertex.cex = 1,
  vertex.sides = 16 * ceiling(sqrt(vertex.cex)),
  what = "mkl",
  main = NULL,
  xlab = NULL,
  ylab = NULL,
  zlab = NULL,
  xlim = NULL,
  ylim = NULL,
  zlim = NULL,
  object.scale = formals(plot.network.default)[["object.scale"]],
  pad = formals(plot.network.default)[["pad"]],
  cluster.col = c("red", "green", "blue", "cyan", "magenta", "orange", "yellow",
    "purple"),
  vertex.col = NULL,
  print.formula = TRUE,
  edge.col = 8,
  Z.ref = NULL,
  Z.K.ref = NULL,
  zoom.on = NULL,
  pie = FALSE,
  labels = FALSE,
  rand.eff = NULL,
  rand.eff.cap = NULL,
  plot.means = TRUE,
  plot.vars = TRUE,
  suppress.axes = FALSE,
  jitter1D = 1,
  curve1D = TRUE,
  use.rgl = FALSE,
  vertex.3d.cex = 1/20,
  edge.plot3d = TRUE,
  suppress.center = FALSE,
  density.par = list()
)

Arguments

x

an R object of class ergmm. See documentation for ergmm.

...

Other optional arguments passed to the plot.network function.

what

Character vector, integer, or a list that specifies the point estimates to be used. Can be one of the follwoing:

"mkl"

This is the defult. Plots the Minimum Kulblack-Leibler divergence values.

"start","burnin.start"

Plots the starting configuration.

"sampling.start"

Plots the starting configuration of the sampling phase (the last burnin configuration).

"mle"

Plots the maximum likelihood estimates. Random effects are treated as fixed.

"pmean"

Plots the posterior means.

"pmode"

Plots the conditional posterior mode.

"cloud"

Plots the “cloud” of latent space position draws, with their cluster colors.

"density"

Plots density and contours of the posterior latent positions, and, in cluster models, each cluster.

list

Plots the configuration contained in the list.

integer

Plots the configuration of whatth MCMC draw stored in x.

main, vertex.cex, vertex.col, xlim, ylim, vertex.sides,

Arguments passed to plot.network, whose defaults differ from those of plot.network.

zlim, zlab

Limits and labels for the third latent space dimension or principal component, if use.rgl=TRUE.

object.scale, pad, edge.col, xlab, ylab

Arguments passed to plot.network, whose defaults differ from those of plot.network.

cluster.col

A vector of colors used to distinguish clusters in a latent cluster model.

print.formula

Whether the formula based on which the x was fitted should be printed under the main title. Defaults to TRUE.

Z.ref

If given, rotates the the latent positions to the nearest configuration to this one before plotting.

Z.K.ref

If given, relabels the clusters to the nearest configuration to this one before plotting.

zoom.on

If given a list of vertex indices, sets the plotting region to the smallest that can fit those vertices.

pie

For latent clustering models, each node is drawn as a pie chart representing the probabilities of cluster membership.

labels

Whether vertex labels should be displayed. Defaults to FALSE.

rand.eff

A character vector selecting "sender", "receiver", "sociality", or "total" random effects. Each vertex is scaled such that its area is proportional to the odds ratio due to its selected random effect.

rand.eff.cap

If not NULL and rand.eff is given, limits the scaling of the plotting symbol due to random effect to the given value.

plot.means

Whether cluster means are plotted for latent cluster models. The "+" character is used. Defaults to TRUE.

plot.vars

Whether circles with radius equal to the square root of posterior latent or intracluster variance estimates are plotted. Defaults to TRUE.

suppress.axes

Whether axes should not be drawn. Defaults to FALSE. (Axes are drawn.)

jitter1D

For 1D latent space fits, it often helps to jitter the positions for visualization. This option controls the amount of jitter.

curve1D

Controls whether the edges in 1D latent space fits are plotted as curves. Defaults to TRUE.

use.rgl

Whether the package rgl should be used to plot fits for latent space dimension 3 or higher in 3D. Defaults to FALSE. If set to TRUE, argument pie has no effect.

vertex.3d.cex

Controls the size of the plotting symbol when use.rgl=TRUE.

edge.plot3d

If TRUE (the default) edges or arcs in a 3D plot will be drawn. Otherwise, only vertices and clusters.

suppress.center

Suppresses the plotting of "+" at the origin. Defaults to FALSE.

density.par

A list of optional parameters for density plots:

totaldens

Whether the overal density of latent space positions should be plotted. Defaults to TRUE.

subdens

Whether the densities of latent space positions broken down by cluster should be plotted. Defaults to TRUE.

mfrow

When plotting multiple clusters' densities, passed to par

Details

At this time, no plotting non-latent-space model fits is not supported.

Plots the results of an ergmm fit.

More information can be found by looking at the documentation of ergmm.

For bipartite networks, the events are marked with a bullet (small black circle) inside the plotting symbol.

Value

If applicable, invisibly returns the vertex positions plotted.

See Also

ergmm,ergmm.object, network, plot.network, plot

Examples



#
# Using Sampson's Monk data, let's fit a 
# simple latent position model
#
data(sampson)
#
# Using Sampson's Monk data, let's fit a
# latent clustering random effects model
# Store the burn-in.
samp.fit <- ergmm(samplike ~ euclidean(d=2, G=3)+rreceiver,
                  control=ergmm.control(store.burnin=TRUE))
#
# See if we have convergence in the MCMC
mcmc.diagnostics(samp.fit)
# We can also plot the burn-in:
for(i in samp.fit$control$pilot.runs) mcmc.diagnostics(samp.fit,burnin=i)
#
# Plot the resulting fit.
#
plot(samp.fit,labels=TRUE,rand.eff="receiver")
plot(samp.fit,pie=TRUE,rand.eff="receiver")
plot(samp.fit,what="pmean",rand.eff="receiver")
plot(samp.fit,what="cloud",rand.eff="receiver")
plot(samp.fit,what="density",rand.eff="receiver")
plot(samp.fit,what=5,rand.eff="receiver")

## Not run: 
# Fit a 3D latent space model to Sampson's Monks
samp.fit3 <- ergmm(samplike ~ euclidean(d=3))

# Plot the first two principal components of the
# latent space positions
plot(samp.fit,use.rgl=FALSE)
# Plot the resulting fit in 3D
plot(samp.fit,use.rgl=TRUE)

## End(Not run)


latentnet documentation built on May 11, 2022, 5:16 p.m.