fitPlot: generates a ggplot object of the fit table

View source: R/regressionTools.R

fitPlotR Documentation

generates a ggplot object of the fit table

Description

generates a ggplot object of the fit table

Usage

fitPlot(
  fitTable,
  predictorColumn = 1,
  responseColumn = 2,
  weights = NULL,
  fit = fitLM(fitTable, predictorColumn = predictorColumn, responseColumn =
    responseColumn, weights = weights),
  title = "",
  figureNo = 1,
  caption = paste(c("Figure ", figureNo, ": Calibration Curve"), collapse = ""),
  autoScalePredictor = FALSE,
  predictorLimits = c(0, "N/A"),
  predictorLabel = NULL,
  predictorOob = 1,
  autoScaleResponse = FALSE,
  responseLimits = c(0, "N/A"),
  responseLabel = NULL,
  responseOob = 1,
  regressionColor = "red",
  regressionLineType = 1,
  regressionWidth = 1,
  regressionAlpha = 1,
  pointsColor = "Black",
  pointsFill = "black",
  pointsShape = 21,
  pointsSize = 2,
  pointsAlpha = 1,
  showConfidence = TRUE,
  confidenceLevel = 0.95,
  confidenceColor = "green",
  confidenceAlpha = 0.2,
  showPrediction = FALSE,
  predictionLevel = 0.95,
  predictionColor = "blue",
  predictionAlpha = 0.05,
  rotateGraph = FALSE,
  predictorOptions = "1",
  responseOptions = "1"
)

Arguments

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

autoScalePredictor

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

predictorLimits

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

predictorLabel

name of the x-axis, character vector

predictorOob

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

autoScaleResponse

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

responseLimits

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

responseLabel

name of the y-axis, character vector

responseOob

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

regressionColor

color of the regression line

regressionLineType

appearance of the regression line: 0 = blank, 1 = solid, 2 = dashed, 3 = dotted, 4 = dotdash, 5 = longdash, 6 = twodash

regressionWidth

width of the regression line (default 1)

regressionAlpha

alpha ('seethrough' value) of the regressionline

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

showConfidence

defines if confidence level needs to be shown (usually shown as a shaded area around the line)

confidenceLevel

defines the confidence level (range 0-1)

confidenceColor

color of the confidence 'area'

confidenceAlpha

alpha ('seethrough' value) of the confidence 'area'

showPrediction

defines if prediction level needs to be shown (usually shown as a shaded area around the line)

predictionLevel

defines the prediction level (range 0-1)

predictionColor

color of the prediction 'area'

predictionAlpha

alpha ('seethrough' value) of the prediction 'area'

rotateGraph

if TRUE, then x-axis and y-axis are swapped, essentially resulting in a graph rotated 90 degrees

predictorOptions

x-axis options character vector, "1" normal scale, "2" reversed scale, "3" logarithmic scale (log10)

responseOptions

y-axis options character vector, "1" normal scale, "2" reversed scale,"3" logarithmic scale (log10)

Value

ggplot object


BenBruyneel/BBPersonalR documentation built on Aug. 23, 2024, 8:28 p.m.