Questions tagged [probability-distribution]

A probability distribution is a function that defines the probability of occurrences of the different possible values of a variable.

What is it?

A probability distribution is a function that defines the probability of occurrences of the different possible values of a variable.

Typical examples of distributions are the uniform distribution in which each value has the same probability, the normal distribution in which the values around the avergage have a higher probability and the extreme values the lowest probability.

See also

315 questions
3
votes
1 answer

R: plot() Function with type="h" Misrepresents Small Numbers ( For Larger Values of "lwd" )

I am trying to generate a plot showing the probabilities of a Binomial(10, 0.3) distribution. I'd like to do this in base R. The following code is the best I have come up with, plot(dbinom(1:10, 10, 0.3), type="h", lend=2, lwd=20, yaxs="i") My…
Michael
  • 1,537
  • 6
  • 20
  • 42
3
votes
1 answer

Python Scipy add probability distributions

Given multiple probability distributions, is there an optimized function in scipy (or other library) that allows me to add distributions? Consider the simple example: Suppose I have a 6 sided die and a 20 sided die and I want to know the probability…
Docuemada
  • 1,703
  • 2
  • 25
  • 44
3
votes
1 answer

Graph of empirical and theoretical distributions for Zero Inflated Poisson Distribution

Following is a kind of data set I am working on it: data <- c(0, 1, 0, 11, 2, 0, 3, 0, 0, 2, 1, 3, 1, 0, 1, 0, 0, 0, 2, 3, 0, 0, 0, 8, 1, 1, 1, 0, 1, 1, 2, 7, 0, 0, 0, 5, 2, 3, 6, 1, 1, 5, 2, 9, 0, 0, 1, 21, 16, 2, 9, 6, 25, 2, 1, 12, 16, 14, 15,…
3
votes
1 answer

Generating truncated negative binomial distribution in python

I am trying to generate datasets following truncated negative binomial distribution consisting of numbers such that the number set has a max value. def truncated_Nbinom(n, p, max_value, size): import scipy.stats as sct temp_size = size …
3
votes
1 answer

Quick evaluation of binomial likelihood in Rcpp

I need to evaluate a large number of binomial likelihoods very quickly. Therefore, I am thinking of implementing this in Rcpp. One way to do it is the following: #include // [[Rcpp::depends(RcppArmadillo)]] using namespace…
yrx1702
  • 1,619
  • 15
  • 27
3
votes
2 answers

Summarize and plot list of ndarrays according to chosen values

I have a list of ndarrays: list1 = [t1, t2, t3, t4, t5] Each t consists of: t1 = np.array([[10,0.1],[30,0.05],[30,0.1],[20,0.1],[10,0.05],[10,0.05],[0,0.5],[20,0.05],[10,0.0]], np.float64) t2 =…
Zed
  • 121
  • 1
  • 7
3
votes
1 answer

Workaround for 'sum pk not equal to 1' error in scipy's stats.rv_discrete module

In python3, scipy's stats.rv_discrete function requires that the sum of the probabilities to be 1 but because of the representation of floats in memory, the sum is not 1. Fortunately scipy was installed in my home directory, so I was able to comment…
3
votes
1 answer

How to read probability distributions from a database and save them in collections

I'm migrating from Arena to AnyLogic and have a question about distributions. I need to use different distributions based on some agent parameters. I have seen the suggestion here but the number of distributions is too large and I prefer not to hard…
3
votes
1 answer

Why doesn't "dnorm" sum up to one as a probability?

This may be some basic/fundamental question on 'dnorm' function in R. Let's say I create some z scores through z transformation and try to get the sum out of 'dnorm'. data=c(232323,4444,22,2220929,22323,13) z=(data-mean(data))/sd(data) …
3
votes
1 answer

How to decompose efficiently dpoibin into its summands in R?

The Poisson-Binomial distribution concerns the probability of the number of successes in a sequence of independent Bernoulli trials with different probabilities of success. This is a generalization of the Binomial distribution. With the command…
3
votes
1 answer

Understanding PyTorch Bernoulli distribution from the documention

So I was reading the pytorch document trying to learn and understand somethings(because I'm new to the machine learning ), I found the torch.bernoulli() and I understood (I miss understood it) that it approximates the tensors that the have the…
3
votes
2 answers

PHP: How to distribute values to variables with equal probability?

Note to moderators: This is not a homework assignment. I have the following example: $points = 10; $a = 0; $b = 0; $c = 0; $d = 0; I want to randomly distribute the points to the variables ($a,$b,$c,$d) until $points reach zero. So, expected random…
evilReiko
  • 19,501
  • 24
  • 86
  • 102
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 maximize joint likelihood function with different (but fixed) means

The goal Optimize a common dispersion parameter across groups of data over fixed mu, where mu changes by group. The problem I have n=10 groups of data, each of which I assume is a random sample from a negative binomial distribution with fixed…
2
votes
2 answers

Fastest way to count the number of times each face of a N-sided dice appears for M rolls

Given M rolls of an N sided dice I want to generate an N array which stores the count for the number of times each face of the dice appears. For example, for a 6 sided dice, for 10 rolls you might get: [2, 3, 2, 1, 1, 1] AKA 2 1's, 3 2's, 2 3's, 1…
name
  • 181
  • 1
  • 12
1
2
3
20 21