Questions tagged [cdf]

CDF is an acronym for cumulative distribution function. While the pdf gives the probability density of each value of a random variable, the cdf (often denoted F(x)) gives the probability that the random variable will be less than or equal to a specified value.

A cumulative density function describes the probability that a real-valued random variable X with a given probability distribution will be found at a value less than or equal to x.

The cdf of a discrete random variable is the summation of the probability mass function (pmf) of that distribution. If the random variable is continuous, this turns out to be the integral of the probability density function (pdf).

enter image description here

In applied statistics, cdfs are important in comparing distributions, playing a role in plots (e.g., pp-plots), and hypothesis tests (e.g., the Kolmogorov-Smirnov test).

Strongly related to


Common Data Format

Please pay attention another acronym for CDF is describe in and here is the NASA link for more details.

341 questions
2
votes
1 answer

Rcpp implementation of mvtnorm::pmvnorm slower than original R function

I am trying to get a Rcpp version of pmvnorm to work at least as fast as mvtnorm::pmvnorm in R. I have found https://github.com/zhanxw/libMvtnorm and created a Rcpp skeleton package with the relevant source files. I have added the following…
mkln
  • 14,213
  • 4
  • 18
  • 22
2
votes
1 answer

CDF of a multivariate Normal in Tensorflow

I want to evaluate the cdf of a multivariate normal distribution using tensorflow. What I have tried so far: import tensorflow as tf ds = tf.contrib.distributions # Initialize a single 3-variate Gaussian. mu = [0., 0., 0.] cov = [[ 0.36, 0.12, …
2
votes
1 answer

matplotlib: how to remove vertical line from cdf graph for datetime values

The following code draws the cdf for datetime values: import matplotlib.pyplot as plt import matplotlib.dates as dates import numpy as np; np.random.seed(42) import pandas as pd objDate = dates.num2date(np.random.normal(735700, 300, 700)) ser =…
SaadH
  • 1,158
  • 2
  • 23
  • 38
2
votes
1 answer

R - Gamma Cumulative Distribution Function

I want to calculate the Gamma CDF for an array of data that I have. I have calculated the alpha and beta parameters, however I am not sure of how to calculate the CDF in R,(Is there something like Matlab's gamcdf?). I have seen some people use…
Ann M
  • 239
  • 2
  • 14
2
votes
1 answer

CDF beyond range of values in R ggplot2

I am trying to plot the CDF using ggplot2 in R and I get the following plot But the min and max values of the data are 1947 and 2017. I do not want the line to be plot beyond the ranges [1947, 2017]. ggplot(df, aes(x=year)) + stat_ecdf(geom="line")…
Dinesh
  • 2,194
  • 3
  • 30
  • 52
2
votes
2 answers

Inverse Gumbel Sampling

I'm trying to use the inverse CDF of the Gumbel Dist. to simulate random numbers. However for the inverse I get mu-x*log(-log(beta)) which spits out imaginary numbers which can't be write. The original CDF is e^-e^(-(x-mu)/beta). And my code…
2
votes
1 answer

R - Inverse cumulative distribution method with given function

I have a given function (let's call it f(x)) and I used the Monte Carlo method to normalized it. I calculated the probability density function and I got the cumulative distribution function from integrating that. f = function(x) ... plot(f,xlim =…
tomas
  • 67
  • 1
  • 9
2
votes
1 answer

Calculate inverse CDF from a sample of data

If i got a random sample data: X=np.random.random(100)*100 and I need to get the value X_i with CDF = 34% or whatever. The only way that I am able to think right now is with inverse CDF. I thought that percentile would be equivalent but someone…
jmparejaz
  • 160
  • 1
  • 14
2
votes
0 answers

Python: Evaluate image (video) contrast

For my project I need a plot showing how the quality of contrast in a video changes over time. At the moment I'm calculating the CDF of the image histogram for every frame - now I need to translate this into some kind of percentage/quality…
2092Juli
  • 83
  • 1
  • 5
2
votes
0 answers

Python matplotlib add additional information to CDF plot

I'm able to plot a CDF plot (My CDF) using import numpy as np import matplotlib import matplotlib.pyplot as plt from matplotlib.ticker import FuncFormatter def to_percent(y, position): # Ignore the passed in position. This has the effect of…
2
votes
3 answers

Plotting empirical cumulative probability function and its inverse

I have data cdecn: set.seed(0) cdecn <- sample(1:10,570,replace=TRUE) a <- rnorm(cdecn,mean(cdecn),sd(cdecn)) I have created a plot which displays the cumulative probabilities. aprob <- ecdf(a) plot(aprob) I am wondering how I can switch the…
Dylan
  • 37
  • 3
2
votes
2 answers

Python Matplotlib histogram bin shift

I have created a cumulative (CDF) histogram from a list which is what I wanted. Then I subtracted a fixed value (by using x = [ fixed_value - i for i in myArray]) from each element in the list to essential just shift the bins over a fixed amount. …
laserpython
  • 300
  • 1
  • 6
  • 21
2
votes
1 answer

Python Skewness and Kurtosis in Naive Bayes classifier

I am creating a Naive Bayes classifier in Python that will be able to guess which month it is based on some weather data of a single day. Currently the mean and standard deviation are used to classify the month, however I figured that adding…
Thijs Riezebeek
  • 1,762
  • 1
  • 15
  • 22
2
votes
0 answers

Create empirical cumulative distribution function (CDF) and then use the CDF to find probabilities

I have a set of observed data and created an empirical cumulative distribution using Excel. I want to use this CDF to find probabilities like P(x < X) or P (X1 < x < X2 ). The way I created the CDF is to arrange the data in ascending order and then…
exlover
  • 69
  • 1
  • 2
  • 8
2
votes
1 answer

Plot a Cumulative Distribution Function in MATLAB

I'm getting a strange looking graph from my cdf function. If I use ecdf, I get the graph I expect. But I get a tangled mess that looks like it contains the right data, but in some wrong order. SNR = exprnd(1,1000,1); Cap = 1*log2(1+SNR); % unit…
Duck
  • 53
  • 1
  • 7