Questions tagged [probability]

Consider if your question would be better at stats.stackexchange.com. Probability touches upon uncertainty, random phenomena, random numbers, random variables, probability distributions, sampling, combinatorics.

See also https://statistics.stackexchange.com

Probability theory is a branch of mathematics that studies uncertainty and random phenomena. It operates by introducing a sample space (a set), and associating probabilities (numbers between 0 and 1, inclusive) to certain subsets of this set, in a manner that satisfies some sensible axioms. If the sample space can be thought of as the real line, we obtain random variables; if it is a Euclidean space, we obtain random vectors. Random variables and random vectors have associated probability distributions, which can be characterized by probability density functions, cumulative density functions, moments, characteristic or moment generating functions.

Typically, questions with this tag will deal with computing (exactly or approximately) probabilities of certain events (from winning a lottery to server outages), drawing random samples, approximating distributions, etc. There might be an overlap with statistics and/or statistical packages (R, SAS, Stata).

Synonym: probability-theory

4021 questions
11
votes
2 answers

Creating Probability/Frequency Axis Grid (Irregularly Spaced) with Matplotlib

I'm trying to create a frequency curve plot, and I'm having trouble manipulating the axis to get the plot I want. Here is an example of the desired grid/plot I am trying to create: Here is what I have managed to create with matplotlib: To create…
Nelz11
  • 3,066
  • 1
  • 14
  • 20
11
votes
1 answer

Creating all strongly connected graphs with given in-degree with equal probability

I am looking for a way to sample uniformly from the space of all strongly connected directed graphs (without self-loops) of n nodes and in-degree k=(k_1,...,k_n), 1 <= k_i <= n-1. Input n, the number of nodes k = (k_1,...,k_n), where k_i = number…
user3117090
  • 143
  • 6
11
votes
1 answer

Distribution plot of an array

I have a numpy array containing float values in [-10..10]. I would like to plot a distribution-graph of the values, like this (here it is done for a binomial random variable) : For example I would like bars counting the number of elements in each…
Basj
  • 41,386
  • 99
  • 383
  • 673
11
votes
3 answers

Does an open-source poker-related math library exist?

I would like to develop a poker odds application that can give the probability of various game situations. Since the application will be mostly statistical analysis, I figured I would see if someone else had already written a library that implements…
Ben S
  • 68,394
  • 30
  • 171
  • 212
11
votes
6 answers

Adjust items chance to be selected from a list

I have a list of items. When I create the list each item has equal chance to be selected. But as an item is selected its chance goes down while the others chance goes up. If a new item is added during the process, it should have the highest…
Thad
  • 1,518
  • 2
  • 21
  • 37
10
votes
2 answers

Uniform distribution from a fractal Perlin noise function in C#

My Perlin noise function (which adds up 6 octaves of 3D simplex at 0.75 persistence) generates a 2D array array of doubles. These numbers each come out normalized to [-1, 1], with mean at 0. I clamp them to avoid exceptions, which I think are due to…
Superbest
  • 25,318
  • 14
  • 62
  • 134
10
votes
4 answers

An algorithm to calculate probability of a sum of the results happening

The algorithm I'm talking about using would allow you to present it with x number of items with each having a range of a to b with the result being y. I would like to have an algorithm which would, when presented with the values as described would…
133794m3r
  • 5,028
  • 3
  • 24
  • 37
10
votes
5 answers

Which java-library computes the cumulative standard normal distribution function?

For a project I have a specification with formulas, I have to implement. In these formulas a cumulative standard normal distribution function exists, that takes a float and outputs a probability. The function is symbolized by a Φ. Exists a…
Mnementh
  • 50,487
  • 48
  • 148
  • 202
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
2 answers

Probability prediction method of KNeighborsClassifier returns only 0 and 1

Can anyone tell me what's the problem with my code? Why I can predict probability of iris dataset by using LinearRegression but, KNeighborsClassifier gives me 0 or 1 while it should give me a result like the one LinearRegression yields? from…
10
votes
1 answer

Space-efficient probabilistic data structures for number retrieval

Consider we have an algorithm that receives a hypothetically long stream of keys. It then generates a value between 0 and 1 for each key, as we process it, for posterior retrieval. The input set is large enough that we can't afford to store one…
Amelio Vazquez-Reina
  • 91,494
  • 132
  • 359
  • 564
10
votes
2 answers

Bayesian inference

I have an instrument that will either pass or fail a series of three tests. The instrument must pass all three tests to be considered successful. How may I use Bayesian inference to look at the probability of passing each case based on evidence?…
Harry Lime
  • 2,167
  • 8
  • 31
  • 53
10
votes
4 answers

Generate Random Numbers with Probabilistic Distribution

Ok, so here's my problem. We are looking at purchasing a data set from a company to augment our existing data set. For the purposes of this question, let's say that this data set ranks places with an organic number (meaning that the number…
ircmaxell
  • 163,128
  • 34
  • 264
  • 314
10
votes
3 answers

Probability of getting the same value using Math.random

The requirement is to send a unique id to database when user click on submit button. So I am using Javascript Math.random method. I just want to know what are the chances or possibility to get same number and what bit size of using Math.random.
Jitender
  • 7,593
  • 30
  • 104
  • 210
10
votes
3 answers

Dice odds: Simulating a game of Craps

My brother turns 21 in a couple of weeks and my parents and I are taking him to Las Vegas. For my 21st, I brought $200 to gamble in Vegas and came home with around $450, mostly from playing craps. I plan on bringing $200 again for this trip and…
Kevin
  • 3,771
  • 2
  • 31
  • 40