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
1
vote
2 answers

How to skew random choice probability towards one option?

I am using the random library in python to select win or lose. import random choice = random.choice(['win','lose']) Is there anyway I can say set the probability in the code to say I want more lose than win everytime the code runs?
RustyShackleford
  • 3,462
  • 9
  • 40
  • 81
1
vote
3 answers

Conditional probability in SQL

I think I have end up in a bit of a dead end. Let's say I have a dataset, which is fairly easy - person_id and book_id. Which is pretty much factual table that says person X bought books A, B and C. I know how to find out how many persons have…
Egert Aia
  • 459
  • 2
  • 12
1
vote
1 answer

How do I randomly equalize unequal values?

Say I have multiple unequal values a, b, c, d, e. Is it possible to turn these unequal values into equal values just by using random number generation? Example: a=100, b=140, c=200, d=2, e=1000. I want the algorithm to randomly target these sets…
1
vote
3 answers

Creating a probability distribution using Numpy in Python3.6

I'm trying to create a probability distribution using Numpy in the following way: x = 3 pat = [0.20, 0.30, 1.30] z = numpy.random.choice(x, p=numpy.ndarray.tolist(numpy.array(pat)/sum(pat))) And this works fine. The problem is that my "population"…
GWasp
  • 51
  • 6
1
vote
0 answers

glm function crashing RStudio

I am trying to find the probability of a Swinging Strike on a various number of factors, including the count, Release Speed, Spin Rate. I have pitch by pitch data. I changed the value of Pitch Result to 0 and 1 (1 being a Swinging Strike, 0 being…
user10643490
1
vote
1 answer

Permutations of NxN matrix with equal summation of any row elements or column elements (N being odd number)

The matrix NxN has N rows and columns. It has all unique elements starting from 1 to (N^2). The condition is the summation of any row elements should be equal to summation of any other row or column elements. Example: For 3x3 matrix, one of the…
Patrick
  • 11
  • 1
1
vote
2 answers

How can I calculate probability for all each numpy value at once?

I have a function for calculating probability like below: def multinormpdf(x, mu, var): # calculate probability of multi Gaussian distribution k = len(x) det = np.linalg.det(var) inv = np.linalg.inv(var) denominator =…
YeongHwa Jin
  • 435
  • 5
  • 15
1
vote
1 answer

Finding the probability of a variable in collection of lists

I have a selection of lists of variables import numpy.random as npr w = [0.02, 0.03, 0.05, 0.07, 0.11, 0.13, 0.17] x = 1 y = False z = [0.12, 0.2, 0.25, 0.05, 0.08, 0.125, 0.175] v = npr.choice(w, x, y, z) I want to find the probability of…
JuhBuh
  • 9
  • 1
1
vote
0 answers

My own methods return None instead of a valid value

My own class methods do not work when I check how my function 'linker' operates. These methods return None value. When I run these methods in the interactive mode, they work and each returns a new node linked to the root. Why do these methods not…
aspiring
  • 357
  • 2
  • 3
  • 11
1
vote
1 answer

Annual exceedance probability scale in ggplot

I've got a dataframe df of calculated Annual exceedance probability (AEP) of daily maximum liquid precipitation (P): df <- tibble::tribble( ~AEP, ~P, 0.001, 299.0973209, 0.01, 254.7226534, 0.03, 233.0298722, 0.05,…
atsyplenkov
  • 1,158
  • 13
  • 25
1
vote
1 answer

probability of purchasing an item based on past purchases

I have some data on individual purchases. In this data PANID is a person who bought a product on a particular week. In the sample I provide, there are 6 unique PANID's; so 6 people in total. I am trying to calculate the conditional probability that…
user113156
  • 6,761
  • 5
  • 35
  • 81
1
vote
1 answer

Is there a way to find the probability of different values in matrices

I thought there would be a library that would help me to do this task instead of writing many lines of codes. I tried finding some solutions from books related to my problem, but I could not find any. One of the recent books I did read related to…
Abdulaziz Al Jumaia
  • 436
  • 2
  • 5
  • 22
1
vote
1 answer

Efficiently evaluate Multivariate Normal

I want to evaluate datapoints that arise from multivariate normal densities. I have to evaluate each datapoint with respect to different means and covariance matrices. I have two means for each observation to evaluate the likelihood. Also, I have…
yrx1702
  • 1,619
  • 15
  • 27
1
vote
1 answer

Self-Correcting Probability Distribution - Maintain randomness, while gravitating each outcome's frequency towards its probability

This is a common problem when you want to introduce randomness, but at the same time you want your experiment to stick close to the intended probability distribution, and can not / do not want to count on the law of big numbers. Say you have…
1
vote
1 answer

How to get probabilities when using Pytorch's densenet?

I want to do a binary classification and I used the DenseNet from Pytorch. Here is my predict code: densenet = torch.load(model_path) densenet.eval() output = densenet(input) print(output) And here is the output: Variable containing: 54.4869…
龚世泽
  • 11
  • 2
1 2 3
99
100