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

chart.ECDF

Create an ECDF overlaid with a Normal CDF


Description

Creates an emperical cumulative distribution function (ECDF) overlaid with a cumulative distribution function (CDF)

Usage

chart.ECDF(
  R,
  main = "Empirical CDF",
  xlab = "x",
  ylab = "F(x)",
  colorset = c("black", "#005AFF"),
  lwd = 1,
  lty = c(1, 1),
  element.color = "darkgray",
  xaxis = TRUE,
  yaxis = TRUE,
  ...
)

Arguments

R

an xts, vector, matrix, data frame, timeSeries or zoo object of asset returns

main

set the chart title, same as in plot

xlab

set the x-axis label, same as in plot

ylab

set the y-axis label, same as in plot

colorset

color palette to use, defaults to c("black", "\#005AFF"), where first value is used to color the step function and the second color is used for the fitted normal

lwd

set the line width, same as in plot

lty

set the line type, same as in plot

element.color

specify the color of chart elements. Default is "darkgray"

xaxis

if true, draws the x axis

yaxis

if true, draws the y axis

...

any other passthru parameters to plot

Details

The empirical cumulative distribution function (ECDF for short) calculates the fraction of observations less or equal to a given value. The resulting plot is a step function of that fraction at each observation. This function uses ecdf and overlays the CDF for a fitted normal function as well. Inspired by a chart in Ruppert (2004).

Author(s)

Peter Carl

References

Ruppert, David. Statistics and Finance, an Introduction. Springer. 2004. Ch. 2 Fig. 2.5

See Also

Examples

data(edhec)
chart.ECDF(edhec[, 1, drop=FALSE])

PerformanceAnalytics

Econometric Tools for Performance and Risk Analysis

v2.0.4
GPL-2 | GPL-3
Authors
Brian G. Peterson [cre, aut, cph], Peter Carl [aut, cph], Kris Boudt [ctb, cph], Ross Bennett [ctb], Joshua Ulrich [ctb], Eric Zivot [ctb], Dries Cornilly [ctb], Eric Hung [ctb], Matthieu Lestel [ctb], Kyle Balkissoon [ctb], Diethelm Wuertz [ctb], Anthony Alexander Christidis [ctb], R. Douglas Martin [ctb], Zeheng 'Zenith' Zhou [ctb], Justin M. Shea [ctb]
Initial release
2020-02-05

We don't support your browser anymore

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