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
10
votes
3 answers

How to convert distance into probability?

Сan anyone shine a light to my matlab program? I have data from two sensors and i'm doing a kNN classification for each of them separately. In both cases training set looks like a set of vectors of 42 rows total, like this: [44 12 53 29 35 30 49; …
10
votes
3 answers

Integrate 2D kernel density estimate

I have a x,y distribution of points for which I obtain the KDE through scipy.stats.gaussian_kde. This is my code and how the output looks (the x,y data can be obtained from here): import numpy as np from scipy import stats # Obtain data from…
Gabriel
  • 40,504
  • 73
  • 230
  • 404
9
votes
1 answer

Calculating the derivative of cumulative density function in Python

Is it the case that the exact derivative of a cumulative density function is the probability density function (PDF)? I am calculating the derivative using the numpy.diff(), is this correct? See below code below: import scipy.stats as s import…
kungphil
  • 1,759
  • 2
  • 18
  • 27
8
votes
2 answers

probability density histogram with Matplotlib doesnt make sense

I have just run a simple task of trying to plot the probability density histogram for a simulation I ran. However, when I plot it, the probability for each bin seems not to match the result of the frequency plot. with 50 bins i would expect each bin…
Moj
  • 85
  • 1
  • 7
8
votes
5 answers

multivariate student t-distribution with python

To generate samples with multivariate t-distribution I use this function: def multivariatet(mu,Sigma,N,M): ''' Output: Produce M samples of d-dimensional multivariate t distribution Input: mu = mean (d dimensional numpy array or…
farhawa
  • 10,120
  • 16
  • 49
  • 91
7
votes
1 answer

Julia - Generate multivariate Gaussian samples with given mean and covariance matrix using mvNormal

I need to generate, say 2000 samples of 2D multivariate Gaussian distribution with mean [2;3] and covaraince C = [0.2 0; 0 0.3] in Julia. Is it possible to do it using MvNormal function from Distributions package? Thanks in advance.
7
votes
1 answer

Evaluating (not Sampling from) Beta Distribution in Numpy

I am trying to calculate Beta(x; a, b) for many specific values of x, taking a = 1, b = 25. There is a beta function in numpy, namely numpy.random.beta(a, b). But it samples from the beta distribution, rather than evaluating for specific values of…
J.D.
  • 139
  • 4
  • 14
7
votes
1 answer

Estimating the parameters of a custom distribution using mle()

I have the following code that I wish to estimate the parameters of a custom distribution. For more details on the distribution. Then using the estimated parameters I want to see if the estimated PDF resembles the distribution of the given the data…
nashynash
  • 375
  • 2
  • 19
7
votes
2 answers

How to plot multiple density plots on the same figure in python

I know this is going to end up being a really messy plot, but I am curious to know what the most efficient way to do this is. I have some data that looks like this in a csv file: ROI Band Min Max Mean Stdev 1 …
JAG2024
  • 3,987
  • 7
  • 29
  • 58
7
votes
1 answer

Generate random variables from a distribution function using inverse sampling

I have a specific density function and I want to generate random variables knowing the expression of the density function. For example, the density function is : df=function(x) { - ((-a1/a2)*exp((x-a3)/a2))/(1+exp((x-a3)/a2))^2 } From this…
Lydie
  • 117
  • 1
  • 10
7
votes
3 answers

Beta Binomial Function in Python

I would like to calculate the probability given by a binomial distribution for predetermined x(successes), n(trials), and p(probability) - the later of which is given by a probability mass function Beta(a,b). I am aware of…
TheChymera
  • 17,004
  • 14
  • 56
  • 86
7
votes
3 answers

Generating random number for a distribution of a real data?

I have a set of real data and I want use this data to find a probability distribution and then use their property to generate some random points according to their pdf. A sample of my data set is as following: #Mag Weight 21.9786 3.6782 24.0305…
Dalek
  • 4,168
  • 11
  • 48
  • 100
7
votes
2 answers

How to plot a probability mass function in python

How can I create a histogram that shows the probability distribution given an array of numbers x ranging from 0-1? I expect each bar to be <= 1 and that if I sum the y values of every bar they should add up to 1. For example, if x=[.2, .2, .8] then…
kmosley
  • 366
  • 1
  • 2
  • 11
6
votes
3 answers

calculate area of overlapping density plot by ggplot using R

How can I get the area under overlapping density curves? How can I solve the problem with R? (There is a solution for python here: Calculate overlap area of two functions ) set.seed(1234) df <- data.frame( sex=factor(rep(c("F", "M"), each=200)), …
user5878028
  • 117
  • 1
  • 13
6
votes
2 answers

2D gaussian distribution does not sum to one?

I built a wrapped bivariate gaussian distribution in Python using the equation given here: http://www.aos.wisc.edu/~dvimont/aos575/Handouts/bivariate_notes.pdf However, I don't understand why my distribution fails to sum to 1 despite having…
neither-nor
  • 1,245
  • 2
  • 17
  • 30
1
2
3
40 41