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)

Example output

Loading required package: MASS

fifer documentation built on May 30, 2017, 7:40 a.m.

Related to spearman.plot in fifer...