View source: R/regressionTools.R
residualPlot | R Documentation |
generates a ggplot object of the residual plot of a calibration table
residualPlot(
fitTable,
predictorColumn = 1,
responseColumn = 2,
weights = NULL,
fit = fitLM(fitTable, predictorColumn = predictorColumn, responseColumn =
responseColumn, weights = weights),
title = "",
figureNo = 2,
caption = paste(c("Figure ", figureNo, ": Residual Plot"), collapse = ""),
standardized = TRUE,
showLimits = TRUE,
limits = stdResidualLimits(),
fitColor = "red",
fitLineType = 1,
fitWidth = 1,
fitAlpha = 1,
pointsColor = "Black",
pointsFill = "black",
pointsShape = 21,
pointsSize = 2,
pointsAlpha = 1,
autoScaleX = TRUE,
xLimits = c(0, "N/A"),
xLabel = NULL,
xOob = 2,
autoScaleY = TRUE,
yLimits = c(0, "N/A"),
yLabel = NULL,
yOob = 2,
usePredictor = TRUE,
useYLabel = TRUE,
rotateGraph = FALSE,
xOptions = "1",
yOptions = "1"
)
fitTable |
data.frame containing the data to be fitted |
predictorColumn |
can be integer (column number) or character (column name) |
responseColumn |
can be integer (column number) or character (column name) |
weights |
default = NULL, otherwise must be integer to give weights to the predictor values (see also function weightsVector) or a numeric vector with length = number of rows in calibrationTable. Note: if a vector of weights if provided, the prediction to the minimal/maximal values on the x- & y-axis is not possible |
fit |
model object (eg coming from lm() or fitLM()) |
title |
title for the graph, character vector |
figureNo |
number of the figure, used for the caption ("Figure ..." ) |
caption |
caption for the graph, character vector |
standardized |
if TRUE: use standardized residuals |
showLimits |
if TRUE, draw the lines for the limits defined in limits |
limits |
definition of the limits to draw, see stdLiits, zeroLimits for examples |
fitColor |
defines color of loess-type 'fit' to the residual coordinates |
fitLineType |
defines line type of the 'fit' to the residual coordinates |
fitWidth |
defines line width of the 'fit' to the residual coordinates |
fitAlpha |
defines alpha of the 'fit' to the residual coordinates |
pointsColor |
(border) color of the datapoints |
pointsFill |
fill color, note: only some shapes have a fill color |
pointsShape |
shape of the datapoints (default = 21), see vignette ggplot2::ggplot2-specs |
pointsSize |
size of the datapoints |
pointsAlpha |
alpha ('seethrough' value) of the datapoints |
autoScaleX |
if TRUE then default autoscaling of the x-axis takes place, most other settings delaing with scaling of the x-axis the are then ignored |
xLimits |
2 element numeric vector with the minimum and maximum value for the x-axis. If an element is a character vector or something that cannot be converted to a numeric value, then NA is used which leads to minimum/maximum value |
xLabel |
name of the x-axis, character vector |
xOob |
integer vector, indicating how to deal with out of bounds datapoints. 1 = censor scales::oob_censor is used, 2 = infinite, scales::oob_squish_infinite is used. Note: x-axis only |
autoScaleY |
if TRUE then default autoscaling of the y-axis takes place, most other settings delaing with scaling of the y-axis the are then ignored |
yLimits |
2 element numeric vector with the minimum and maximum value for the y-axis. If an element is a character vector or something that cannot be converted to a numeric value, then NA is used which leads to minimum/maximum value |
yLabel |
name of the y-axis, character vector |
yOob |
integer vector, indicating how to deal with out of bounds datapoints. 1 = censor scales::oob_censor is used, 2 = infinite, scales::oob_squish_infinite is used. Note: y-axis only |
usePredictor |
if TRUE then the predictor is used as x-axis |
useYLabel |
if TRUE then the y-label is used |
rotateGraph |
if TRUE, then x-axis and y-axis are swapped, essentially resulting in a graph rotated 90 degrees |
xOptions |
x-axis options character vector, "1" normal scale, "2" reversed scale, "3" logarithmic scale (log10) |
yOptions |
y-axis options character vector, "1" normal scale, "2" reversed scale,"3" logarithmic scale (log10) |
ggplot object
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.