FAQ Database Discussion Community

## Probability mass of summing two discrete random variables, in linearithmic time

arrays,algorithm,complexity-theory,probability-density
Given two discrete random variables, their (arbitrary) probability mass functions a and b and a natural-number N such that both of the variables have the domain [0..N] (therefore the functions can be represented as arrays), the probability that the functions' corresponding random variables have a given sum (i.e. P(A+B==target)) can...

## R - Get joint probabilities from 2D Kernel Density Estimate

r,probability-density
I have two vectors S and V, and using the function kde2d, I get the following plot of their joint density: Using this data, is it possible to obtain an empirical estimate of the joint probability, in the form P(S[i],V[j]) ? In the question How to find/estimate probability density function...

## Multiply Probability Distribution Functions

r,statistics,probability-density
I'm having a hard time building an efficient procedure that adds and multiplies probability density functions to predict the distribution of time that it will take to complete two process steps. Let "a" represent the probability distribution function of how long it takes to complete process "A". Zero days =...

## Matlab: how to plot density of events

matlab,plot,probability-density
I have a file of just 1 column containing the dates (in the format dd/mm/yyyy) of some events, as follows 13/01/2003 07/01/2003 23/01/2003 25/01/2003 ... 27/12/2014 I would like to plot the probability density of the events: how to treat the data format? If it is possible, I would like...

## Estimate pdf of a vector using Gaussian Kernel

matlab,statistics,probability,kernel-density,probability-density
I am using Gaussian kernel to estimate a pdf of a data based on the equation where K(.) is Gaussian kernel, data is a given vector. z is bin from 1 to 256. size of bin is 1. I implemented by matlab code. However, the result show the amplitude of...

## Fit distribution to given frequency values in R

r,distribution,estimation,probability-density,weibull
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 are from Weibull distribution T, how can I fit...

## Faster convolution of probability density functions in Python

python,numpy,vectorization,convolution,probability-density
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 = np.array([[0.6,0.3,0.1],[0.5,0.4,0.1],[0.3,0.7,0.0],[1.0,0.0,0.0]]) The convolution can be found like this: pdf = pdfs...