residualPlot: Make residual plots

View source: R/F_residualPlot.R

residualPlotR Documentation

Make residual plots

Description

Make residual plots

Usage

residualPlot(
  RCM,
  Dim = 1,
  whichTaxa = "response",
  resid = "Deviance",
  numTaxa = 9,
  mfrow = NULL,
  samColour = NULL,
  samShape = NULL,
  legendLabSize = 15,
  legendTitleSize = 16,
  axisLabSize = 14,
  axisTitleSize = 16,
  taxTitle = TRUE,
  h = 0
)

Arguments

RCM

an RCM object

Dim

an integer, which dimension?

whichTaxa

a character string or a character vector, for which taxa to plot the diagnostic plots

resid

the type of residuals to use, either 'Deviance' or 'Pearson'

numTaxa

an integer, the number of taxa to plot

mfrow

passed on to par(). If not supplied will be calculated based on numTaxa

samColour, samShape

Vectors or character strings denoting the sample colour and shape respectively. If character string is provided, the variables with this name is extracted from the phyloseq object in RCM

legendLabSize

size of the legend labels

legendTitleSize

size of the legend title

axisLabSize

size of the axis labels

axisTitleSize

size of the axis title

taxTitle

A boolean, should taxon title be printed

h

Position of reference line. Set to NA for no line

Details

If whichTaxa is 'run' or 'response' the taxa with the highest run statistics or steepest slopes of the response function are plotted, numTax indicates the number. If whichTaxa is a character vector, these are interpreted as taxon names to plot. This function is mainly meant for linear response functions, but can be used for others too. The runs test statistic from the tseries package is used.

Value

Plots a ggplot2-object to output

See Also

RCM

Examples

data(Zeller)
require(phyloseq)
tmpPhy = prune_taxa(taxa_names(Zeller)[1:120],
prune_samples(sample_names(Zeller)[1:75], Zeller))
#Subset for a quick fit
zellerRCMlin = RCM(tmpPhy, k = 2,
covariates = c('BMI','Age','Country','Diagnosis','Gender'),
responseFun = 'linear', round = TRUE, prevCutOff = 0.03)
residualPlot(zellerRCMlin)

CenterForStatistics-UGent/RCM documentation built on April 24, 2023, 8:26 p.m.