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
1 answer

Why does replicate() return a matrix?

> n_toss = 3; # Number of Tosses > n_trial = 10; # Number of Trials > > mySamples <- sample(c(1,0), n_toss, replace = T, prob=c(0.5,0.5)) > mySamples [1] 1 0 1 > > mySamples <- replicate(n_trial, + { + mySamples <-…
user366312
  • 16,949
  • 65
  • 235
  • 452
1
vote
0 answers

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 could give each of them a probability ( highest ,…
Kumar
  • 9
  • 6
1
vote
1 answer

Calculating probability using simulation

Let Xi~U(0,30) be random variables. If one takes a sample of n=12, then we are interested in knowing the probability of the proportion to be greater than 18 i.e. $P(\overline X_{12}>18)$ Without using simulation and applied the CLT, the answer is…
user9802913
  • 245
  • 4
  • 20
1
vote
1 answer

All possible combinations as new columns of a dataframe based on primary column

I have a dataframe like this Dt A B C D 11-apr 1 1 1 1 10-apr 2 3 1 2 how do I get a new frame that looks like this: I want to…
Jithendra
  • 31
  • 4
1
vote
0 answers

Predicting probability of disease according to a continuous variable adjusting by confusing variables

I have a doubt regarding to the R package "margins". I'm estimating a logistic model: modelo1 <- glm(VD ~ VE12 + VE.cont + VE12:VE.cont + VC1 + VC2 + VC3 + VC4, family="binomial", data=data) Where: VD2 is a dichotomous variable (1 disease / 0 not…
1
vote
1 answer

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 or out == 2): return 6 else: …
Umang Mistry
  • 374
  • 2
  • 7
  • 14
1
vote
1 answer

How to make a function that gives probabilities in a Geometric distribution?

I'm using MATLAB to make a function that returns the probability mass function (PMF) for a Geometric distribution when I enter the values of p, q, and the number of attempts (x) as the inputs. My function: function Probability = Geometric(p, q,…
1
vote
1 answer

is "3 + 0.5 * x" a real fit approach in probability theory

I am learning about Anscombe's quartet through this video. I am trying to draw Anscombe's quartet with Python. matplotlib doc provide an approach to do this. def fit(x): return 3 + 0.5 * x this function named fit, is it a real fit approach in…
user11074017
1
vote
1 answer

How do I fix an Index Error in Numpy for use in a model for machine learning?

I was trying to predict the probability of a person to be using a certain drug. One of the vital predictions is showing an IndexError. This is for a prediction. I've used this structure with no problems on different predictions with no…
1
vote
0 answers

Probability distribution of throwing 100 dice using Gaussian/Normal distribution bell curve

I have a program that simulates a fair dice 100 times. Using this program I need to have a bell curve over the histogram showing normal/Gaussian distribution. In my code The variable representing the outcome of the experiment is z. The definition…
1
vote
1 answer

encounter error during reproducing the Maximum Likelihood Estimation for normal distribution

I managed to reproduce this post and am trying to understand its logic. here is the code. x = [4, 5, 7, 8, 8, 9, 10, 5, 2, 3, 5, 4, 8, 9] # Plot the Maximum Likelihood Functions for different values of mu # and sigma def plot_ll(x): …
user11074017
1
vote
0 answers

Recieving Error when attempting prediction using probabilities and random forrest in R

I am attempting to create a stacked model of ten different models to collectively predict a variable (isDuplicate). After some work, I now have a dataframe with all ten probabilities as well as the variable isDuplicate. I receive the following error…
Juanito Tomas
  • 141
  • 1
  • 11
1
vote
1 answer

How to randomly select a key from a dictionary based on it's float value

Let's say i have a dict {'option one': 5.0, 'option two': 5.0, 'option three': 10.0} How can i randomly select a key based on the probabilities above (ie. option one and two will have a 25% of being chosen. Option 3 would have a 50% chance of being…
Ben Arnao
  • 492
  • 5
  • 11
1
vote
1 answer

What is the probability that a UUID, stripped of all of its letters and dashes, is unique?

Say I have a UUID a9318171-2276-498c-a0d6-9d6d0dec0e84. I then remove all the letters and dashes to get 9318171227649806960084. What is the probability that this is unique, given a set of ID's that are generated in the same way? How does this…
JavascriptLoser
  • 1,853
  • 5
  • 34
  • 61
1
vote
1 answer

Monte Carlo R function help for finding probability (balls from urn problem)

I'm trying to answer the following question using a simple Monte Carlo sampling procedure in R: An urn contains 10 balls. Two red, three white, and five black. All 10 are drawn one at a time without replacement. Find the probability that both the…
Michael
  • 111
  • 9