Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

plot.edf

Plot Circular Empirical Distribution Function


Description

Plots the empirical distribution function of a circular data set.

Usage

## S3 method for class 'edf'
plot(x, type = "s", xlim = c(0, 2 * pi), ylim = c(0, 1), ...)
## S3 method for class 'edf'
lines(x, type = "s", ...)

Arguments

x

vector of circular data measured.

type, xlim, ylim

plotting parameters with useful defaults. xlim is in radians.

...

optional graphical parameters. See help section on par.

Details

The vector of data is taken modulo 2*pi, and then the linear ranks are used to generate an empirical distribution function.

Note

Creates a plot or adds a plot (lines.edf) of the empirical distribution function of the circular data vector.

Author(s)

Claudio Agostinelli and Ulric Lund

See Also

Examples

# Compare the edf's of two simulated sets of data.
data1 <- rvonmises(n=10, mu=circular(0), kappa=3)
data2 <- rvonmises(n=10, mu=circular(0), kappa=1)
plot.edf(data1, xlab="Data", ylab="EDF", main="Plots of Two EDF's")
lines.edf(data2, lty=2, col=2)

#You can use standard ecdf and plot.ecdf functions
ff <- function(x, data) {
     x <- x
     data <- data
     temp <- ecdf(data)
     temp(x)
}
plot(function(x) ff(x, data=data1), from=0, to=2*pi-3*.Machine$double.eps)

#Or curve.circular
plot.function.circular(function(x) ff(x, data=data1), from=0, 
  to=(2*pi-3*.Machine$double.eps), join=FALSE, nosort=TRUE, xlim=c(-2,2), 
  ylim=c(-2,2), modulo="asis", main="Empirical Distribution Function", 
  n=2001, tcl.text=0.25)

res <- plot.function.circular(function(x) ff(x, data=data2), from=0, 
  to=(2*pi-3*.Machine$double.eps), join=FALSE, nosort=TRUE, modulo="asis", 
  add=TRUE, col=2, n=2001)

res1 <- points(data1, plot.info=res)
points(data2, plot.info=res1, col=2, sep=0.05)

legend(-1.9, 1.9, legend=c("data1", "data2"), col=c(1,2), lty=c(1,1))

circular

Circular Statistics

v0.4-93
GPL-2
Authors
Ulric Lund <ulund@calpoly.edu> [aut], Claudio Agostinelli <claudio.agostinelli@unitn.it> [aut, cre], Hiroyoshi Arai <h_arai@aoni.waseda.jp> [ctb], Alessando Gagliardi <gagliardi@stud.unive.it> [ctb], Eduardo Garcia Portugues <edgarcia@est-econ.uc3m.es> [ctb], Dimitri Giunchi <dimitri.giunchi@unipi.it> [ctb], Jean-Olivier Irisson <irisson@normalesup.org> [ctb], Matthew Pocernich <pocernic@ucar.edu> [ctb], Federico Rotolo [ctb]
Initial release
2017-06-26

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.