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
3
votes
1 answer

Continuous distribution from data organized in intervals in R

I have the following problem. My data set is as follows: Income Numerosity from 6000 to 7500 704790 from 7500 to 10000 1294784 from 10000 to 12000 1051902 from 12000 to 15000 1585132 from 15000 to 20000 704012 from…
Massimo2013
  • 533
  • 4
  • 17
3
votes
3 answers

Calculating a 2D joint probability distribution

I have many points inside a square. I want to partition the square in many small rectangles and check how many points fall in each rectangle, i.e. I want to compute the joint probability distribution of the points. I am reporting a couple of common…
user2875617
3
votes
1 answer

Plot PDF of log-normal distribution

I'm using the randn function to generate a Gaussian random variable x1 with mean 0 and variance 1. After generating x1, I generate another Gaussian random variable x with mean m and variance σ2, that is: x = m + sqrt(σ)·x1. I want to create a…
2
votes
1 answer

The best approach to preventing the value of the Kullback–Leibler divergence becoming infinite

Given two discrete probability distributions P and Q, containing zero values in some bins, what is the best approach to avoid the Kullback–Leibler divergence equal to infinite (and therefore getting some finite value, between zero and one)? Here…
2
votes
1 answer

How to calculate the density in results of function hist() in R

I understand how to get the density values from this data, for example the density 0.69 is obtained from counts/bin width = 3448:0.5*10000 = 0.6896, right? set.seed(1234) h <- hist(rbinom(10000, 10, 0.1), freq=FALSE) str(h) #List of 6 # $ breaks :…
MK Huda
  • 605
  • 1
  • 6
  • 16
2
votes
1 answer

AnyLogic: Definition of Lognormal-Distribution directly via its mean and standard deviation

I tried to model a lognormal distribution in AnyLogic and I have its standard deviation and its mean but NOT the standard deviation and mean of its included normal distribution (as AnyLogic demands). How can I model a lognormal distribution directly…
DynamiX
  • 63
  • 4
2
votes
0 answers

Calculating covariance for continuous distributions in R

I know the covariance for discrete distributions can be calculated using the cov and cov.wt functions in R. For example the covariance for the below distribution can be solved like this, weight <- c(.2,.05,.1,.15,.2,.3) x <-…
2
votes
1 answer

How to generate random numbers according to a custom probability density function (Python)?

I have a list containing random variables X and the fractions they occur; so if I plot these I get a probability density function. I am wondering how I can then use this probability density function to generate some random numbers? I've used…
2
votes
2 answers

How to extract the density value from ggplot in r

How can I extract the values matrix of each density plot? For example, I am interested in that when weight = 71, what will the density of orange, apple, pears, banana be ? Below is the minimal example: library(ggplot2) set.seed(1234) df =…
Math Avengers
  • 762
  • 4
  • 15
2
votes
1 answer

How do I fix This error: DistributionNotFound: The 'ptyprocess>=0.5' distribution was not found and is required by pexpect

Hi I have difficulties in fitting data using Fitter module in Python and I don't understand the error as I am quite new to Python. The following code below is what I done so far in order to get the summary. import…
2
votes
2 answers

how to prevent R from showing exp and log values inf and zero

I am going to calculate matrix normal densities to use them in loglikelihood formula. in my calculations, I need to calculate exponential of large numbers ( tens of million ). I realized, R gives back infinity for exp(i), when i >=710. is there…
Mathica
  • 1,241
  • 1
  • 5
  • 17
2
votes
1 answer

Scipy normal PDF summing to values larger than 1

I'm working with scipy.stats.norm PDFs. I'm wondering if I'm doing something wrong (maybe yes), since the sum of the PDF over the normal distribution is returning values larger than one, and, by definition, a probability density function should sum…
Lin
  • 1,145
  • 11
  • 28
2
votes
1 answer

python scipy.integrate inverse ppf

Hello I would like what is the x value that would give me an specific numeric integral. So far I am using scipy.integrate and works ok, but given a integral value is there a way to know what is the x that gave that result? let say I have a function…
sep9407
  • 23
  • 1
  • 6
2
votes
1 answer

How to plot pdf (probability density function) of 2 graphs in R

I'm trying to visualize the histogram of two distributions and then visualize the distribution in the same pdf graph. First of I'm trying to simulate 100 to 5000 draws from a normal distribution with µ = 6 och σ = 2. Attempt: x <-rnorm(n=100,…
Agent smith 2.0
  • 112
  • 2
  • 12
2
votes
1 answer

Calculating PDF given a histogram

I have a heavily right-skewed histogram and would like to calculate the probabilities for a range of Lifetimevalues (Area under the curve, the PDF). For instance, the probability that the Lifetime value is in (0-0.01) Dataframe consisting of LTV…