spearman.plot: Spearman plot

Description Usage Arguments Details Author(s) Examples

View source: R/spearman.plot.R

Description

Plots the relationship between two variables using a Spearman Plot

Usage

1
2
spearman.plot(x, y = NULL, dcol = "blue", lhist = 20, num.dnorm = 5 *
  lhist, plot.cor = TRUE, ...)

Arguments

x

either a matrix with two columns or a vector (if y is not NULL)

y

a vector

dcol

the color of the lines drawn for the density plot

lhist

the number of breaks in the histogram

num.dnorm

the number of breaks in the density line

plot.cor

logical. Should the spearman correlation be outputted in the plot?

...

arguments passed to plot

Details

Often data are not normally distributed, requiring the use of a spearman correlation to determine their relationship. However, doing so makes it difficult to visualize the data since scatterplots of raw data present the data as if a pearson correlation were used. This function plots the ranks of the data, while plotting along the axes the distributions of the raw data.

Author(s)

Dustin Fife

Examples

1
2
3
4
5
6
### generate skewed data
x = rnorm(1000)^2
y = .6*x + rnorm(1000, 0, sqrt(1-.6^2))

spearman.plot(cbind(x,y), col="red", lhist=50)
spearman.plot(x=iris$Sepal.Length, y=iris$Sepal.Width)

fifer documentation built on May 20, 2017, 5:31 a.m.

Search within the fifer package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? Tweet to @rdrrHQ or email at ian@mutexlabs.com.

Please suggest features or report bugs in the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.