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

How to generate a random stochastic matrix or ndarray?

I was looking for a crate that would allow me to easily and randomly generate probability vectors, stochastic matrices or, in general, ndarrays that are stochastic. For people not familiar with these concepts, a probability vector v is defined as…
nbro
  • 15,395
  • 32
  • 113
  • 196
2
votes
0 answers

Function that can create any type of probability distribution function

I would like to receive the distribution name and parameters from the user as input and generate a probability distribution from which I can choose a random number proportional to their probability. I checked…
2
votes
0 answers

Draw a random number between two numbers based on a statistical distribution using python

I have a requirement to generate numbers between two limits based on one of the statistical distributions using python. Generally speaking, in python I can pick one number from an array based on a predefined probability distribution like…
Sal
  • 331
  • 2
  • 9
2
votes
1 answer

How to fit a distribution defined with scipy.stats.rv_continuous?

I would like to fit data with a combination of distributions in python and the most logical way it seems to be via scipy.stats.rv_continuous. I was able to define a new distribution using this class and to fit some artificial data, however the fit…
baccandr
  • 1,090
  • 8
  • 15
2
votes
1 answer

How to draw the Probability Density Function (PDF) plot in Python?

I'd like to ask how to draw the Probability Density Function (PDF) plot in Python. This is my codes. import numpy as np import pandas as pd from pandas import DataFrame import matplotlib.pyplot as plt import scipy.stats as stats . x =…
2
votes
1 answer

How to calculate a probability distribution from an array with scipy

my actual goal is to calculate the difference between two histograms. For this I would like to use the Kullback-Leibler-Divergenz. In this thread Calculating KL Divergence in Python it was said that Scipy's entropy function will calculate KL…
PeterBe
  • 700
  • 1
  • 17
  • 37
2
votes
1 answer

Ray[RLlib] Custom Action Distribution (TorchDeterministic)

We know that in the case of a Box (continuous action) Action Space, the corresponding Action Distribution is DiagGaussian (probability distribution). However, I want to use TorchDeterministic (Action Distribution that returns the input values…
2
votes
1 answer

How to generate random numbers according to a custom probability density function (Python)?

I have a list containing random variables X and the fractions they occur; so if I plot these I get a probability density function. I am wondering how I can then use this probability density function to generate some random numbers? I've used…
2
votes
1 answer

Comparing two distributions with relation among buckets

I want to compare the following distributions with key-percentage. dist1 = 200 - 0.1, 201-0.1, 500-0.8 dist2 = 200 - 0.15, 201 - 0.05, 500 - 0.8 dist3 = 200 - 0.1, 201-0.05, 500 - 0.85 dist1 is my original distribution. I want to compare it…
2
votes
1 answer

Rejection sampling not giving the correct distribution

I'm writing code to perform rejection sampling from a Cauchy distribution. x = np.linspace(-4, 4, 100) dist = scipy.stats.cauchy global_max = dist.pdf(0) This is straightforward. The default parameters of the Cauchy distribution in scipy.stats are…
user9343456
  • 351
  • 2
  • 11
2
votes
1 answer

R: how to compute the mean and covariance of a truncated normal distribution

I'm interested in finding the mean and covariance of a truncated normal random vector. Suppose Y is a vector containing [Y1 Y2 Y3]. Y follows a multivariate normal distribution with the following mean and covariance: mu <- c(0.5, 0.5, 0.5) sigma <-…
Adrian
  • 9,229
  • 24
  • 74
  • 132
2
votes
1 answer

Custom numpy (or scipy?) probability distribution for random number generation

The issue Tl;dr: I would like a function that randomly returns a float (or optionally an ndarray of floats) in an interval following a probability distribution that resembles the sum of a "Gaussian" and a uniform distributions. The function (or…
Breno
  • 748
  • 8
  • 18
2
votes
1 answer

How to use of CDF function in Turing module of Julia?

I want to know the parameters of Gamma Distribution of Awareness. Awareness is 0.336 at 1 week, 0.554 at 4 week , and 0.64 at 13 week. data set is builed here. data is cdf of Gamma dist. xs = [ 1 0.336 ; 4 0.554 ; 13 0.64 ] i coded this in Julia…
2
votes
1 answer

Simple way to plot a cumulative distribution function using TIdyverse?

I'm working through The R Book by Michael Crawley and I've arrived at a part where he is showing how to the behaviour of different probability functions. In this part he plots a simple cumulative distribution function: curve(pnorm(x),-3,3) Not a…
D.C. the III
  • 340
  • 3
  • 14
2
votes
2 answers

Write a random number generator that, based on uniformly distributed numbers between 0 and 1, samples from a Lévy-distribution?

I'm completely new to Python. Could someone show me how can I write a random number generator which samples from the Levy Distribution? I've written the function for the distribution, but I'm confused about how to proceed further! The random numbers…
user11847849
1 2
3
20 21