All Questions

Filter by
Sorted by
Tagged with
30 votes
8 answers
26k views

Distributed probability random number generator

I want to generate a number based on a distributed probability. For example, just say there are the following occurrences of each numbers: Number| Count 1 | 150 2 | ...
Mark Conway's user avatar
18 votes
3 answers
4k views

Probability of Outcomes Algorithm

I have a probability problem, which I need to simulate in a reasonable amount of time. In simplified form, I have 30 unfair coins each with a different known probability. I then want to ask things ...
Kenny's user avatar
  • 183
8 votes
2 answers
20k views

Expected collisions for perfect 32bit crc

I'm trying to determine how my crc compares to an "ideal" 32bit crc. So I ran my crc over 1 million completely random samples of data and collected the amount of collisions, I want to compare this ...
Tristan's user avatar
  • 3,865
8 votes
1 answer
17k views

Calculating Probability of a Random Variable in a Distribution in Python

Given a mean and standard-deviation defining a normal distribution, how would you calculate the following probabilities in pure-Python (i.e. no Numpy/Scipy or other packages not in the standard ...
Cerin's user avatar
  • 63k
7 votes
4 answers
16k views

How to create a probability by a given percentage?

I'm trying to create a percentage-based probability for a game. E.g. if an item has a 45% chance of a critical hit, that must mean it is 45 of 100 hits would be critical. First, I tried to use a ...
maelstrom's user avatar
7 votes
2 answers
14k views

Probability notation [closed]

I want to ask you about the notation in probability. I know that P(A | B) = the conditional probability that event A occurs given that event B has occurred already But I cannot find what A,B ...
user1328370's user avatar
6 votes
0 answers
2k views

Flip a probability tree in R

Currently taking a course on decision analysis. There is a concept called "flipping a probability tree", illustrated in the following example. May I know: (1) Is there a way to do the above ...
dwstu's user avatar
  • 869
4 votes
2 answers
116 views

JS inverting probabilities

I'm generating a grid of objects, each of which has one of 3 colors. Assume I'm filling a particular grid cell. I know that around this cell there are, for example, 1 object of color 0, 1 of color 1 ...
Alex Chashin's user avatar
  • 3,395
4 votes
0 answers
350 views

How to obtain the probability distribution of a sum of dependent discrete random variables more efficiently

I hope you are well. I was wondering if you could help me with the question provided in the attached link, please. Below the link I attach an R-code that solves the problem recursively for particular ...
Student1981's user avatar
4 votes
0 answers
67 views

How could time series prediction be applied in a real-time setting where it is infeasible to track every single item?

The problem: Find the estimated lifetime of an object (e.g. the time it is written next) or the corresponding PDF. This is known as a renewal process. Constraint: it is infeasible to track metadata ...
DivineTraube's user avatar
3 votes
3 answers
390 views

Batch scripting Issues with random, probability or a bug

Please excuse any mistakes, this is my first post! Recently I was bored and was trying to make a batch script clone of an arcade game I once saw: http://antikrish.com/2013/01/28/whittakers-ascot-gold-...
user2928774's user avatar
3 votes
1 answer
665 views

How to Make a Uniform Random Integer Generator from a Random Boolean Generator?

I have a hardware-based boolean generator that generates either 1 or 0 uniformly. How to use it to make a uniform 8-bit integer generator? I'm currently using the collected booleans to create the ...
Andika Wasisto's user avatar
3 votes
1 answer
417 views

Should Naive Bayes multiple all the word in the vocabulary

I am using Naive Bayes in text classification. Assume that my vocabulary is ["apple","boy","cup"] and the class label is "spam" or "ham". Each document will be covered to a 3-dimentional 0-1 vector. ...
Rongshen Zhang's user avatar
3 votes
2 answers
563 views

Multiple ngrams in transition matrix, probability not adding to 1

I'm trying to find a way to make a transition matrix using unigrams, bigrams, and trigrams for a given text using python and numpy. Each row's probabilities should equal to one. I did this first with ...
iamjane's user avatar
  • 162
3 votes
1 answer
196 views

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 ...
Student1981's user avatar
2 votes
3 answers
4k views

how to implement non uniform probability distribution?

I am trying to implement non-uniform probability distribution in genetic algorithm. In the implementation of genetic program, I have an experiment which has 3 outcomes, where each outcome has ...
Reddy's user avatar
  • 1,630
2 votes
2 answers
1k views

How to get random number with each number has its own probability [duplicate]

For example, I want to get random number from set S = {0, 1, 2, 3}. But instead of each number has same probability to shown (which is 25%), now I have different probability for each number, let say {...
Agung Pratama's user avatar
2 votes
1 answer
128 views

Simulating a dice throw with threadlocalrandom does not converge to the expected value

I was trying to verify the expected value formula in java. I did something very trivial, I simulated the roll of a dice, but I mapped each side to a specific value. So each value has probability of 1/...
Jim's user avatar
  • 4,109
2 votes
1 answer
945 views

Birthday paradox in DataBase (calculate collision probability)

According to Birthday paradox: If i apply it to the Database (please correct me if I'm wrong): if we need to store UNIQUE hashed data in Database and we have a hash algorythm that can generate 365 ...
rinchik's user avatar
  • 2,660
2 votes
3 answers
2k views

Computationally simple pseudo-Gaussian distribution with varying mean and standard deviation?

This picture from Wikipedia has a nice example of the sort of functions I'd ideally like to generate: Right now I'm using the Irwin-Hall Distribution, which is more or less a polynomial approximation ...
Justin L.'s user avatar
  • 13.6k
1 vote
4 answers
8k views

How to obtain a value based on a certain probability

I have some functions which generate double, float, short, long random values. I have another function to which I pass the datatype and which should return a random value. Now I need to choose in that ...
Manas's user avatar
  • 521
1 vote
2 answers
818 views

Calculate current probability in respect to prior probabilities to get uniform distribution

Disclaimer: not sure if title of question is accurate... Let's say I need to wash the dishes within the next 100 minutes. I know I MUST do it after 100 minutes as the latest. I ask myself every 2 ...
Niels Kristian's user avatar
1 vote
1 answer
3k views

How to implement the standard normal cumulative distribution function in C (or other language)

First of all, for those of you who don't know this law, don't be afraid it's actually pretty simple. On this link http://en.wikipedia.org/wiki/Black%E2%80%93Scholes_model you will see this law from a ...
PiggyGenius's user avatar
1 vote
1 answer
474 views

Draw random numbers from a custom probability density function in Matlab

I want to sample R random numbers from a custom probability density function in Matlab. This is the expression of the probability density function evaluated at x. I thought about using ...
Star's user avatar
  • 2,259
1 vote
1 answer
1k views

gaussian mixture model probability matlab

I have a data of dimension 50x100000. (100000 features, each has a dimension of 50). I would like to fit a gaussian mixture model using this data. I used the following code. obj = ...
user570593's user avatar
  • 3,440
1 vote
1 answer
1k views

Simulating computation of the expected value of random variable Y

I have been given the following task: Compute the expected value of Y=e^{-X}(X is uniform between 0 and 1) with a simulation in R. Plot the expected value as a function of the number of simulations ...
Steinar Ágúst Steinarsson's user avatar
1 vote
1 answer
118 views

How to get this probability outcome in R?

New to R. Not sure how to go about this problem. Essentially I want to create a Monte Carlo simulation. However this is how it's supposed to go: There are only 3 people (A,B,C) And only come into ...
worldCurrencies's user avatar
1 vote
1 answer
7k views

How to generate independent identically distributed (iid) random variables in python

I am developing a simulation infrastructure with some random events (for instance, sources that generate output with a certain probability). So far I've been doing it using the random.random() ...
Tayyar R's user avatar
  • 675
1 vote
1 answer
131 views

Calculate probability of an event not by exclusion

I have some doubt with these kind of problems, example: "If we asked 20,000 in a stadium to toss a coin 10 times, what it's the probability of at least one person getting 10 heads?" I took ...
marz's user avatar
  • 881
1 vote
2 answers
781 views

If Random variable is a function

The basic definition of random variable is that it is a function based on random experiment.the question is that if it is a function say f then how can it take numerical values.. Suppose if ...
Muneeb Wani's user avatar
1 vote
1 answer
61 views

a function display logarithm of a pdf in matlab

I need to calculate the density of 50 in a standard normal distribution, actually, the result will return to 0 by pdf('norm',50,0,1), then I try to display the logarithm of it,it doesn't work with log(...
Jack2007's user avatar
1 vote
2 answers
182 views

Multiple Chi Square Test on a factor with two levels and multiple parameters in a function

Issue I have a group called Country that has two levels (Spain and Germany) and I have nine parameters that are measurements taken from spectrograms for dolphin whistles. I want to determine if any of ...
Alice Hobbs's user avatar
  • 1,033
1 vote
1 answer
65 views

Match Bayesian Networks using Joint Probablity to Network Graph

I'm stuck on a task right now. Given the Joint Probabilities given below, how can I show that they belong exactly to one of the networks (and not to the other two). According to my intuition I would ...
J.B.'s user avatar
  • 91
1 vote
1 answer
320 views

Finding Probability on a biased die

I had to simulate a biased die such that 6 occurs more than 50% of the times. Which I was able to do using: from random import randint,choice def bdie(): out = random.randint(0,2) if (out==1 ...
Umang Mistry's user avatar
1 vote
1 answer
122 views

Shiny App on Evolutionary Dynamics: Simulation Errors?

I’m a math grad student who has just started learning R, and I could really use some help from any R-literate people! I’m building a shiny app that models probabilistic evolutionary behavior (as a ...
Aydin Mohseni's user avatar
1 vote
2 answers
141 views

Reservoir Sampling unable to understand probability

To make clear following is the question: Given an input stream of an indeterminate length, how do you return a random member of that stream (with equal probability for each), given that you're not ...
AdityaKapreShrewsburyBoston's user avatar
1 vote
2 answers
44 views

Can i trust on a key generation process without check for duplicates?

I'm using a process to put a name on user profile images and i'm afraid of collisions. The name pattern that i'm using is the following: 9999999_9999999_9999999 So the images are named like: ...
BigBlast's user avatar
  • 397
1 vote
0 answers
48 views

Issue regarding Triangular Distribution Function calculation

The daily demand for gasoline in a metropolitan area is best modeled according to the Triangular distribution between 1.25 million and 2.05 million gallons, and with a peak (mode) of 1.85 million ...
Abhishek's user avatar
1 vote
0 answers
37 views

Calculating Probability of Earthquakes in a Four-Week Period Using Poisson Distribution in Octave

Question: In an area of a country, it is known that earthquakes occur 1.4 times in 8 days in an average sense since the dawn of history. However, there were 15 earthquakes in the last four weeks. ...
Avin's user avatar
  • 11
1 vote
0 answers
54 views

How to get a new solution with high probability from previously found, incomplete solutions with different probabilities?

I am working on a AI algorithm. first when program runs a random solution is generated from which ,in first iteration of the program 10 solution vectors are created, by analyzing these solutions we ...
Kumar's user avatar
  • 9
1 vote
1 answer
255 views

probability for winning combination in poker game

We are trying to calculate probabilities(and odds) for "bet on poker" game on which we are working now. To calculate probabilities and odds for each hand we used https://github.com/cookpete/poker-odds ...
einsh10's user avatar
  • 314
1 vote
0 answers
34 views

How to decide which Probability distribution to use on a specific problem?

Which probability distribution i can use to understand the number of orders one person can handle in a company? It's like each person has orders which takes minimum of 50 days to complete and no limit ...
Sonu's user avatar
  • 59
1 vote
0 answers
61 views

R Probability calculation with number of Criterion

I have historic data with 4 constraints say C1, C2, C3 and C4 . All the constraints take string value. If we take an example of a football match say 4 constraints would be C1 :place where game is ...
user3852180's user avatar
1 vote
1 answer
2k views

Find probability of the given data set, what probability i can say it is bad

I have a issue where there is a data set. and in there i have good and bad category, and in that category there are few elements that can be good and bad.... you can see the ven diagram i attached ...
Loshan Wickramasekara's user avatar
1 vote
1 answer
194 views

reservoir sampling understanding probaility

I am having trouble understanding the probabilities involved in reservoir sampling. Below is the sample code which I have seen used in almost everywhere: 1/* 2 S has items to sample, R will ...
noman pouigt's user avatar
0 votes
4 answers
428 views

I don't understand Bayes' rule [closed]

I know that Bayes' rule is in form of P(A/B)=P(B/A)*P(A)/P(B) What I don't understand is, what means P(A/B) and P(B/A) ? Regards.
migea's user avatar
  • 517
0 votes
2 answers
266 views

Calculate probability that a baby is right handed

A doctor says that a baby who predominantly turns his/her head to the right while lying on his/her back will be right-handed and conversely one who predominantly turns to the left will be left-handed. ...
Soul Slayer's user avatar
0 votes
3 answers
204 views

code for choosing N values with some associated probabilities

Suppose we have a set x of N values {x_i; i=1,...,N} and a set of some associated probabilities {w_i; i=1,...,N}. We want to get from the set x, a new set x^ of N values {x^_i; i=1,...,N} by ...
shn's user avatar
  • 5,206
0 votes
3 answers
3k views

Probability of occuring of An infinitely often

IF probability of occurance of A , infinitely often is 0, does it mean probability of occurance of A complement , infinitely often is 1???
Nitin Garg's user avatar
  • 2,069
0 votes
1 answer
501 views

Compute probability of union of n events from array

I have a PHP array containing N probabilities (of N different events). So it looks like: $events = [0.85, 1, 0, 0.15, 0.49, 1, 1, 0, 0, 0.59, 0.93] where each value in the array is the probability ...
Stephen H. Anderson's user avatar