Questions tagged [ecdf]

Empirical Cumulative Distribution Function in statistics

For definition please see its Wikipedia page.

In software, a built-in function ecdf takes a vector of samples and generates its ECDF. It is also easy to produce it ourselves, as given in this example: How to derive an ecdf function?

131 questions
2
votes
1 answer

Turn off dotted lines in plot.ecdf()

Plotting an ecdf object in R produces a nice empirical distribution function. E.g: x = seq(1,10,1) ecdf1 = ecdf(x) plot(ecdf1,verticals=TRUE, do.points=FALSE) However, the default behavior produces a figure with horizontal dotted lines at 0 and 1.…
Devon
  • 510
  • 6
  • 17
2
votes
1 answer

Generating a stacked cumulative smooth frequency distribution plot

I have data in which two types of occurrences are registered: type_a and type_b and their year of occurrence. This is one way to generate an example of my data: set.seed(1) years <- 1991:2010 type_a_years <- 20 type_b_years <- 10 type_a <-…
dan
  • 4,868
  • 4
  • 35
  • 85
2
votes
2 answers

Get data associated to ggplot + stat_ecdf()

I like the stat_ecdf() feature part of ggplot2 package, which I find quite useful to explore a data series. However this is only visual, and I wonder if it is feasible - and if yes how - to get the associated table? Please have a look to the…
cho7tom
  • 870
  • 2
  • 11
  • 27
2
votes
1 answer

ggplot2 ecdf faceting for subsets + overall ecdf in each panel

I have a data set with a continuous variable and a factor with n levels. I'd like to plot an empirical cumulative distribution function for each level separately plus an overall ecdf in each of the panels. The point is to compare the subsets'…
kategorically
  • 127
  • 2
  • 8
2
votes
1 answer

How to plot estimated CDF with empirical CDF

I am fitting a distribution to a given data.then I have estimated parameters of the distribution.I have also plotted the empirical cdf using ecdf() command in R. Now I have to plot cdf of estimated distribution along with empirical cdf. How I can do…
user2881894
  • 21
  • 1
  • 2
2
votes
1 answer

ggplot2 ecdf behaviour seems odd

Consider the following series and cumulative plot: x=c(0,0,0,0.5,10,1500) qplot(x,geom='step',stat='ecdf') This produces a graph that starts left of zero. In other words, it looks as if x has negative values. At the right it continues to the right…
Henk
  • 3,428
  • 4
  • 26
  • 51
1
vote
1 answer

Label ECDF plot points

I'm trying to label the points of an ECDF plot with another column from my data field. Currently I'm using this: untouched = read.table("results-untouched.tsv", sep="\t") plot.ecdf(untouched$V4, xlim=c(0.75,1.25), ylim=c(0,1), col='green',…
cdecker
  • 4,042
  • 6
  • 41
  • 71
1
vote
2 answers

ecdf plot error in ggplot2: unknown color name

I get an error with a very simple ecdf plot in ggplot. Error in color name. library(ggplot2) ggplot(iris) + stat_ecdf(aes(x = Sepal.Length, col = Species), geom = "point") Error: Unknown colour name: setosa
Forge
  • 1,238
  • 1
  • 9
  • 25
1
vote
1 answer

How to calculate the largest distance between two cumulative sample distributions in Python?

Assume there are two 1D Numpy array samples with the same length, X1 and X2. After converting each of the two samples separately into accumulative density distribution, how to calculate the largest distance between the two cumulative sample…
1
vote
1 answer

How can I fix the runtime error in ecdf function in R?

When I run this code- a<- read.delim(file.choose("data.txt")) d<-sort(a$d) plot(d, sort(ecdf(d)(d)),type="s", lty=2,col="red", ylab= "P(X<=x)",ylim= 0:1) it makes me make this mistake- Error in ecdf(d) : 'x' must have 1 or more non-missing…
John John
  • 15
  • 6
1
vote
1 answer

Making ECDF plot in GGplot using double aes

I kind of stuck how to obtain ECDF (line and point combined together) plot using more than 1 aes (could be color, linetype for geom_line or shape for geom_point). So, I have this code for example data<-mtcars data$cyl<-as.factor(data$cyl) …
1
vote
1 answer

R function ecdf

xs <- seq(floor(min(fheight)),ceiling(max(fheight)),0.01) plot(xs, ecdf(fheight)(xs),type = "l", xlab = "height in inches",ylab = "F(x)") What is the purpose of (xs) in ecdf(fheight)(xs)
1
vote
1 answer

Is there a way I could plot t = 300, 350, 450, and 500 lines in one graph?

enter image description hereI wanted to plot multiple lines in one graph but I couldn't figure out which code to use. Also, is there a way I could assign colors to each of the lines? Just new to Rstudio and was assigned to pick up someones work so…
trix
  • 11
  • 2
1
vote
1 answer

Can you customize the plot generated from the MATLAB function 'ecdf'?

I find that I can easily customize when I use the 'plot' function, but I cannot seem to do the same things with the 'ecdf' function. Are you able to customize the way ecdf is displayed? Mainly, I would like the linewidth to be thicker so people…
1
vote
2 answers

Set weights for ewcdf {spatstat} [R]

I want to compare a reference distribution d_1 with a sample d_2 drawn proportionally to size w_1 using the Kolmogorov–Smirnov distance. Given that d_2 is weighted, I was considering accounting for this using the Weighted Empirical Cumulative…
Gion Mors
  • 512
  • 1
  • 3
  • 16
1 2
3
8 9