normal-distribution

Random Numbers with Gaussian and Uniform Distributions in matlab

 ̄綄美尐妖づ 提交于 2019-11-30 06:50:46
问题 I want generate a number in Gaussian and Uniform distributions in matlab. I know this function randi and rand() but all of them are in normal (Gaussian) distribution. How can a generate a random number in uniform distribution? 回答1: Use rand(dimensions) for a Uniform Distribution between 0 and 1. Use randn(dimensions) * sqrt(sigma) + mu for a Gaussian Distribution with a mean of mu and variance of sigma . 回答2: randn is the function to generate Gaussian distributed variables ( randi and rand

Generate matrix with iid normal random variables using R

放肆的年华 提交于 2019-11-30 06:24:42
Is there a way to generate a data set with normally distributed random values in R without using a loop? Each entry would represent an independent random variable with a normal distribution. To create an N by M matrix of iid normal random variables type this: matrix( rnorm(N*M,mean=0,sd=1), N, M) tweak the mean and standard deviation as desired. let mu be a vector of means and sigma a vector of standard devs mu<-1:10 sigma<-10:1 sample.size<-100 norm.mat<-mapply(function(x,y){rnorm(x,y,n=sample.size)},x=mu,y=sigma) would produce a matrix with columns holding the relevant samples You can use:

scipy.optimize.fmin_l_bfgs_b returns 'ABNORMAL_TERMINATION_IN_LNSRCH'

删除回忆录丶 提交于 2019-11-30 05:08:17
I am using scipy.optimize.fmin_l_bfgs_b to solve a gaussian mixture problem. The means of mixture distributions are modeled by regressions whose weights have to be optimized using EM algorithm. sigma_sp_new, func_val, info_dict = fmin_l_bfgs_b(func_to_minimize, self.sigma_vector[si][pj], args=(self.w_vectors[si][pj], Y, X, E_step_results[si][pj]), approx_grad=True, bounds=[(1e-8, 0.5)], factr=1e02, pgtol=1e-05, epsilon=1e-08) But sometimes I got a warning 'ABNORMAL_TERMINATION_IN_LNSRCH' in the information dictionary: func_to_minimize value = 1.14462324063e-07 information dictionary: {'task':

Create Normal Distribution (Bell Curve) chart using FLOT

社会主义新天地 提交于 2019-11-30 05:04:25
问题 Has anyone tried creating Normal Distribution chart using FLOT? If so, can you please put me in a right direction with some suggestions and links to tutorial? Thanks. 回答1: FLOT is simply a plotting engine. If you want to create a Bell Curve, you need to feed a probability density function a series of x values and plot the resulting points. For instance I used the functions from here to create this: Here's the jsFiddle that shows my work. 来源: https://stackoverflow.com/questions/7911151/create

How to generate normally distributed random from an integer range?

隐身守侯 提交于 2019-11-30 02:23:39
Given the start and the end of an integer range, how do I calculate a normally distributed random integer between this range? I realize that the normal distribution goes into -+ infinity. I guess the tails can be cutoff, so when a random gets computed outside the range, recompute. This elevates the probability of integers in the range, but as long as the this effect is tolerable (<5%), it's fine. public class Gaussian { private static bool uselast = true; private static double next_gaussian = 0.0; private static Random random = new Random(); public static double BoxMuller() { if (uselast) {

Generating random numbers with normal distribution in Excel

a 夏天 提交于 2019-11-29 20:34:33
I want to produce 100 random numbers with normal distribution (with µ=10, σ=7) and then draw a quantity diagram for these numbers. How can I produce random numbers with a specific distribution in Excel 2010? One more question: When I produce, for example, 20 random numbers with RANDBETWEEN(Bottom,Top) , the numbers change every time the sheet recalculates. How can I keep this from happening? Excellll Use the NORMINV function together with RAND() : =NORMINV(RAND(),10,7) To keep your set of random values from changing, select all the values, copy them, and then paste (special) the values back

Sample from multivariate normal/Gaussian distribution in C++

假装没事ソ 提交于 2019-11-29 20:26:36
I've been hunting for a convenient way to sample from a multivariate normal distribution. Does anyone know of a readily available code snippet to do that? For matrices/vectors, I'd prefer to use Boost or Eigen or another phenomenal library I'm not familiar with, but I could use GSL in a pinch. I'd also like it if the method accepted nonnegative -definite covariance matrices rather than requiring positive-definite (e.g., as with the Cholesky decomposition). This exists in MATLAB, NumPy, and others, but I've had a hard time finding a ready-made C/C++ solution. If I have to implement it myself, I

Multivariate normality test in Python [closed]

南笙酒味 提交于 2019-11-29 19:12:04
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 2 months ago . Is there a multivariate normality test available in any of packages in Python? I have heard of some scipy functions but are they applicable to multivariate data? I have a dataset with 30000 datapoints each point with 1024 variables. I want to check if these variables have multivariate normal distribution. How

multivariate normal cdf in C, C++, or Fortran [closed]

你离开我真会死。 提交于 2019-11-29 19:08:09
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 5 years ago . Is there an open source to calculate multivariate (where dimension is large > 3, not bivariate or trivariate ) numerical cdf of gaussian distributions in C, C++ or Fortran? I believe IMSL does it; http://www.roguewave.com/portals/0/products/imsl-numerical-libraries/c-library/docs/7.0/html/cstat/default.htm?turl

Fit data to normal distribution

主宰稳场 提交于 2019-11-29 17:06:36
I want some data to fit the corresponding Gaussian distribution. The data is meant to be Gaussian already, but for some filtering reasons, they will not perfectly match the prescribed and expected Gaussian distribution. I therefore aim to reduce the existing scatter between data and desired distribution. For example, my data fit the Gaussian distribution as follows (the expected mean value is 0 and the standard deviation 0.8): The approximation is already decent, but I really want to crunch the still tangible scatter between simulated data and expected distribution. How can I achieve this?