Learn R Programming

EpiModel (version 0.95)

plot.epiNet.est: Plot Diagnostics from an epiNet.est Object

Description

This function plots values from diagnostic simulations in epiNet.est.

Usage

## S3 method for class 'epiNet.est':
plot(x, type = "formation", dx.start, dx.end,
  dx.leg = TRUE, plots.joined, ...)

Arguments

x
an EpiModel object of class epiNet.est.
type
plot type, with options of type="formation" for partnership formation statistics or other network statistics specified in epiNet.est, or type="duration" to plot the mean ages of partnerships over time.
dx.start
start time for diagnostic plots. This must be a positive integer.
dx.end
end time for diagnostic plots. This must be less than or equal to the number of time steps simulated in the epiNet.est diagnostics.
dx.leg
if TRUE, show legend (only if plots.joined=TRUE)
plots.joined
if TRUE, combine all target statistics in one plot, versus one plot per target statistic if FALSE
...
additional arguments to pass to main plot window

Details

The plot function for epiNet.est objects will generate plots of two types of model diagnostic statistics that were run as part of the diagnostic tools within that estimation function. The formation plot shows the summary statistics requested in stats.form, which defaults to those in the formation formula. The duration plot shows the average age of all partnerships at each time step, up until the maximum time step requested. This is calculated with the edgelist.meanage function.

The plots.joined argument will control whether the target statistics in the formation plot are joined in one plot or plotted separately. The default is based on the number of network statistics requested. The layout of the separate plots within the larger plot window is also based on the number of statistics.

Required for these plots is that the estimation diagnostics are run in epiNet.est. This happens by default, and is set with the stats=TRUE argument in that function. Since these diagnostics only generate one network simulation, the plots here will only show one line per network statistic. If the range of possible statistics is of interest, then the fitted STERGM should be simulated multiple times, which is possible with epiNet.simNet, which has its own plotting function, plot.epiNet.simNet.

See Also

epiNet.est

Examples

Run this code
# Initialize bipartite network
nw <- network.initialize(500, bipartite=250, directed=FALSE)

# Fit model with limited degree terms, but monitor wider range
est <- epiNet.est(nw,
                  formation = ~ edges + b1degree(0:1) + b2degree(0:1),
                  dissolution = ~ offset(edges),
                  target.stats = c(165, 100, 137.5, 120, 102.5),
                  coef.diss = dissolution.coefs(~ offset(edges), duration=25),
                  stats.form = ~ edges + b1degree(0:5) + b2degree(0:5))

# Formation plot with plots split given the 11 statistics
plot(est)

# Formation plot with plots joined, for time steps 400 to 500
plot(est, plots.joined=TRUE, dx.start=400, dx.end=500)

# Partnership duration plot
plot(est, type="duration")

# Truncate plot to start after time 200, given the age ramp up period
plot(est, type="duration", dx.start=200)

Run the code above in your browser using DataLab