Learn R Programming

sars (version 2.0.0)

plot.multi: Plot Model Fits for a 'multi' Object

Description

S3 method for class 'multi'. plot.multi creates plots for objects of class multi, using the R base plotting framework. Plots of all model fits, the multimodel SAR curve (with confidence intervals) and a barplot of the information criterion weights of the different models can be constructed.

Usage

# S3 method for multi
plot(
  x,
  type = "multi",
  allCurves = TRUE,
  xlab = NULL,
  ylab = NULL,
  pch = 16,
  cex = 1.2,
  pcol = "dodgerblue2",
  ModTitle = NULL,
  TiAdj = 0,
  TiLine = 0.5,
  cex.main = 1.5,
  cex.lab = 1.3,
  cex.axis = 1,
  yRange = NULL,
  lwd = 2,
  lcol = "dodgerblue2",
  mmSep = FALSE,
  lwd.Sep = 6,
  col.Sep = "black",
  pLeg = TRUE,
  modNames = NULL,
  cex.names = 0.88,
  subset_weights = NULL,
  confInt = FALSE,
  ...
)

Arguments

x

An object of class 'multi'.

type

The type of plot to be constructed: either type = multi for a plot of the multimodel SAR curve, or type = bar for a barplot of the information criterion weights of each model.

allCurves

A logical argument for use with type = multi that specifies whether all the model fits should be plotted with the multimodel SAR curve (allCurves = TRUE; the default) or that only the multimodel SAR curve should be plotted (allCurves = FALSE).

xlab

Title for the x-axis. Only for use with type = multi.

ylab

Title for the y-axis.

pch

Plotting character (for points). Only for use with type = multi.

cex

A numerical vector giving the amount by which plotting symbols (points) should be scaled relative to the default.

pcol

Colour of the points. Only for use with type = multi.

ModTitle

Plot title (default is ModTitle = NULL, which reverts to "Multimodel SAR" for type = multi and to "Model weights" for type = bar). For no title, use ModTitle = "".

TiAdj

Which way the plot title is justified.

TiLine

Places the plot title this many lines outwards from the plot edge.

cex.main

The amount by which the plot title should be scaled relative to the default.

cex.lab

The amount by which the axis titles should be scaled relative to the default.

cex.axis

The amount by which the axis labels should be scaled relative to the default.

yRange

The range of the y-axis. Only for use with type = multi.

lwd

Line width. Only for use with type = multi.

lcol

Line colour. Only for use with type = multi.

mmSep

Logical argument of whether the multimodel curve should be plotted as a separate line (default = FALSE) on top of the others, giving the user more control over line width and colour. Only for use with type = multi and allCurves = TRUE.

lwd.Sep

If mmSep = TRUE, the line width of the multimodel curve.

col.Sep

If mmSep = TRUE, the colour of the multimodel curve.

pLeg

Logical argument specifying whether or not the legend should be plotted (when type = multi and allCurves = TRUE).

modNames

A vector of model names for the barplot of weights (when type = bar). The default (modNames = NULL) uses abbreviated versions (see below) of the names from the sar_average function.

cex.names

The amount by which the axis labels (model names) should be scaled relative to the default. Only for use with type = bar.

subset_weights

Only create a barplot of the model weights for models with a weight value above a given threshold (subset_weights). Only for use with type = bar.

confInt

A logical argument specifying whether confidence intervals should be plotted around the multimodel curve. Can only be used if confidence intervals have been generated in the sar_average function.

...

Further graphical parameters (see par, plot.default,title, lines) may be supplied as arguments.

Examples

Run this code
data(galap)
#plot a multimodel SAR curve with all model fits included
fit <- sar_average(data = galap, grid_start = "none")
plot(fit)

#remove the legend
plot(fit, pLeg = FALSE)

#plot just the multimodel curve
plot(fit, allCurves = FALSE, ModTitle = "", lcol = "black")

#plot all model fits and the multimodel curve on top as a thicker line
plot(fit, allCurves = TRUE, mmSep = TRUE, lwd.Sep = 6, col.Sep = "orange")

#Plot a barplot of the model weights
plot(fit, type = "bar")
#subset to plot only models with weight > 0.05
plot(fit, type = "bar", subset_weights = 0.05)

Run the code above in your browser using DataLab