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?

162 questions
0
votes
1 answer

R ecdf function gives only 0 or 1 values

my dataset consists of stock prices. My final goal is to fit for practice a copula to two stocks. However, while trying to transform my data to a [0,1] scale with the ecdf function, I get a weird ecdf-plot for one stock. enter image description…
Simon Lenk
  • 11
  • 2
0
votes
2 answers

How to calculate 1-CDF in R and plot it?

I want to plot the 1-CDF in R I am using the ggplot stat_ecdf g1=ggplot() + stat_ecdf(data=data_ploting, aes(x, colour=ggg), alpha=0.8, geom= "smooth", pad = FALSE) + theme_test ()
0
votes
1 answer

Generate a graph for each file in a directory using R

I have been trying to generate an ECDF graph for a group of files that contain a column of numbers from which the file should be generated. The input files look like this: 122 34.5 566 ... I am able to generate the ECDF graph for one file at a time…
0
votes
1 answer

How to define xaxis for a cumulative distribution function using ggplot and geom_ribbon in R?

I'm trying to produce a cumulative function using ggplot and stat_ecdf. Since I need the area under the curve to be colored, I'm using geom=="ribbon". I need the x axis to be as highest as 20, however, I want to estimate the cumulative function…
0
votes
1 answer

How to compute CDF from a given PMF in Matlab

For a given PMF p=f(\theta) for \theta between 0 and 2\pi, i computed the CDF in Matlab as theta=0:2*pi/n:2*pi for i=1:n cdf(i)=trapz(theta(1:i),p(1:i)); end and the result is verified. I tried to do the same with cumsum as cdf=cumsum(p)*(2*pi)/n…
0
votes
2 answers

ECDF Function seems to be broken in R

Code and Image I am working on a problem which requires I create an ECDF from data. All was working well, and then it seems that all of a sudden my ECDF function started returning nonsense. To prove this I wrote the following lines of…
JSOD
  • 3
  • 1
0
votes
1 answer

Is it possible to extract the value of a function of multiple points using R?

Hello and thanks for reading! I built an ecdf function using rstudio and I am trying to get the probabilities that correspond to certain points (list format). My R code looks like this: input <- read.table('/home/agalvez/data/domains/test_ecdf.txt',…
0
votes
1 answer

Seaborn ecdf plot, adjust spacing in legend items

In a Seaborn scatter plot, I can adjust the spacing in the legend entries like so: tips = sns.load_dataset('tips') g = sns.scatterplot(data=tips, x="total_bill", y="tip", hue="time") plt.legend(labelspacing=20) How can I do this with a CDF plot?…
a11
  • 3,122
  • 4
  • 27
  • 66
0
votes
1 answer

Cumulative count of unique values over time

I have a dataframe mydf like this: | Country | Year | | ---------- | ---- | | Bahamas | 1982 | | Chile | 1817 | | Cuba | 1960 | | Finland | 1918 | | Kazakhstan | 1993 | etc., with many more rows. Is there an easy way to plot the…
anpami
  • 760
  • 5
  • 17
0
votes
2 answers

Plotting CCDF of walking durations

I have plotted the CCDF as mentioned in question part of the maximum plot points in R? post to get a plot(image1) with this code: ccdf<-function(duration,density=FALSE) { freqs = table(duration) X = rev(as.numeric(names(freqs))) Y…
user744121
  • 467
  • 2
  • 7
  • 17
0
votes
0 answers

Cumulative Histogram shows wrong values

I have created this CDF and added values to the bars. The absolut values seem to be correct. However, when I set density to True the %s are off: fig, ax = plt.subplots() values, x_pos, _ = plt.hist(x['tx'],cumulative=True, density=True,…
truongvu3
  • 29
  • 4
0
votes
1 answer

R :Generate ecdf on multiple columns on a grouped data frame

I would like to do this in R My dataframe looks like this: lab value1 value2 wbc 7.0 6 wbc 6.5 3 rbc 3.5 2 rbc 4.0 2 plt 100 1 plt 120 2 wbc 5.0 2 wbc 7.5 1 rbc 4.1 0 I would like…
teotjunk
  • 11
  • 1
0
votes
1 answer

add reference line in ecdf ggplot2

I am trying to add a reference line to my ecdf graph in R. Here is what my data looks like. dput(head(pppp)) structure(list(B_code= c(1121058L, 1121058L, 1121058L, 1121058L, 1121058L, 1121058L), Distance = c(0.9, 1.3, 1.6, 1.9, 2.1, 2.2 ), AI_i =…
Yun Hyunsoo
  • 71
  • 1
  • 8
0
votes
3 answers

Visualising the distribution for different subgroups

I'm using "d.pizza" data. There is variable called "delivery_min" which is delivery time (in minutes) and there is variable called "area" which can be one of three areas (Camden, Westminster and Brent). I want to draw a density plot that visualises…
wrzosowa
  • 9
  • 3
0
votes
2 answers

Color an ecdf plot that is grouped by one discrete factor, to be colored continuously using a different (continues) factor?

I'm trying to make an ecdf graph (Empirical cumulative distribution function) with a different colored plot for each subject ('A', 'B' or 'C' in this example). In this example, the X axis describes the RT (response time), and the Y axis describes…
Yuval Harris
  • 53
  • 1
  • 5