Questions tagged [probability-density]

In probability theory, the density of a random variable is a function that describes the relative likelihood for this random variable to take on a given value. DO NOT CONFUSE THIS TAG WITH 'PDF': Adobe's file format.

Overview

From wiki:

In probability theory, a probability density function (pdf), or density of a continuous random variable, is a function that describes the relative likelihood for this random variable to take on a given value. The probability for the random variable to fall within a particular region is given by the integral of this variable’s density over the region. The probability density function is nonnegative everywhere, and its integral over the entire space is equal to one.

Related tags: , , .

Tag Usage

  • DO NOT CONFUSE THIS TAG WITH : Adobe's file format.

  • Questions on should be about implementation and programming problems, not about the statistical or theoretical properties of the technique. Consider whether your question might be better suited to Cross Validated, the StackExchange site for statistics, machine learning and data analysis.

614 questions
36
votes
4 answers

Creating a density histogram in ggplot2?

I want to create the next histogram density plot with ggplot2. In the "normal" way (base packages) is really easy: set.seed(46) vector <- rnorm(500) breaks <- quantile(vector,seq(0,1,by=0.1)) labels = 1:(length(breaks)-1) den =…
Usobi
  • 1,816
  • 4
  • 18
  • 25
24
votes
1 answer

Fitting data points to a cumulative distribution

I am trying to fit a gamma distribution to my data points, and I can do that using code below. import scipy.stats as ss import numpy as np dataPoints = np.arange(0,1000,0.2) fit_alpha,fit_loc,fit_beta = ss.rv_continuous.fit(ss.gamma, dataPoints,…
Sahil M
  • 1,790
  • 1
  • 16
  • 31
21
votes
3 answers

How to compute the probability of a value given a list of samples from a distribution in Python?

Not sure if this belongs in statistics, but I am trying to use Python to achieve this. I essentially just have a list of integers: data = [300,244,543,1011,300,125,300 ... ] And I would like to know the probability of a value occurring given this…
qazplok11
  • 427
  • 1
  • 4
  • 13
17
votes
3 answers

How do I calculate PDF (probability density function) in Python?

I have the following code below that prints the PDF graph for a particular mean and standard deviation. https://i.stack.imgur.com/5WRKO.jpg Now I need to find the actual probability, of a particular value. So for example if my mean is 0, and my…
Raaj
  • 363
  • 1
  • 3
  • 12
15
votes
2 answers

geom_density y-axis goes above 1

I think this might partly be an R question and partly a statistics question, so please excuse me if there is a better place for it (if so, please let me know where). Let's say I have a dataset my_measurements like this: >…
hpy
  • 1,989
  • 7
  • 26
  • 56
15
votes
4 answers

Creating a mixture of probability distributions for sampling

Is there a general way to join SciPy (or NumPy) probability distributions to create a mixture probability distribution which can then be sampled from? I have such a distribution for display using something like: mixture_gaussian = (norm.pdf(x_axis,…
Jenny Shoars
  • 994
  • 3
  • 16
  • 40
13
votes
2 answers

How to generate random numbers with predefined probability distribution?

I would like to implement a function in python (using numpy) that takes a mathematical function (for ex. p(x) = e^(-x) like below) as input and generates random numbers, that are distributed according to that mathematical-function's probability…
12
votes
2 answers

What is probability density function in the context of scipy.stats.norm?

This is a very basic question, but I can't seem to find a good answer. What exactly does scipy calculate for scipy.stats.norm(50,10).pdf(45) I understand that the probability of a particular value like 45 in a gaussian with mean 50 and std dev 10…
max_max_mir
  • 1,494
  • 3
  • 20
  • 36
12
votes
3 answers

R: Generate data from a probability density distribution

Say I have a simple array, with a corresponding probability distribution. library(stats) data <- c(0,0.08,0.15,0.28,0.90) pdf_of_data <- density(data, from= 0, to=1, bw=0.1) Is there a way I could generate another set of data using the same…
puslet88
  • 1,288
  • 15
  • 25
11
votes
2 answers

Calculate probability from density function

I've build density function and now I want to calculate the probability of a new data point to "fall" into selected interval (say, a=3, b=7). So, I'm looking for: P(a
staove7
  • 560
  • 5
  • 18
11
votes
1 answer

Faster convolution of probability density functions in Python

Suppose the convolution of a general number of discrete probability density functions needs to be calculated. For the example below there are four distributions which take on values 0,1,2 with the specified probabilities: import numpy as np pdfs =…
Forzaa
  • 1,465
  • 4
  • 15
  • 27
11
votes
4 answers

scipy gaussian_kde and circular data

I am using scipys gaussian_kde to get probability density of some bimodal data. However, as my data is angular (it's directions in degrees) I have a problem when values occur near the limits. The code below gives two example kde's, when the domain…
Dave
  • 1,170
  • 3
  • 20
  • 30
11
votes
1 answer

How do I perform a convolution in python with a variable-width Gaussian?

I need to perform a convolution using a Gaussian, however the width of the Gaussian needs to change. I'm not doing traditional signal processing but instead I need to take my perfect Probability Density Function (PDF) and ``smear" it, based on the…
10
votes
2 answers

Compute area under density estimation curve, i.e., probability

I have a density estimate (using density function) for my data learningTime (see figure below), and I need to find probability Pr(learningTime > c), i.e., the the area under density curve from a given number c (the red vertical line) to the end of…
Eric
  • 149
  • 1
  • 1
  • 7
10
votes
3 answers

Fit distribution to given frequency values in R

I have frequency values changing with the time (x axis units), as presented on the picture below. After some normalization these values may be seen as data points of a density function for some distribution. Q: Assuming that these frequency points…
Marta Karas
  • 4,967
  • 10
  • 47
  • 77
1
2 3
40 41