timeSerPlot: Plot time series of estimated _b_ with confidence intervals

View source: R/plotting.R

timeSerPlotR Documentation

Plot time series of estimated b with confidence intervals

Description

Plot time series of estimated b with confidence intervals, for data that are analysed year-by-year by a single method. And then fit a linear regression with its confidence intervals (or not if doRegression = FALSE). This will get called eight times to produce a comparison figure of the methods.

Usage

timeSerPlot(
  bForYears,
  legName,
  method,
  weightReg = FALSE,
  bCol = "black",
  pchVal = 20,
  cexVal = 1,
  confCol = "black",
  confThick = 1,
  xLim = NULL,
  yLim = NULL,
  xLab = "",
  yLab = expression(paste("Estimate of ", italic(b)), sep = ""),
  xTicksSmallInc = NULL,
  xTicksSmallTck = 0.01,
  yLabels = TRUE,
  yTicksSmallInc = NULL,
  yTicksSmallTck = 0.01,
  legPos = "topleft",
  newPlot = TRUE,
  regPlot = TRUE,
  regColNotSig = "darkgrey",
  regColSig = "red",
  legExtra = NULL,
  legExtraPos = "topleft",
  legExtraCol = "",
  insetVal = c(-0.08, -0.06),
  xJitter = 0,
  doRegression = TRUE
)

Arguments

bForYears

dataframe with columns Year, Method (optional), b (the estimate of b), confMin and confMax (the 95\ confidence limits) and stdError (the standard error of the estimate of b).

legName

legend name for that panel

method

method used to obtain the inputted estimates of b

weightReg

TRUE if doing weighted regression (using standard errors) or FALSE to not do weighted regression.

bCol

colour for points for b

pchVal

pch for points for b

cexVal

size of points for b

confCol

colour for confidence intervals for b

confThick

thickness of vertical line for confidence intervals

xLim

x-axis limits

yLim

y-axis limits

xLab

label for x-axis

yLab

label for y-axis

xTicksSmallInc

increments for where to have small (unlabelled) tickmarks on x-axis

xTicksSmallTck

tick length for small (unlabelled) tickmarks on x-axis

yLabels

whether or not to label main tickmarks on y-axis

yTicksSmallInc

increments for where to have small (unlabelled) tickmarks on y-axis

yTicksSmallTck

tick length for small (unlabelled) tickmarks on y-axis

legPos

legend position

newPlot

TRUE to create a new plot, FALSE to add to existing

regPlot

TRUE to plot the regression line and conf intervals

regColNotSig

colour for regression line (and its confidence intervals) if the trend is not significant

regColSig

colour for regression line (and its confidence intervals) if the trend is significant

legExtra

extra manually-specified legend (e.g. to distinguish two sets of results)

legExtraPos

position for extra manually-specified legend

legExtraCol

colours (vector) for extra manually-specified legend

insetVal

inset shift for naming the panel

xJitter

value to jitter the x-values by (for comparison plot the confidence intervals overlap)

doRegression

whether to calculate a regression for the time series of estimates

Value

if doRegression is TRUE (default) then return dataframe of just one row with columns (else return nothing):

  • Method: method used

  • Low: lower bound of 95\

  • Trend: gradient of regression fit

  • High: upper bound of 95\

  • p: p-value of regression fit

  • Rsquared: r-squared of regression fit

  • adjRsquared: adjusted r-squared of regression fit

Author(s)

Andrew Edwards


andrew-edwards/sizeSpectra documentation built on June 28, 2023, 7:09 p.m.