Skip to contents

create_residualplot creates a residual plot between fitted and observed data

Usage

create_residualplot(
  histogram_obj,
  model_name,
  add_changepoint_lines,
  abline.h,
  abline.v,
  abline.col,
  abline.lwd,
  abline.lty,
  filename,
  main,
  main.just,
  main.x,
  main.y,
  main.cex,
  xlab.label,
  ylab.label,
  xlab.cex,
  ylab.cex,
  xlab.col,
  ylab.col,
  xlab.top.label,
  xlab.top.cex,
  xlab.top.col,
  xlab.top.just,
  xlab.top.x,
  xlab.top.y,
  xlimits = c(histogram_obj$interval_start[1],
    histogram_obj$interval_end[length(histogram_obj)]),
  ylimits,
  xat,
  yat,
  xaxis.lab,
  yaxis.lab,
  xaxis.cex,
  yaxis.cex,
  xaxis.rot,
  yaxis.rot,
  xaxis.fontface,
  yaxis.fontface,
  xaxis.col,
  yaxis.col,
  xaxis.tck,
  yaxis.tck,
  type,
  cex,
  pch,
  col,
  col.border,
  lty,
  lwd,
  alpha,
  axes.lwd,
  key,
  legend,
  top.padding,
  bottom.padding,
  right.padding,
  left.padding,
  key.top,
  key.left.padding,
  ylab.axis.padding,
  axis.key.padding,
  x.spacing,
  y.spacing,
  add.rectangle,
  xleft.rectangle,
  ybottom.rectangle,
  xright.rectangle,
  ytop.rectangle,
  col.rectangle,
  alpha.rectangle,
  add.points,
  points.x,
  points.y,
  points.pch,
  points.col,
  points.col.border,
  points.cex,
  add.line.segments,
  line.start,
  line.end,
  line.col,
  line.lwd,
  add.text,
  text.labels,
  text.x,
  text.y,
  text.col,
  text.cex,
  text.fontface,
  height,
  width,
  size.units,
  resolution,
  enable.warnings,
  ...
)

Arguments

histogram_obj

a Histogram or HistogramFit object

model_name

one of the metrics used to fit models (e.g. Jaccard) and "consensus", default consensus

add_changepoint_lines

logical, whether vertical lines should be drawn where residuals change from positive to negative and vice versa, default FALSE

abline.h

allow horizontal line to be drawn, default to 0

abline.v

allow vertical line to be drawn, default to NULL

abline.col

line colour, defaults to lightgrey

abline.lwd

line width, defaults to 0.01

abline.lty

line style, defaults to dotted

filename

Filename for tiff output, or if NULL returns the trellis object itself

main

The main title for the plot (space is reclaimed if NULL)

main.just

The justification of the main title for the plot, default is centered

main.x

The x location of the main title, deault is 0.5

main.y

The y location of the main title, default is 0.5

main.cex

Size of text for main plot title

xlab.label

x-axis label

ylab.label

y-axis label

xlab.cex

Size of x-axis label, defaults to 3

ylab.cex

Size of y-axis label, defaults to 3

xlab.col

Colour of the x-axis label, defaults to “black”

ylab.col

Colour of the y-axis label, defaults to “black”

xlab.top.label

The label for the top x-axis

xlab.top.cex

Size of top x-axis label

xlab.top.col

Colour of the top x-axis label

xlab.top.just

Justification of the top x-axis label, defaults to centered

xlab.top.x

The x location of the top x-axis label

xlab.top.y

The y location of the top y-axis label

xlimits

Two-element vector giving the x-axis limits, defaults to automatic

ylimits

Two-element vector giving the y-axis limits, defaults to automatic

xat

Vector listing where the x-axis labels should be drawn, defaults to automatic

yat

Vector listing where the y-axis labels should be drawn, defaults to automatic

xaxis.lab

Vector listing x-axis tick labels, defaults to automatic

yaxis.lab

Vector listing y-axis tick labels, defaults to automatic

xaxis.cex

Size of x-axis scales, defaults to 2

yaxis.cex

Size of y-axis scales, defaults to 2

xaxis.rot

Counterclockwise rotation of text in x-axis scales in degrees, defaults to 0

yaxis.rot

Counterclockwise rotation of text in y-axis scales in degrees, defaults to 0

xaxis.fontface

Fontface for the x-axis scales

yaxis.fontface

Fontface for the y-axis scales

xaxis.col

Colour of the x-axis tick labels, defaults to “black”

yaxis.col

Colour of the y-axis tick labels, defaults to “black”

xaxis.tck

Specifies the length of the tick mark, defaults to 1 for both top and bottom axes

yaxis.tck

Specifies the length of the tick mark, defaults to 1 for both top and bottom axes

type

Plot type

cex

Character expansion for plotting symbol

pch

Plotting character

col

Point/line colour

col.border

Colour of border when points pch >= 21. Defaults to “black”

lty

Specifies line style, defaults to 1 (solid)

lwd

Specifies line width, defaults to 1

alpha

Specifies line transparency, defaults to 1 (opaque)

axes.lwd

Thickness of width of axes lines

key

A list giving the key (legend). The default suppresses drawing

legend

Add a legend to the plot. Helpful for adding multiple keys and adding keys to the margins of the plot. See xyplot.

top.padding

A number specifying the distance to the top margin, defaults to 0.1

bottom.padding

A number specifying the distance to the bottom margin, defaults to 0.7

right.padding

A number specifying the distance to the right margin, defaults to 0.1

left.padding

A number specifying the distance to the left margin, defaults to 0.5

key.top

A number specifying the distance at top of key, defaults to 0.1

key.left.padding

Amount of padding to go onto any legend on the left

ylab.axis.padding

A number specifying the distance of ylabel to the y-axis, defaults to 1

axis.key.padding

A number specifying the distance from the y-axis to the key, defaults to 1

x.spacing

A number specifying the distance between panels along the x-axis, defaults to 0

y.spacing

A number specifying the distance between panels along the y-axis, defaults to 0

add.rectangle

Allow a rectangle to be drawn, default is FALSE

xleft.rectangle

Specifies the left x ooordinate of the rectangle to be drawn

ybottom.rectangle

Specifies the bottom y coordinate of the rectangle to be drawn

xright.rectangle

Specifies the right x coordinate of the rectangle to be drawn

ytop.rectangle

Specifies the top y coordinate of the rectangle to be drawn

col.rectangle

Specifies the colour to fill rectangle's area

alpha.rectangle

Specifies the colour bias of the rectangle to be drawn

add.points

Allow additional points to be drawn, default is FALSE

points.x

The x co-ordinates where additional points should be drawn

points.y

The y co-ordinates where additional points should be drawn

points.pch

The plotting character for additional points

points.col

The colour of additional points

points.col.border

Colour of the border of additional points if points.pch >= 21. Defaults to black

points.cex

The size of additional points

add.line.segments

Allow additional line segments to be drawn, default is FALSE

line.start

The y co-ordinates where additional line segments should start

line.end

The y co-ordinates where additional line segments should end

line.col

The colour of additional line segments, default is black

line.lwd

The line width of additional line segments, default is 1

add.text

Allow additional text to be drawn, default is FALSE

text.labels

Labels for additional text

text.x

The x co-ordinates where additional text should be placed

text.y

The y co-ordinates where additional text should be placed

text.col

The colour of additional text

text.cex

The size of additional text

text.fontface

The fontface for additional text

height

Figure height, defaults to 6 inches

width

Figure width, defaults to 6 inches

size.units

Figure units, defaults to inches

resolution

Figure resolution in dpi, defaults to 1600

enable.warnings

Print warnings if set to TRUE, defaults to FALSE

...

Additional arguments to be passed to xyplot

Value

residual scatterplot, a Trellis object. For further details, see the 'Lattice' R package.

Examples

if (FALSE) {
x = Histogram(c(0, 0, 1, 2, 3, 2, 1, 2, 3, 4, 5, 3, 1, 0))
results = segment_and_fit(x, eps = 0.005)
create_residualplot(results)
}