All Questions

Filter by
Sorted by
Tagged with
10 votes
4 answers
31k views

Using the gaussian probability density function in C++

First, is this the correct C++ representation of the pdf gaussian function ? float pdf_gaussian = ( 1 / ( s * sqrt(2*M_PI) ) ) * exp( -0.5 * pow( (x-m)/s, 2.0 ) ); Second, does it make sense of we ...
shn's user avatar
  • 5,206
5 votes
1 answer
2k views

How to compute CDF probability of normal distribution in C++?

Is there any function that allow me to compute the CDF probability of a normal distribution, given a mean and sigma ? i.e. for example P( X < x ) given the normal distribution with $\bar{x}$ and $\...
shn's user avatar
  • 5,206
5 votes
3 answers
12k views

How To Fit Multivariate Normal Distribution To Data In MATLAB?

I'm trying to fit a multivariate normal distribution to data that I collected, in order to take samples from it. I know how to fit a (univariate) normal distribution, using the fitdist function (with ...
Shaked's user avatar
  • 495
4 votes
1 answer
80 views

probability of sample of distribution

I am trying to generate a sample of 100 scenarios (X, Y) where both X and Y are normally distributed X=N(50,5^2), Y=N(30,2^2) and X and Y are correlated Cov(X,Y)=0.4. I have been able to generate 100 ...
devCharaf's user avatar
  • 242
3 votes
4 answers
4k views

Probability of selecting an element from a set

The expected probability of randomly selecting an element from a set of n elements is P=1.0/n . Suppose I check P using an unbiased method sufficiently many times. What is the distribution type of P? ...
Boris Gorelik's user avatar
3 votes
3 answers
6k views

generate N(0,1) using uniform(0,1) in R

I am trying to generate N(0,1) using uniform(0,1) for a simulation but can't get the code to run. Firstly, my x is found by making X the subject for the CDF of normal followed by getting out the ...
teo93's user avatar
  • 129
3 votes
2 answers
2k views

Compute probability over a multivariate normal

My question addresses both mathematical and CS issues, but since I need a performant implementation I am posting it here. Problem: I have an estimated normal bivariate distribution, defined as a ...
unziberla's user avatar
  • 555
2 votes
1 answer
622 views

Probability of occurrence of random variable chosen from Normal Distribution

I was just wondering, with the code below, how would I determine the probability of occurrence associated with one of the random variables that are chosen. For example, if a particular variable is ...
Jojo's user avatar
  • 1,117
2 votes
1 answer
692 views

Python - Creating a skewed discrete normal probability distribution for sampling integers

Similarly to the following question: Create random numbers with left skewed probability distribution By stating the maximum and variance, I would like to sample integers from some given range. For ...
Codevan's user avatar
  • 548
2 votes
1 answer
3k views

probability functions in scala

I want to compute the probability that a normally distributed random number with given parameters (mean and std) will be less than a given number or list. This function is implemented in R as "pnorm". ...
user3370773's user avatar
2 votes
1 answer
73 views

How to get the probabilities of one car having the lowest mpg than the rest of the cars?

I am using this to get the mean and standard deviation of a car mpg df1 <- mtcars; df1$rownames = rownames(df1) df2 <- mtcars; df2$rownames = rownames(df2) df2$mpg = df2$mpg + rnorm(nrow(df2),0,...
Pastor Soto's user avatar
2 votes
1 answer
1k views

Multivariate Normal Distribution fitting dataset

I was reading a few papers about RNN networks. At some point, I came accross the following explanations: The prediction model trained on sN is used to compute the error vectors for each point in the ...
guillaume mendlevitch's user avatar
2 votes
1 answer
335 views

Multivariate normal distribution in Matlab. Peak shaped?

I'm trying to calculate a bivariate normal distribution in matlab(with mvnpdf), but the pdf I obtain has a strange shape with several peaks. https://i.stack.imgur.com/gmiFZ.png This is the code I ...
Julius SD'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
2 answers
12k views

How to calculate probability in normal distribution by Matlab?

I'm new to Matlab and I would appreciate if someone could help. The problem: IQ coefficients are Normally distributed with a mean of 100 and a standard deviation of 15. Calculate the probability ...
Gyuzal's user avatar
  • 1,591
1 vote
1 answer
34 views

Why does integrating scipy.multivariate_normal give incorrect probability?

I'm trying to integrate an independent bivariate normal distribution over a square region. The numerical integration does not match a Monte Carlo simulation. What's going wrong here? import numpy as ...
feetwet's user avatar
  • 3,360
1 vote
3 answers
878 views

Probability over a circular region

Suppose z is a bivariate normal (Gaussian) random variable with mean at s and covariance matrix b^2 I_2. I want to get the probability over the area ||x-s|| <= r for some fixed point x and constant ...
Dey's user avatar
  • 119
1 vote
3 answers
7k views

Matlab Plotting Normal Distribution Probability Density Function

I am new to statistics. I have a discriminant function:   g(x) = ln p(x| w)+ lnP(w) I know it has a normal distribution. I know mü and sigma variables. How can I plot pdf function of it at Matlab? ...
kamaci's user avatar
  • 73.8k
1 vote
1 answer
97 views

Probability for a vector x

In machine learning suppose we have a GDA (Gaussian Discriminant Analysis) model for classification. If y can take values 0 or 1 and x represents the vector with n features(n x 1 dimensional) What ...
Sridhar Thiagarajan's user avatar
1 vote
1 answer
185 views

How to get normal probability distribution from a simulation on car agains car?

I want to understand why I am not getting a probability distribution when I use a simulation from a random normal distribution: library(tidyverse) df <- mtcars # data df$sd <- sd(df$mpg) # ...
Pastor Soto's user avatar
1 vote
2 answers
1k views

How to fix ZeroDivisionError: float division by zero when calculating Gaussian probability

I'm trying to calculate Gaussian probability, but when I run it through my data I get ZeroDivisionError: float division by zero here's the code: def GaussianProbability(x, mean, std): exponent = ...
user avatar
1 vote
1 answer
20k views

How to change the z value to the one from the table (Z-Table from Normal Distribution) in C++?

i have task to make a program using C++ to calculate a probability using a normal distribution. If i already found the Z value, how to change it to become the one from the Z table? Like -0.55, in the ...
Satria Adi's user avatar
1 vote
1 answer
691 views

Calculate and plot the theoretical normal distribution N(2, 1) in the interval of [-1, 5]

I've been giving the task to calculate and plot the normal distribution N(2, 1) in the interval of [-1, 5] Here's what I've tried: vec = np.random.norm(2, 1, 7); ND = stats.norm(2, 1).pdf(vec) x = ...
AlexT's user avatar
  • 589
1 vote
1 answer
439 views

Drawing a graph using dnorm and polygon function in R

I have found the probability using.. pnorm(176, 135, 10, lower.tail=TRUE) - pnorm(146, 135, 10, lower.tail=TRUE) Which resulted in 0.1356, about 14%. I have to use dnorm and polygon function to ...
Michael C Kang's user avatar
1 vote
1 answer
108 views

Normal distribution realizations [duplicate]

Hi I am trying to generate values using Matlab for the question below: Let x be a random variable with distribution N(0,1). Determine in an exact or approximate way: E{x^2} X=[-5:5]; Y=normpdf(X);...
user avatar
1 vote
0 answers
103 views

Fitting input data into Gaussian distribution

I'm currently reading papers on Variational Autoencoders (VAE). According to this article (http://proceedings.mlr.press/v95/guo18a/guo18a.pdf): By fitting the input data sample x(i) into the Gaussian ...
guillaume mendlevitch's user avatar
1 vote
1 answer
184 views

How to compute lower tail probability for the Bivariate Normal Distribution

G'day, I am trying to compute the lower tail probability for the bivariate Normal distribution given by the following formula for 2 random variables (X1, X2): Where X1 = -1.23, X2 = -2.75 and rho = ...
user avatar
1 vote
1 answer
267 views

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 ...
yrx1702's user avatar
  • 1,631
1 vote
1 answer
163 views

Poisson Distrubtion using Normal Approximation in Java

If you are unsure of what "Poisson Distrubtion using Normal Approximation" means, follow this link and check the texts inside the yellow box. https://onlinecourses.science.psu.edu/stat414/node/180 ...
xem's user avatar
  • 125
0 votes
2 answers
2k views

Probability transformation using R

I want to turn a continuous random variable X with cdf F(x) into a continuous random variable Y with cdf F(y) and am wondering how to implement it in R. For example, perform a probability ...
user2472273's user avatar
0 votes
2 answers
2k views

Calculate normal distribution probability in php

I need to use this table to get the probability from a given z value: https://statistics.laerd.com/statistical-guides/img/normal-table-large.png I'm sure there should be a better way to get those ...
LuisHP's user avatar
  • 49
0 votes
1 answer
2k views

fitting beta normal distribution to data

I want to fit betanormal distribution to my data X=c(5.20 , 6.80, 11.00, 21.00 ,25.50, 28.50, 30.90 ,30.90, 27.20, 17.70 ,10.50 , 6.70, 5.00, 8.00 ,14.30, 20.90 ,24.10 ,28.40 ,29.80, 30.80 ,26.80 ,...
HELYA's user avatar
  • 1
0 votes
3 answers
1k views

Generating samples from normal distribution

I am trying to generate many samples from normal distribution with different parameters (parametrs in a list). How can I do this using apply family? For example I need 2 samples one: (n = 10, mean =...
AgnieszkaTomczyk's user avatar
0 votes
1 answer
238 views

Normal Approximation versus MAP in pymc

Can anyone explain to me what does Normal Approximation do over and above what is done by MAP in some easy words? I have read enough on http://pymc-devs.github.io/pymc/modelfitting.html#normal-...
turing's user avatar
  • 597
0 votes
1 answer
414 views

Probability normal distribution in MATLAB

I have a normal distribution with given mean 10 and variance 40. Now I want to know the probability that a number from this distribution is smaller than 0. Is it correct to use the following one-liner ...
Radda's user avatar
  • 51
0 votes
1 answer
661 views

Why the answer of this Gaussian probability question is zero?

Assume the average weight of an American adult male is 180 pounds with a standard deviation of 34 pounds. The distribution of weights follows a normal distribution. What is the probability that a man ...
wawawa's user avatar
  • 3,095
0 votes
3 answers
314 views

Sample Distribution Simulation not resulting in Normal

I was trying to simulate "Sampling Distribution of Sample Proportions" using Python. I tried with a Bernoulli Variable as in example here The crux is that, out of large number of gumballs, we have ...
Parthiban Rajendran's user avatar
0 votes
1 answer
141 views

Probabilities of bivariate normally distributed random variable

I'm trying to calculate the probability of a bivariate normal distribution over a specific area using Matlab. Lets assume that the random variable follows a standard normal distribution and I want ...
أبو عبد الرحمن المراكشي's user avatar
0 votes
1 answer
190 views

Frequencies for a normal distribution

How to get frequencies that reflect a normal distribution for each integer 1...400. Values 1 and 400 would have the minimum frequency of 1, what would the frequencies be for the other values? Also, ...
PascalVKooten's user avatar
0 votes
1 answer
921 views

Central limit theorem in [R]

I am working with the language [R] to generate a sample of M = 32000 averages each calculated by averaging 36 independent values ​​of the random variable continuous uniform distribution (0, 1) is ...
franvergara66's user avatar
0 votes
1 answer
130 views

Two step probability draw - Combine probability weighting function and a draw from a truncuated normal distribution

I want to draw a random value (r) with python according to a specific probability function: The value should be a fixed constant with a probability (p) and with a probability (1-p) the value is ...
Nicki Maier's user avatar
0 votes
1 answer
444 views

Interpreting the y values of a pdf

In trying to understand the y values of a normal distribution plot I use this code: %reset -f import numpy as np from scipy.stats import norm import matplotlib.pyplot as plt data = [10,10,20,40,50,...
blue-sky's user avatar
  • 52.9k
0 votes
2 answers
646 views

Probability of a point taken from a certain normal distribution will be less than or equal to than a point taken from another?

Suppose we have two independent normal distributions How do I calculate the probability of a certain point taken from distribution X1 being less than or equal to a certain point taken from ...
Milind Dalvi's user avatar
0 votes
1 answer
232 views

Is pnorm(q = (x - $\mu$)/$\sigma$) ever different from pnorm(q = x, mean = $\mu$, sd = $\sigma$)?

It is the case that the probability density for a standardized and unstandardized random variable will differ. E.g., in R dnorm(x = 0, mean = 1, sd = 2) dnorm(x = (0 - 1)/2) However, pnorm(q = 0, ...
Student_718's user avatar
0 votes
1 answer
46 views

extracting probabilities from SciPy's norm object

I am using SciPy's norm object here and I have a normal distribution here with a mean value of 100. and a standard deviation of 20.: from scipy.stats import norm dist = norm(loc=100., scale=20.) ...
orie's user avatar
  • 571
0 votes
1 answer
164 views

Probability in Java (AnyLogic)

I would like to simulate the probability of producing good products and also defects with let's say 80% probability. I've seen that it's possible to generate numbers and see if they are equal to the ...
Ismail's user avatar
  • 3
0 votes
1 answer
139 views

cumulative log-normal function does not return a correct probability

I have some positive numbers and I am using log-normal distribution to plot and show the probability of CNT being between 1 and 50. I want to color the area below the curve and calculate the ...
Ibo's user avatar
  • 4,223
0 votes
1 answer
136 views

To find probabilities in a bivariate normal [closed]

I want to find probabilities in R of a Bivariate normal like P(X>3,Y<2), How can I do that? Thanks for the attention, and excuse my ignorance. Have a nice day.
Stiven Herrera's user avatar
0 votes
4 answers
877 views

Approximating Normal Distribution by adding Random Numbers

I would like to generate some random numbers which are normally distributed. It’s not mission critical, so a simple algorithm will suffice. I would then like to supply my own mean and standard ...
Manngo's user avatar
  • 15.2k
0 votes
2 answers
9k views

Calculating the probability of a sample mean using R

I'm in an intro to stats class right now, and have absolutely no idea what's going on. How would I solve the following problem using R? Let x be a continuous random variable that has a normal ...
Alyson 's user avatar