Learn R Programming

sorvi (version 0.7.26)

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

Description

Arguments:

Usage

regression_plot(formula, data, main = NULL, 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, bw = FALSE, slices = 200,
  palette = colorRampPalette(c("#FFEDA0", "#DD0000"), bias = 2)(20),
  ylim = NULL, quantize = "continuous", ...)

Arguments

formula

formula

data

data

main

figure title

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

should the median smoother be visually weighted?

show.lm

should the linear regresison line be plotted?

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

bw

define a default b/w-palette (TRUE/FALSE)

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

palette

provide a custom color palette for the watercolors

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)

...

further parameters passed to the fitting function, in the case of loess, for example, "span = .9", or "family = 'symmetric'"

Returns:

Value

ggplot2 object

References

See citation("microbiome")

Examples

Run this code
# NOT RUN {
library(dplyr); library(RColorBrewer);
  	     	      library(ggplot2); data(iris);
		      p <- regression_plot(Sepal.Length ~ Sepal.Width, iris)
# }

Run the code above in your browser using DataLab