plot_regression {microbiome} | R Documentation

## Visually Weighted Regression Plot

### Description

Draw regression curve with smoothed error bars with Visually-Weighted Regression by Solomon M. Hsiang; see http://www.fight-entropy.com/2012/07/visually-weighted-regression.html The R is modified from Felix Schonbrodt's original code http://www.nicebread.de/ visually-weighted-watercolor-plots-new-variants-please-vote

### Usage

    plot_regression(
      formula,
      data,
      B = 1000,
      shade = TRUE,
      shade.alpha = 0.1,
      spag = FALSE,
      mweight = TRUE,
      show.lm = FALSE,
      show.median = TRUE,
      median.col = "white",
      show.CI = FALSE,
      method = loess,
      slices = 200,
      ylim = NULL,
      quantize = "continuous",
      show.points = TRUE,
      color = NULL,
      pointsize = NULL,
      ...
    )

### Arguments

`formula` | formula
`data` | data
`B` | number bootstrapped smoothers
`shade` | plot the shaded confidence region?
`shade.alpha` | shade.alpha: should the CI shading fade out at the edges? (by reducing alpha; 0=no alpha decrease, 0.1=medium alpha decrease, 0.5=strong alpha decrease)
`spag` | plot spaghetti lines?
`mweight` | visually weight the median smoother
`show.lm` | plot the linear regression line
`show.median` | show median smoother
`median.col` | median color
`show.CI` | should the 95% CI limits be plotted?
`method` | the fitting function for the spaghettis; default: loess
`slices` | number of slices in x and y direction for the shaded region. Higher numbers make a smoother plot, but takes longer to draw. I wouldn'T go beyond 500
`ylim` | restrict range of the watercoloring
`quantize` | either 'continuous', or 'SD'. In the latter case, we get three color regions for 1, 2, and 3 SD (an idea of John Mashey)
`show.points` | Show points.
`color` | Point colors
`pointsize` | Point sizes
`...` | further parameters passed to the fitting function, in the case of loess, for example, 'span=.9', or 'family='symmetric”

### Value

ggplot2 object

### Author(s)

Based on the original version from F. Schonbrodt. Modified by Leo Lahti microbiome-admin@googlegroups.com

### References

See citation('microbiome')

### Examples

    data(atlas1006)
    pseq <- subset_samples(atlas1006,
       DNA_extraction_method == 'r' &
       sex == "female" &
       nationality == "UKIE",
       B=10, slices=10 # non-default used here to speed up examples
       )
    p <- plot_regression(diversity ~ age, meta(pseq)[1:20,], slices=10, B=10)

[Package microbiome version 1.12.0 Index]